Prevent a body from rotating

Feb 7, 2010 at 4:46 PM

Is there a way to prevent a body from rotating ?


In my game, I shoot projectiles at enemies. Both projectile and enemy have a body and a geom, and when my rocket or bullet hits the enemy, it rotates A LOT and keep rotating forever.


I tried to set the RotationalDragCoefficient to 100.0f and it still rotates forever, but slowly.


Any clue ?



Feb 7, 2010 at 9:23 PM

body.momentofinertia = float.positiveinfinity


You can add a fixed angle joint to the body you want to avoid rotate.

Feb 8, 2010 at 1:21 PM

You can also set the body angularVelocity to 0 in every update.



Feb 9, 2010 at 6:46 AM

I too use

body.momentofinertia = float.positiveinfinity

The most clean solution imo.


Feb 13, 2010 at 4:23 PM

It works pretty well with the MomentOfInertia set to infinity.

Thank you guys !