What is the simplest way to get a sphere to rotate as it moves in game?

I want my sphere to rotate like a ball would and I would like it to happen whenever the player uses the up arrow or the w key. I'm trying a simple script that with a transform function but it's not working for me.

1 Answer

1

This is basically straight out of the Unity manual... On the update, you'll need to put in your button code first :)

private var thisObj : Transform;
var rotSpeed = 1.0;

function Start()
{
    // Cachhe the transform link
    thisObj = this.transform;   
}

function Update () {
    thisObj.Rotate(0, Time.deltaTime*rotSpeed, 0, Space.World);
}