transform.addforce to stay in local z axis
I'm trying to make a vehicle controller, but I keep running into this problem.
Whenever I use transform.AddForce to a vehicle's transform.forward, it will continue to travel in that direction even after the vehicle has rotated away.
Basically the car could be going north and turn east, but the car will continue traveling north until the force has dissipated. Is there any way to fix this?
In real life ,while driving you possibly can't make sharp turns without actually applying some breaks. Same goes here. So you need to apply some force in the opposite direction of motion otherwise it will just continue to move in the same direction.
Check HoverRacer Unity example project. It has one script for ship control and I does what you want, i.e. applies sideways friction so that the ship can turn. Link to project files in video description.
Your answer
Follow this Question
Related Questions
How to stop a sphere that is using GetAxis from moving? (Roll-A-Ball Tutorial) 0 Answers
Case of the Haunted Standard Car Assets? 0 Answers
RigidBody's Center Of Mass doesn't always update properly 1 Answer
How to control the speed of AddForce (ForceMode.Impulse)????? 1 Answer
Null Reference Exception..Don't know the answer... 2 Answers