How to enable SAT?

Topics: Developer Forum
Jul 29, 2010 at 8:12 PM

Hey team, sorry for the noob question but:

How do I switch farseer physics 2.1 to use the seperating axis algorithm?

The guide says it's as easy as inserting the line of code:

PhysicsSimulator.NarrowPhaseCollider = new SAT(PhysicsSimulator);


However, when I enter that line, I get the message:

Error    1    'FarseerGames.FarseerPhysics.PhysicsSimulator' is a 'type' but is used like a 'variable'

Error    2    'FarseerGames.FarseerPhysics.Collisions.SAT' does not contain a constructor that takes '1' arguments


My instance of PhysicsSimulator is called physicsSimulator, but it doesn't have a SAT field.


Failing a way to enable SAT, is there any way, using the default narrow phase collision, to stop things getting stuck in each other? My problem isn't that things are moving to fast or are too small, but that knewly spawned objects (Eg, missiles) spawn inside already present physical objects, and stay there. I know that SAT is very good at separating things.

Jul 30, 2010 at 2:00 AM
Edited Jul 30, 2010 at 2:00 AM
For some reason, the guide is misleading and is unintuitive as to how to switch the NarrowPhaseCollider. PhysicsSimulator.NarrowPhaseCollider is actually a property for an enum called NarrowPhaseCollider. To switch it to SAT, just add the following line: PhysicsSimulator.NarrowPhaseCollider = NarrowPhaseCollider.SAT; This should solve the problem of objects getting stuck in each other.
Jul 30, 2010 at 5:22 AM

Thanks octopi, that worked a treat! Is there any way to change that line in the guide? I couldn't find the answer no matter how hard I googled!

Jul 31, 2010 at 4:40 PM

Sorry about the misleading documentation. I changed the implementation of the switching mechanism right after documenting it. It will be easier to change the documentation once FPE 3.0 is out and I'll make sure to update the documentation when misleading information is found.