- Home /
Auto accelerate car!
Hello, I was wondering if I could modify the unity demo car script so as to accelerate the car automatically. I should only steer the car. Any suggestions?
throttle=Input.GetAxis("Vertical");
steer =Input.GetAxis("Horizontal");
Input.GetAxis() returns a value between -1 and 1. Try setting throttle to some value in that range.
yea but does that reduce the acceleration during steep turns?
sounds right :) thanks if you would psot it as ans I would tick it :)
Answer by robertbu · Jun 06, 2013 at 04:05 PM
Nope. You could try something like:
throttle = (1.0 - Mathf.Abs(Input.GetAxis("Horizontal")))* factor;
Where 'factor' is a number between 0 and 1 that you define.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How can I accelerate a rigidbody towards another at X m/s? 0 Answers
Automatic accceleration 1 Answer
Car steering control 1 Answer
Airplane smooth acceleration problem 0 Answers