Box2D platformer movement. Should i mess with velocity?

Posted by Romeo on Game Development See other posts from Game Development or by Romeo
Published on 2012-04-12T09:29:01Z Indexed on 2012/04/12 11:44 UTC
Read the original article Hit count: 244

Filed under:
|
|
|

I have a platformer game in which I implemented the movement using a wheel attached to the hero. For jumping I use this:

player.body.applyLinearImpulse(new Vec2(0, 30000000), player.body.getPosition());

The problem is that the xVelocity doesn't remain the same during the jump so it isn't looking natural. Is there any way to modify only the x velocity of the body so that before jumping I store it in a variable and after jumping I apply it to the body?

I hope you understand what I am trying to say.

© Game Development or respective owner

Related posts about java

Related posts about physics