- Home /
how to set initial speed of vehicle
Hi,
I want to start my car with some initial speed say 500 and want to run it at very high speed. below is my script snippet void update() {
FrontLeftWheel.motorTorque = Torque;
FrontRightWheel.motorTorque = Torque;
}
I want to achieve the result same as if I would get by translating a rigidbody (e.g. code below)
void update { CarBody.transform.Translate(Vector3.forward); }
I am putting the mass of the car as 1000 and of wheel is 20 and tried with torque from 200 to 10000 nm.
my unity version is 5.0.0f4
Thanks for any help.
Answer by RLin · Aug 08, 2015 at 09:42 PM
Just set the speed of the car's rigidbody, and let the rolling rotate the wheels up to speed:
void SetSpeed(){
CarRigidbody.velocity = new Vector3(30,0,40);
}
Your answer
Follow this Question
Related Questions
Question about rigidbody velocity 1 Answer
Unity 5 wheel collider throttle "stuck". 1 Answer
can't slow my car down 2 Answers
Wheel Collider - Mesh/Box Collider Problem 0 Answers
Wheelcolliders launch the car. 0 Answers