Basic working..

Post Reply
Posts: 1
Joined: Sun Oct 13, 2013 5:35 am

Basic working..

Post 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. ?
Posts: 149
Joined: Fri May 24, 2013 6:08 am

Re: Basic working..

Post 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
Post Reply