Here is the code I'm using to get fixture position:
Code: Select all
-- v is a table containing body, fixture, and shape
tx, ty, bx, by = v.body:getWorldPoints(v.fixture:getBoundingBox())
xx = (tx * bx) / 2
yy = (ty * by) / 2 -- get the average between the top left and bottom right corners to find position
print(xx .. ", " .. yy .. " | " .. v.body:getX() .. ", " .. v.body:getY()) -- print the position made with xx and yy, then the actual position
Code: Select all
-2915349.9361766, 1329839.7915285 | 325, 825
Code: Select all
-2915349.9361766, 1329839.7915285 | 325, 825
PS: Why isn't there just a Fixture:GetPosition() function???
Edit: I'm an idiot, I was multiplying instead of adding for the average equation.... Well, at least it's fixed now. (I could have sworn I had similarly weird results when just printing the coordinates of points returned by getBoundingBox() but whatever)