libgdx spite position relative to body
Posted
by
While-E
on Game Development
See other posts from Game Development
or by While-E
Published on 2012-02-22T23:41:01Z
Indexed on
2012/03/25
5:40 UTC
Read the original article
Hit count: 565
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!
© Game Development or respective owner