tgt
tgt

Reputation: 1308

Prevent collisions applying impulse in Bullet physics

I am developing third-person shooting game using Bullet and Ogre. When the character model collides with an object in the world, such as a power-up, the collision applies a force to the character and causes them to spin. How can I prevent the collision applying a force to the character?

I have set a method for btDynamicsWorld::setInternalTickCallback and so I know which bodies are colliding and the btManifoldPoint.

Note that I applyTorque to the body in order to rotate them smoothly so I cannot simply prevent rotation.

Thanks for your help.

Upvotes: 3

Views: 1123

Answers (1)

phyatt
phyatt

Reputation: 19102

I am unfamiliar with the physics engines you mentioned, but I know a thing or two about real physics...

Basically if you draw a free body diagram and arrows that represent the forces, you can determine the net effect. Or if you know the desired net effect, you can figure out where you need to add forces or remove forces.

You could add an equal and opposite force/torque at the time of impact. This would make the net forces on your object zero.

Or you could take the elements that are causing the forces and make them massless. Force = mass * acceleration. If the mass is zero and your physics engine is based on real world physics, then it shouldn't cause any net forces on collision.

Hope that helps.

Upvotes: 1

Related Questions