Restrict rotation of body

Topics: Developer Forum, Project Management Forum
Dec 25, 2009 at 8:49 PM

Hi,

 

I'm new to developing on the Farseer platform, and I wanted to ask about restricting the rotation of a body.  How does one do this?

The IsStatic property of bodies will not due since I would like to update the position and move the body around still.  I would like only for the body to not rotate.

One way of achieving this end might be to set Body.Rotation = 0f each frame, but I was wondering if there were a more standard approach.

 

Thanks.

Coordinator
Dec 25, 2009 at 10:22 PM

You could set the MOI (moment of inertia) on the body to float.PositiveInfinity. That would stop the body from rotating.

Dec 26, 2009 at 4:12 AM

You can use a fixed angle joint too (that's what I do).

 

JointFactory.Instance.CreateFixedAngleJoint(mPhysicsSimulator, body);