- Home /
Racing Turn Movement
I am trying to replicate the turning movement from Kirby Air Ride, seen here: https://www.youtube.com/watch?v=Cg3faJPne74
You will notice just within the first few seconds of the video how responsive turning is. Most of the force is being applied in the direction specified and there isn't much lingering in the previous direction. When I try to control movement by simply boosting the transform.forward vector and reassigning it to rigidbody.velocity, my character slides all over the place. This makes sense because the new velocity has to counteract the old one.
How do I get a better feel closer to that shown in the video?
Answer by robertbu · Nov 11, 2014 at 09:30 PM
You can up the drag. The higher the drag, the faster old velocities decay. You'll likely have to increase the force applied.
Another solution is to map velocity to the direction of travel. Put this in fixed update
var speed = rigidbody.velocity.magnitude;
rigidbody.velocity = transform.forward * speed;
For some games where realistic physics is not the goal, the code manipulates the velocity directly rather than using AddForce().
Thanks for the reply, Robert. How you've shown manipulating velocity is what I'm currently doing, not messing with AddForce().
The problem with the drag option is that I'm already using it for something else. When you hold a certain button the character comes to a nearly complete stop, and upon release explodes forward with a big boost. I up the drag value to get it to stop, and then set the drag to zero when I want to unleash the velocity...
I guess I could just simply change that to something else and try using the drag more effectively. Actually, I could just do both...sort of feels like an unsatisfying solution for some reason, but I'm going to try it out. Thanks.