Body setLinearVelocity() - SPEED

Hello, Im moving my body with:

Code: Select all

body.setLinearVelocity(b.getLinearVelocity().x, -20);


and it works good. But all the time with the same speed, how can I increase it? Changing 2nd parameter doesn't change anything.

Thanks for help!
first of all i don't think you should use setLinearVelocity, but you shoul ude applyImpulse or applyForce, or you will get strange result.

as i can say, you are taking "b" 's X velocity and appling it to "body", and setting a fixed velocity of -20 on the Y axies.
I haven't been using setForce because I thought kinematic body doesn't react for forces - thanks I will try it.

Original thread: https://box2d.org/forum/viewtopic.php?t=7792