Synchronise btRigidBody between threads (GUI / physics)

BattleLeader
Posts: 2
Joined: Wed Oct 31, 2012 3:17 pm

Synchronise btRigidBody between threads (GUI / physics)

Post by BattleLeader »

I am developing a multithreaded application in which GUI, physics and graphics (amongst others) each run a different thread.

My concerns are about synchronization of the btRigidBody properties, such as velocity and position.
The GUI thread can alter these based upon user input. This can happen in parallel to the Physics update (stepSimulation()).
This is not a problem with interaction between graphics and physics, as I have subclassed btMotionState and implemented locks.
However, generic properties do not have this option.

How do I ensure synchronisation of property read/writes between the GUI and the physics thread?
I.e. what can I do to make dynamicsWorld lock the currently being processed body?
BattleLeader
Posts: 2
Joined: Wed Oct 31, 2012 3:17 pm

Re: Synchronise btRigidBody between threads (GUI / physics)

Post by BattleLeader »

Could I use the gContactAddedCallback and gContactProcessedCallback to respectively lock and unlock the rigidbody?
These are described here (bullet wiki).
Does "contact processed" mean that the physical properties of the body are updated?
That is, are the velocity, position etc. properties updated in between calling these callbacks?