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

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -