Impulse needed to maintain a constant speed - Velcro Physics

I’m creating a platform game with Velcrophysics.

When the character during the move jumps and then collides with the ground, his speed is reduced, due to the physics of the game.

How do I calculate the impulse needed to keep the speed constant?

Loosing vertical speed after landing on the ground sounds like the ground is doing it’s job. Which speed exactly do you want to keep constant? Do you want a perfectly elastic bounce, or does your character loose horizontal speed as well? Do you maybe want to keep the airspeed and redirect it horizontally after the landing?

I don’t know Velcrophysics but impulse is generally velocity*mass, so you would take the velocity difference you want to achieve and multiply it with the object’s mass.

1 Like

Generally you don’t want realistic physics for the player in a platformer. It might interfere with making the game feel right as that requires tweaking movement a lot and realistic physics often prevent or at least complicate the process of getting exactly the movement you want (as is the case here).

Of course you could look for solutions inside the physics engine like applying forces, but I’ve found through experience that can be very tricky to control.

1 Like

I assume you want the final high of the jump to be constant.

If you want reach ‘d’ meters high (from your current position),
you need to have a velocity of
velocity = Math.Sqrt(2 * g * d);
where g is gravity in (m/s2)

Then you calculate the needed impulse from (velocity * mass).

1 Like

Can you tell me, how to use that library properly? Since I can’t solve that from very long time