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

Farseer Physics Engine with my 2.5 d game

Topics: Developer Forum
Oct 6, 2009 at 9:41 AM
Edited Oct 7, 2009 at 7:31 AM

hi :)

first, i have to say your physics engine is really great.

second, i would like to use the engine with my 2.5d game project. However, in 2.5D we need Z coordinate to indicate movement of objects along z axis.

therefore, i would implement the third dimension (Z) dimension physics but let x and y to be your physics engine job.

how would i get start, and i don't know where is your physics algorithm.

Any suggestion?

Thanks for every thought and opinion :)

Oct 7, 2009 at 7:31 AM
Edited Oct 7, 2009 at 7:33 AM

I just want to know about your physics algorithm ( may be it not appropriate to ask?), because we need to put related literature in our project proposal and we think

we should tell about your physics algorithm ( our project is about using farseer physics engine with 2.5D games).

But we don't sure where your physics algorithm is and how it works, so we decide to come and ask directly because it will help us a lots.

Can you tell us about your algorithm? may be just a brief examples to help us start digging your code or maybe a theory of physics algorithm that you use in Farseer.


English is not my mother tongue, so I may explain not really well, I have to apologize about that. XD

Oct 9, 2009 at 5:52 PM

Hi there,

There are a couple of resources available to you. There's a really good manual that describes a lot of what you're asking for located here:

Another good resource is the source code itself. I would recommend you start looking in PhysicsSimulator for details on how they get things done. Most specifically, if you look in the Update method (PhysicsSimulator.Update), I think you'll be able to start dissecting the processes the Farseer Physics engine uses. The method signature to look for is below:

public void Update(float dt, float dtReal)
In turn, each of the methods that Update calls DoBroadPhaseCollision, DoNarrowPhaseCollision, etc. will start giving you information on each major step of the physics algorithm. The method signatures to look for are:
private void DoBroadPhaseCollision() /* Does high level 
collision detection. Creates a bunch of pairs of objects that
are potentially colliding. */

private void DoNarrowPhaseCollision() /* Does more
detailed collision detection. Takes all the pairs of objects
and determines if they are actually colliding */

private void ApplyForces(float dt, float dtReal) /* Applies
forces to objects (gravity, springs, etc). */

private void ApplyImpulses(float dt) /* Applies the 
impulses to all joints and arbiters. */

private void UpdatePositions(float dt) /* Updates 
the position on all bodies. */
Finally, I would really recommend taking a look at the method that does the integration work. This is in Dynamics\Body.cs:
internal void IntegratePosition(float dt)

Good luck, I hope your project goes well!

Oct 9, 2009 at 10:58 PM

@ncallaway: Great overview. Thanks.

@fides5566: If you need more details on how physics engines are put together, you can take a look at my 2D physics engine tutorial. I'm just about done writing about the numerical integration (integrator) and constraint-solver part of physics engines. If you need more detailed info about Farseer Physics Engine, feel free to contact me or ask on the forums.

By the way, I would like to know what you are using FPE for and what kind of assignment it is. Just out of curiosity :)