Bullet crashes when updating position of kinematic object

Bob666
Posts: 3
Joined: Fri Apr 01, 2011 8:37 pm

Bullet crashes when updating position of kinematic object

Post by Bob666 »

Hi all

I have a problem when using Bullet, OpenSceneGraph and osgBullet. I have a couple of boxes which are falling down onto a gound. Then I created a Sphere which I can manually move around. The boxes behave as they should, but I can't get the sphere to work. If i set it up as the boxes, it falls down, which isn't what I want. I set the collision flag btCollisionObject::CF_KINEMATIC_OBJECT and want to set the position using

Code: Select all

 ...->getMotionState()->setWorldTransform(trans);
this would set the new position using a btTransform->setOrigin onto an osgbBullet::MotionState. I Then can see in the output that osgBullet sets the new position, but after a couple of steps, I get an assertion:

Code: Select all

Assertion failed: s != btScalar(0.0), file bullet-2.77\src\linearmath\btQuaternion.h, line 188
The problem is, that the the value bullet want's to divide gets somehow -1.#IND000...

Can somebody help me or point out how to manually set a position of an object when using osgBullet?
Thanks
Bob
Kanttori
Posts: 38
Joined: Thu Jul 08, 2010 12:52 am

Re: Bullet crashes when updating position of kinematic objec

Post by Kanttori »

Maybe you're not initializing the btTransform's rotation-part? Try ...

Code: Select all

btTransform trans;

// Initialize transform (both basis and origin to "no transform")
trans.setIdentity();

// And then set the location
trans.setOrigin( loc );
... and you should have a valid btTransform.
Bob666
Posts: 3
Joined: Fri Apr 01, 2011 8:37 pm

Re: Bullet crashes when updating position of kinematic objec

Post by Bob666 »

Great, that did the trick...

Thanks a lot.