I want to make my ‘cube’ to move forward, then hit something, then rotate to the right or left on collision. Here is the script…
var speed= 1;
var turnspeed= 5;
function Update () {
transform.Translate(Vector3.forward * speed);
}
function OnCollisionEnter(collision : Collision) {
transform.Rotate(Vector3.right * turnspeed);
}
When it hits it just doesn’t cooperate. Any help welcome.