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

Multiple PhysicsSimulator

Topics: Developer Forum, User Forum
Jun 20, 2010 at 8:11 PM


I'm using Farseer for the game i'm working on.

I was wondering if it is possible to run 2 PhysicsSimulator objects at the same time, while having the same Body in both?


I'd like to be able to change the Gravity member while affecting one body, without affecting all other physical-entities in the simulation.

One possible solution i thought of was having the body running in 2 PhysicsSimulator objects, one with "dynamic" gravity, and the other fixed gravity (not sure this solution is 100% valid).


Is this possible ?






Jun 20, 2010 at 11:06 PM

Sounds possible. Try it out.


Jun 22, 2010 at 1:13 PM

After trying it, it seems impossible to get done with the current implementation.


How hard would it be to extend the current implementation to give every Body object a Gravity field -- for objects whose Gravity is not defined it'll use the PhysicsSimulator gravity, for others it would use the Body's gravity value.

Do you think this solution is at all possible?


The effect i'm trying to achieve is of 1 (or perhaps more in the future) objects behaving as if under their own gravity, while the rest of the World with a different gravity, while keeping all collisions between all bodies as it should be occuring.




Jun 26, 2010 at 6:51 PM

I would just manually apply gravity to the objects.

Just run something like this in your update call for your objects.

And maybe a boolean/enum/switch case to modify what gravity is being applied.

I don't think gravity is complicated.
Let me know if gravity is more complex than a directional force