I’m looking for help with a simple rotate. All I would like is for a planet to rotate. For perfection I want it to be scripted, not animation. I’ve tried a few things that I’ve found online, however it makes it rotate with x and y axis. I have a planet and all I want it to do is spin, well rotate. Any help would be appreciated, thanks a lot.
Do you mean for the planet to travel along a path that rotates around the sun, or for the planet to spin on it’s own axis?
In a new scene, create a cube, position it at (5,0,0), attach this script :
var PlanetRotateSpeed : float = -25.0;
var OrbitSpeed : float = 10.0;
function Update() {
// planet to spin on it's own axis
transform.Rotate(transform.up * PlanetRotateSpeed * Time.deltaTime);
// planet to travel along a path that rotates around the sun
transform.RotateAround (Vector3.zero, Vector3.up, OrbitSpeed * Time.deltaTime);
}