Slow down a character while they are midair while keeping their original velocity
I want my character to be able to jump in the air but I don't want them to move as fast while in the air except in the direction that they were moving when they jumped. I had the idea of making all of their movement inputs count for half when in the air and that works fine for slowing them in all directions but they get slowed in the direction that they were moving when they first jumped.
void PerformMovement()
{
if (velocity != Vector3.zero)
{
if (isFalling)
{
rb.MovePosition(transform.position + velocity * Time.fixedDeltaTime / 2);
}
else
{
rb.MovePosition(transform.position + velocity * Time.fixedDeltaTime);
}
}
}
How can I keep them moving in their initial direction while still allowing them to make slight adjustments while in midair?
Your answer
Follow this Question
Related Questions
Cant Get a Bullet to Shoot (C#) 2 Answers
How do I ignore gravity when using Rigidbody and always have the same jump force? 1 Answer
Set the Velocity to reach a position at a specific Timestamp 0 Answers
How can I move an object in the direction another object is facing. 1 Answer
Bullet shooting not working 0 Answers