- Home /
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.
Comment
Best Answer
Answer by jtbentley · Sep 03, 2010 at 05:13 AM
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); }
Your answer
![](https://koobas.hobune.stream/wayback/20220613072618im_/https://answers.unity.com/themes/thub/images/avi.jpg)