libgdx spite position relative to body
- by While-E
Apologies if this is a reiteration, as I couldn't find another discussion of this over the past couple days.
Issue:
I'm using libgdx and box2d, and I'm currently updating the sprite's position to the body's current position every render call. Using a debugRenderer to see the bodies, I see that there is fairly noticeable lag between the movement/position of the body and the sprite that is being moved relative to it.
Question:
Is this lag normal, possibly to perform collisions ahead of time? If not, should I be manipulating/relating the positions differently?
Thanks in advance!
[Solution]
This was a coding error on my part. Pointed out by a good reply below, I was updating the position of the sprite relative to the body and then stepping the physics. Thus never actually setting the sprite to the body's CURRENT position. Thanks!