- Home /
Question by
HuskyPanda213 · Apr 02, 2013 at 08:27 AM ·
c#rigidbodycar
Car not rotating when grounded
Hello my car is not rotating while its touching the ground only when its off please help. Heres my code:
using UnityEngine; using System.Collections;
public class BasicCar : MonoBehaviour {
public string Name = "Car";
public void FixedUpdate(){
if(Input.GetButton("CarForward")){
rigidbody.AddForce(Vector3.forward * 20);
}
if(Input.GetButton("CarReverse")){
rigidbody.AddForce(Vector3.back * 20);
}
if(Input.GetButton("CarRight")){
rigidbody.AddRelativeTorque (0, 10, 0);
}
if(Input.GetButton("CarLeft")){
rigidbody.AddRelativeTorque (0, -10, 0);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Make car stick to the road 1 Answer
Rigidbody falling very slow 1 Answer
vector3.forward doesn't work when used in Rigidbody? 2 Answers