This project has moved. For the latest updates, please go here.

collision mechanics

Topics: Developer Forum
Jun 2, 2014 at 9:08 AM
Edited Jun 2, 2014 at 10:03 AM

I'm new farseer physics user and i can't understand how to handling collisions for own use.

How to recognize of type colliding object? f1 and f2 are Fixture type, and i can't get a name of containing it class.
public bool MyOnCollision(Fixture f1, Fixture f2, Contact contact)
            return true;

Jun 25, 2014 at 10:22 AM

you can store a UserData object in your fixtures/bodies, like the parent object containing your physic body.
Body b = new Body();
b.UserData = this;
// or
b.UserData = "floor";
And then when you check your collision, use the UserData object for your logic.