Question

I am new to Farseer, developing a xna + Farseer physics game. There are multiple Physics bodies(square,circle, rectangle shapes) in the game, trying to findout all of the bodies in touch (touching each other), i can calculate based on the width/height but this will not be accurate. i would like to know any other ways or any in built functions in Farseer physics

Était-ce utile?

La solution

Check out this answer for a lot of details. You may be able to use one of the events listed in that answer directly, depending on your needs.

But, otherwise, you can get Contact objects by either "collecting" them from one of those events, or by extracting them from Body.ContactList (which is a linked list made up of ContactEdge objects).

Note, of course, that a Contact might not actually be touching (it just indicates a potential collision). Use Contact.IsTouching() to check for that.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top