Issue with determining width/height of a fixture

Topics: Developer Forum, User Forum
Dec 19, 2011 at 1:45 AM
Edited Dec 19, 2011 at 1:47 AM

What I am trying to do is determine the (half) width and (half) height of a given fixture in order to determine the top-left corner of the object in question for rendering position purposes.

Following the discussion here: I attempted to get the width/height of a fixture (using code almost exactly like the last bit posted).

Unfortunately, it seems as though the data returned by the AABB is slightly too large and doesn't completely match up with the expected size.

For example, I create my Farseer Body/Shape/Fixture (I will use a Rectangle shape for this object to keep things simple) for a game object of size 36 pixels by 60 pixels. Using a sim:world ratio of 64, the created shape's vertices are as expected: {X:-0.28125 Y:-0.46875} {X:0.28125 Y:-0.46875} {X:0.28125 Y:0.46875} {X:-0.28125 Y:0.46875}. So that's working okay.

However, when I go to compute the AABB, the vertices for the AABB are slightly larger than the vertices of the shape itself: {X:-0.29125 Y:-0.47875} {X:-0.29125 Y:0.47875} {X:0.29125 Y:0.47875} {X:0.29125 Y:-0.47875}. Note that both the X and Y values for each vertex are increased/decreased by 0.01 (sim) units.

I'm curious if there's something I've done obviously incorrectly here...