Beginner question: How does a Body relate to Geom?

Nov 3, 2007 at 4:27 AM
I guess a more specific question is: Why does a Body need to be initialized as either a rectangle or a circle; why can't it be an arbitrary polygon? If I want a triangular-shaped object, for example, I understand that I can use GeomFactory.Instance.CreatePolygonGeom() for collision, but how would I initialize the Body representing this object? As a rectangle? As a circle? What does this rectangle or circle represent?

All of the samples I've seen have been trivial because the objects in question were already circles or rectangles, but what do I do if I have a triangle or another non-rectangular polygon?
Nov 3, 2007 at 8:11 AM
Now, I'm pretty new to Farseer, but I believe that a body is really nothing more than a point in space with a rotation, it doesn't actually have a shape.

The two choices you are giving for a Body, Circle and Rectangle, generate the MOI (Moment of Inertia) based on those shapes. If you would like a more abstract shape, you would have to calculate the MOI yourself, and then just call the non-specific CreateBody() and pass in your custom MOI.

I'm no physics expert or Farseer expert, so take this with a grain of salt...
Nov 5, 2007 at 4:45 AM
Thanks a lot DaJackel, this sounds like a very reasonable answer. :)

I hope that in time we'll see more tutorials / documentation, since Farseer has a lot to offer!
Coordinator
Nov 5, 2007 at 4:42 PM
There is also now a helper method in the Vertices object, I think, that will return the MOI of a set of vertices.
Coordinator
Nov 6, 2007 at 8:56 PM

crashlander wrote:
There is also now a helper method in the Vertices object, I think, that will return the MOI of a set of vertices.


Thanks !

I was looking into calculating the MOI of a triangle,
Link: http://lab.polygonal.de/2006/08/17/calculating-the-moment-of-inertia-of-a-convex-polygon/

There is a million ways of doing it ! I hope the helper method will help me accomplish this.
Coordinator
Nov 7, 2007 at 11:35 AM
It should help.

And thank BioSlayer... I got the code from him.