Force object to a specific position?

Topics: Developer Forum
Feb 27, 2011 at 3:04 PM

Hi

Is it possible through farseer physics engine to have an object forced to a specific position and every time another object push the object away from this point it will return to its position again? If yes how?

Fnoller

Feb 28, 2011 at 4:24 AM

You can specify the position of a body by setting its Body.Position field.  You could set this to the same value on every step, or you could set its Body.BodyType to BodyType.Static, which is not affected by forces and will therefore remain in the same position at all times.

Feb 28, 2011 at 5:00 AM

Thanks for your response FreelancePolice.

I think you misunderstood my question, I don’t want a static object, it should be possible to push the object away from this point, but when it’s possible the object should return to the position again.

Developer
Mar 29, 2011 at 8:07 AM

You could try a point gravity controller or use a distance joint like a spring to attach your object to the position you would like it to return to.