This project has moved. For the latest updates, please go here.

Rotation after Collision

Topics: Developer Forum
Aug 25, 2008 at 3:06 AM
Forgive my limited understanding and knowledge of physics but I am creating a top down game and using Farseer for the collision detection. I am applying forces and torque to the body to get it to move but when collisions occur the bodies rotate off in the distance. I understand this may be due to the top down view but was wondering if there was a clean method of preventing this activity. I imagine I could put in hacks that prevent rotation but the bodies also move away from each other too rapidly. These bodies shouldn't spin away from each other, just bump and move slightly out of each other's way.
Again, I have a limited understanding of physics so any help as to what properties I might be able to set and possible value ranges would be appreciated?

Aug 25, 2008 at 6:34 AM
Just set MomentOfIntertia like that:

    body.MomentOfInertia = float.PositiveInfinity;

This will prevent body from rotation.
Aug 25, 2008 at 6:43 PM
Thanks, that works for stopping rotation but the bodies still drift when hit. I don't think a horse would drift like it was floating on water if it ran into another horse :) I realize all these are just hacks since Farseer wasn't meant to operate in top down view.
Aug 25, 2008 at 6:51 PM
Setting the RestitutionCoefficient of the two colliding bodies/geometries to be near 0.0 should prevent the bodies from moving much after a collision, if my memory is correct.
Aug 26, 2008 at 8:05 AM
I cant remember the code to do it but (Just woke up) try making the Air Friction to higher (Im assuming ur using Farseer just without gravity?)
Aug 27, 2008 at 4:35 AM
I've got kind of a combination of these kind of working now, thanks all!