Jump to content
  • Advertisement
Sign in to follow this  
madRenEGadE

Weird behaviour with Bullet Physics

This topic is 2991 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello I have the following problem: I have integrated the bullet physics library into my game engine and experienced a weird behaviour. The collision handling seems to be working properly but as you can se from this video when some balls fall onto a plane the are not rotating correctly. Does anybody have an idea what the source of this problem could be? Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
It looks like you're just computing the rendering transform incorrectly. Can you show us the code for how you convert the bullet world transform into one you use for rendering?

Share this post


Link to post
Share on other sites
After the physics step has finished I
use the motion state of the rigid body to get the world transform.
Afterwards I use btTransform::getRotation().getAxis() and getRotation().getAngle()
The rotation axis and angle I then use for the call to glRotate

Share this post


Link to post
Share on other sites
did you ensure that the angle is in the proper units (radians or degrees)? and that the axis is unit length ? and that the handedness are the same?

You know there is any easier way, using bullet. I believe the btTransform class has a member getOpenglMatrix( ); or something like that. You should be able to get a 16 float array out of that, which you should then pass to glMultMatrixf, versus calling translate and rotate separately.

glMultMatrixf( GL_MODELVIEW, trans.getOpenglMatrix( ) );


Also, your game should probably be making use of a matrix class. To handle all your transformation tasks without depending on glTranslate and glRotate.

It would then be wise to make a utility conversion function to go between your matrix and the bullet transform.

MyMatrixType ConvertBulletToMy( const btTransform& bt );
btTransform ConvertMyToBullet( const MyMatrixType& mt );

That way you can initialize the bullet objects from your game transforms, and easily get game transforms from the bullet objects. You matrix type should support a similar function to getOpenglMatrix() so that it can be passed to glMultMatrixf when you need to draw objects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!