1
\$\begingroup\$

The game I'm working on involves shapes that might be composed of multiple materials in a variety of ways. Let's just take for example a wooden rod with and sizable tip of iron or say a block composed of a couple triangles of stone and aluminum and small nugget of gold. The shapes and compositions will change from time to time, so I was wondering what engine I should use and how I might implement this feature?

I've looked at Farseer 3, but I'm still trying to decipher the library by reading the source and the samples and wasn't sure if I was barking up the wrong tree.

Thanks!

\$\endgroup\$

1 Answer 1

1
\$\begingroup\$

Farseer's physics operates on "Bodies" made up of one or more "Fixtures". Bodies are rigid, and the fixtures of a single body cannot move relative to each other.

Bodies have a position, angular velocity, linear velocity, torque, mass, centre-of-mass, etc. And, of course, a list of child fixtures.

Fixtures have a shape (eg: a polygon made up of points, or a circle), a coefficient of restitution, a coefficient of friction, and a mass (although you usually specify a density, and Farseer will work out the mass from the shape's area).

So, yes, Farseer should be able to handle exactly what you want. Just make up a body from multiple fixtures.

(You could also, as an optimisation, have a single fixture, and set the mass/center-of-mass/etc properties on the body by hand. If you need to separate your fixtures at some point - you can modify bodies on-the-fly - or you can use multiple bodies and attach them together with joints.)

\$\endgroup\$
1
  • \$\begingroup\$ Awesome, thanks! Now I just need to find a decent tutorial for version 3, since I'm finding the docs for 2 just aren't cutting it. Till then I'll keep trudging through trying to understand the samples. Thanks again! \$\endgroup\$
    – Stupac
    Sep 21, 2012 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .