0
\$\begingroup\$

So in LibGDX the Sprite objects position is where it's 0,0 mark is in the word. In Box2D a a bodies position is in it's center. So to line these up when you update the sprites position with the bodies position you would adjust it by half the width and height. But it seems to me theres no reason to worry about that. Because the relative position is always going to be the same, and that it'll just waste calculations lining it up. Is there any reason I should do it?

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

Just make sure your sprites aren't going outside the canvas if you don't want them to and I think it's fine. You'd just have to alter the boundaries for the bodies in relation to the canvas in that case.

\$\endgroup\$
1
  • \$\begingroup\$ I would like to add that, having said that, I do prefer my sprites to be lined up with the fixtures of the bodies. I keep debug draw hooked up to a toggle button so I can switch back and forth and check for what's "actually going on". It's just easier to visualize if the sprites fall away to the polygons as I hit the debug button. But that's just the way I work. \$\endgroup\$
    – Brimby
    Commented Apr 14, 2014 at 15:25

You must log in to answer this question.

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