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

Do I have this right?

Topics: User Forum
Oct 27, 2009 at 12:26 PM


Disclaimer: I am not a physics expert, far from it, so please forgive my ignorance if what I'm asking is incorrect.

I'm a new starter to Farseer and would like your help in answering a few questions:

1) Would it be correct to think of the ApplyForce method as a way of accelerating a body? If so, I take it I would have to apply the "force" to the body on each game loop update?

2) I would like to implement some kind of resistence to a body, e.g wind. Would I have to apply this "wind force" to each body and in each game loop update by calling ApplyForce?

3) (Related to #2) Is the LinearDragCoefficient field of a body taken account when dealing with the forces applied to a body? Is the drag the same regardless which direction the force is applied?

Kinds Regards


Oct 27, 2009 at 5:14 PM

1. Yes.  ApplyForce, ApplyImpulse, Torque, etc, are all used to adjust velocity.  In the case of ApplyForce, the mass of the body and update rate of the physics simulation itself are taken into account.  The last part means that even if you call ApplyForce each update with the same ammount of force, the effect will be the same if you were to raise or lower the delay between physics updates.  ApplyImpulse is similar, however it doesn't take update rate into account, which makes it good for one-time impulses.

2. Wind can be treated similar to gravity.  A force that is applied to each body on each update. (Using ApplyForce.)

3. Drag only affects bodies that are already moving.  It itself is a force that simply attempts to lower velocity, and doesn't affect other forces.  There are friction and restitution settings for tweaking how collisions behave.

Oct 27, 2009 at 7:18 PM

Thanks Yota.

3) So if I had a sprite of a car and when a force (e.g. wind) hit the car from the front there was less drag than if the wind hit from the back, how would this be represented in Farseer? Would I have to create multiple bodies, of different shapes, for different parts of the car and give each different drag values?

Nov 10, 2009 at 8:36 AM

Farseer does not focus on fluid-type physics, so if you wanted to create a more advanced form of wind than simply "everything gets pushed this much in this direction," you'll have to come up with your own method that simulates your intended outcome.