Don't know how to render based on bullet coords

nsduo
Posts: 2
Joined: Sat Feb 11, 2012 10:04 pm

Don't know how to render based on bullet coords

Post by nsduo »

So I'm building my own game engine and I'm using bullet to handle my physics and collision requirements. I managed to get it setup and working, and I also managed to organize the environment classes into the managers that are supposed to hold them (ie: btDiscreteDynamicWorld is held in each scene and each entity has a rigid body and references a collision shape).

What I'm having trouble with is, rendering my opengl 2D and or 3D objects based on bullet's coordinates. I've tried looking at the bullet demos as an example, but the rendering calls are buried so deep I can't find them or make heads or tails of the code I can see. I found some iOS examples, but they have the same problem, along with the added bonus of being written in objective C: which I can't read.

How exactly do I orient my opengl 2D and or 3D objects based on bullet's coordinates?
User avatar
xissburg
Posts: 46
Joined: Sat May 19, 2007 9:28 pm

Re: Don't know how to render based on bullet coords

Post by xissburg »

I think you're looking for Motion States http://bulletphysics.org/mediawiki-1.5. ... tionStates
nsduo
Posts: 2
Joined: Sat Feb 11, 2012 10:04 pm

Re: Don't know how to render based on bullet coords

Post by nsduo »

I don't really understand how this works. Do I extract the coordinates and put them in glTranslate and glRotate? Or does it do this automatically for me?

Either way I don't know how to implement it into my opengl renderer.
User avatar
xissburg
Posts: 46
Joined: Sat May 19, 2007 9:28 pm

Re: Don't know how to render based on bullet coords

Post by xissburg »

Please read the manual and look into the examples.

"To implement one, simply inherit btMotionState and override getWorldTransform and setWorldTransform."

"Bullet calls setWorldTransform with the transform of the body, for you to update your object appropriately."

The Ogre3d example at the bottom is just very clear about how to implement your own MotionState.