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

How to enable body collision->fusion

Topics: Developer Forum, User Forum
Jan 7, 2011 at 1:43 PM

You have to at least destroy one body and recreate the attached fixtures and add them to the other body. To get a proper collision response you'd have to cache the resulting forces of the collision between the original bodies somewhere and apply those to the new "fused" body afterwards.

The Joint approach might also work for you, because you can always check the joint list and if other bodies are attached within the OnCollision event. Therefore you can handle collisions of "connected" bodies different, even if you don't roll up the user data from both bodies in one object. That would have the benefit, that bodies could be easily broken up again if needed as Farseer 3.2 supports breakable joints which handle that for you if a certain amount of force is applied.

Jan 9, 2011 at 1:27 PM
kevnt wrote:

[...] however it appears that the bodies linked together are still rotating independently (e.g. two circles linked by a distance joint behave like a bicycle rather than a dumbbell) - is this expected behavior?

Yes it is. Have a look at the weld joint ;)

I also don't know where to begin regarding destructive joints.

Just set Joint.Breakpoint to the break limit and it will be breakable. You'll have to experiment a bit with the Breakpoint value though. Joints also fire the Broke event on breaking.