public static Vector2 CalculateOrigin(PhysicsBody b) { Vector2 lBound = new Vector2(float.MaxValue); AABB bounds; Transform trans; b.GetTransform(out trans); for (int i = 0; i < b.FixtureList.Count; ++i) { for (int j = 0; j < b.FixtureList[i].Shape.ChildCount; ++j) { b.FixtureList[i].Shape.ComputeAABB(out bounds, ref trans, j); Vector2.Min(ref lBound, ref bounds.LowerBound, out lBound); } } // calculate body offset from its center and add a 1 pixel border // because we generate the textures a little bigger than the actual body's fixtures return ConvertUnits.ToDisplayUnits(b.Position - lBound) + new Vector2(1f); }