This project has moved and is read-only. For the latest updates, please go here.

Toggling Objects IsStatic

Topics: User Forum
Apr 15, 2009 at 7:31 PM
In my game I need to be able to toggle objects from a non-static state to a static one and back. Unfortunately I can't get this to work. I tried switching the IsStatic, but when I do that to a dynamic object the game will crash whenever something collides with it. Also when I switch back to being non-static, I get a crash. Both point at this line in Body.ApplyDrag:

_rotationalDrag = AngularVelocity * AngularVelocity * Math.Sign(AngularVelocity);

With the exception being that AngularVelocity is NaN and Math.Sign does not accept NaN values.

What is the recommended method for toggling objects from non-static to static and back?