Perfectly Inelastic Collisions

Topics: User Forum
Feb 20, 2010 at 8:31 PM

Hello Farseer community,

I'm working on a physics-based game using Farseer 2.1.3 Xbox360 and we've hit a snag regarding perfectly inelastic collisions.

We want to have some functionality for attaching an object to another object (at run time) and preserving the physics of a perfectly inelastic collision (with regards to momentum, the new moment of inertia, etc).

Does Farseer have some functionality to handle this? We had some ideas on how to handle it but we'd rather not mess with the guts of the physics calculations unless we really have to.

Thanks!

-Rick S.

Coordinator
Feb 20, 2010 at 8:41 PM

Farseer Physics Engine uses iterative algorithms and thus you can't create inelastic (100% rigid) constraints between two bodies. However, there is a way of combining two geometries by using one body. Attaching two geometries to one body will change the mass and centroid of the body so that it fits the new geometry.

Try creating two geoms and a single body. You should be able to see if that is what you want from that. To preserve forces applied on the body, you will have to store linear and angular velocity and reapply it once you have the combined physics body.

Feb 20, 2010 at 8:53 PM

Awesome, this sounds do-able. We'll give it a shot and let you know how it works out.

 

Jul 28, 2010 at 4:20 AM

We implemented this as you described to great effect. We needed to make the geometry offset a public variable in order to accomplish it (along with a few other minor hacks) but otherwise it was relatively painless.