Page 1 of 1

Basic working..

Posted: Sun Oct 13, 2013 5:43 am
by magingax
I just started studying bullet..and faced some block..
Below is what I understood way to work..

1. make dynamic world with setting
2. Add rigid bodies
3. step simulate
4. get rigid body state and use it
5. goto 3

Problem is..How can I identify body what I want to know..?
For example
I added rigid bodies, 'car', 'ball', 'dog' ..
and step simulate..
then I want to know state of 'ball'..
then...How can I get specific 'ball' rigid body from world which contains all bodies. ?

Re: Basic working..

Posted: Mon Oct 14, 2013 7:54 pm
by c6burns
Just hold onto the pointer to your body (by not letting it go out of scope). So in the example at the bottom of this page: ... gid_Bodies

Instead of declaring btRigidBody *rigidBody; locally, make it a global or a class member. Then use the pointer to access it after stepping the simulation. Also you should be aware of motion states which are very helpful in updating position/orientation of your bodies for rendering: ... tionStates