Keep Horizontal Momentum after Jump

Hi,

I am trying to create a 3D FPS-character-controller and came across something inconvenient: the collision, which happens when the player hits the ground after a jump, seems to reset the player (rigidbody) velocity to zero, instead of just setting the Y-component to zero.

Since I am using acceleration and don’t let the player reach max speed instantly, this is very noticable and annoying.

Anybody has an idea, what I could do to mitigate this?

Code: https://pastebin.com/GRxfkksU

So, if I understand you correctly. What you are saying is that when your player jumps, and then hits the ground, if the player was moving forward it then suddenly stops and it has to gather momentum again? If that’s the case it might just be simple physics, because coming into contact with the ground does slow forward momentum. In that instance, you might need to adjust your players weight and drag on the ridgidbody.

Alternatively, if the player stops moving forward right after you hit space, then the issue is with how you are applying your force.

I was having a similar problem with a 2D platformer and it was because of friction. Try adding a Physics Material to your RigidBody and setting the Friction to 0 (guess it’s the Dynamic Friction for 3D in your case). The material can be created under the menu Create > Physic Material.