android - LibGdx Setting Velocity -
how can set linear velocity in x direction without effecting motion of y direction body in libgdx box2d. applied impulse body make jump want move towards right or left tried applying following method:
setlinearvelocity(vector2)
but stopping vertical motion. thanks
just retrieve current velocity via getter, manipulate , set new one.
vector2 velocity = body.getlinearvelocity().cpy(); velocity.set(500, velocity.y); body.setlinearvelocity(velocity);
Comments
Post a Comment