Page 1 of 1

applyCentralImpulse bug

Posted: Wed Mar 26, 2014 3:42 pm
by Blackhart
Hello, :)

I have a problem with bullet physics (the applyCentralImpulse function).
Then here, i did a software powered by Qt/Qml/OpenGL wherein i draw a white cube that i add in my bullet physics world with addRigidBody function. Finally, i add him a force in a given direction. This is an explosion whose epicenter is my mouse ...

In a normally context, it works fine, my cube move. But, when i play with my GUI (click everywhere), Bullet crashes and my cube don't move.

After debug, my software goes through all the stages with success.
- He detects that my mouse [is near the/collide with] cube (with Manifold).
- He goes in applyCentralImpulse function with good force (btVector3).
- He goes in stepSimulation function with good deltaTime.

However, my cube keeps the same position (shown with getWorldTransform().getOrigin()).

I can't shown my source code, it is huge and partitioned between several classes ...
Any Ideas ? :)

Thx and sorry for my english.

Re: applyCentralImpulse bug

Posted: Fri Mar 28, 2014 1:31 pm
by bwelch
Is your box activated? If it's stationary for a while, Bullet will deactivate it and it won't be moved even if you apply an impulse to it. Try doing rigidBody->setActivationState(DISABLE_DEACTIVATION).

Re: applyCentralImpulse bug

Posted: Mon Mar 31, 2014 11:30 am
by Blackhart
Hello,

Thanks for your reply :)
I found the answer to my problem with rigidBody-> activate(), but your solution is better if it avoid me functions call.