- Home /
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
Changing 1 parameter of rigidbody.velocity (Vector3) 2 Answers
How to set velocity to a previouse value 1 Answer
What is wrong with this rigidbody? 2 Answers
How would I counteract the force of the velocity and set it to zero after the input has stopped? 3 Answers
Comparing rigidbody speeds 1 Answer