#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# In Brackeys' FPS tutorial, how can I keep momentum when jumping in a specific direction?

This is something I have been confused about for weeks now and it seems that most other places I've looked don't give me the answer I'm looking for. I used his video as a guide but made many changes to achieve a different type of goal but it's mostly the same.

In the current video that Brackeys has, jumping and then letting go of the key will cause the player to abruptly stop mid air and then fall straight downwards. In most FPS games, that never happens. Instead the player will carry their momentum into the jump based on their previous move direction.

Basically what I want to know is how do I jump and keep my previous momentum with only a little bit of air control?

```private void HandleMovement()
{
float x = Input.GetAxisRaw("Horizontal");
float z = Input.GetAxisRaw("Vertical");

Vector3 input = new Vector3(x, 0, z).normalized;

velocity.x = x * speed;
velocity.z = z * speed;

velocity.y += gravity * Time.deltaTime;

moveVelocity = transform.TransformDirection(velocity.x, velocity.y, velocity.z);

if (isGrounded)
{
controller.Move(moveVelocity * Time.deltaTime);

if (Input.GetButtonDown("Jump"))
{
velocity.y += Mathf.Sqrt(jumpHeight * -2 * gravity);
}

if (velocity.y < 0)
{
velocity.y = -2;
}
}
else
{
//Just for now. This needs to be replaced with something that allows directional velocity and limited air movement
controller.Move(moveVelocity * Time.deltaTime);
}
}
```

I guess there is no need of adding else as you want to move the player in both the condition (onground=true or false).