RotateAround not working on sphere

Hi,

I am very very new to Unity and I couldn’t find an answer to this through searching the forums. I’m trying to fake a solar system by having planets orbit around the origin using Transform’s RotateAround method. However, nothing seems to happen. I have attached the script (named MercuryOrbit) to a sphere mesh that I created inside Unity which is located at 8,0,0. I also tried creating an empty GameObject, applying the script to that, and parenting the sphere to this empty GameObject. Still no luck. I think I am missing something silly. By the way, I had to add an “F” to 0.0001 to get it to compile in C#. Does javascript not need to do this?

using UnityEngine;
using System.Collections;

public class MercuryOrbit : MonoBehaviour {

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
		// spin the object around the world origin at 20 degrees/second.
		transform.RotateAround (Vector3.zero, Vector3.right, 0.0001F * Time.deltaTime);
	}
}

I think your script is rotating planet around at 0.0001 degrees/second. Changing that number to 20 actually works.

Yes, you indeed need to add an ‘f’ when using floating point constants in your code. Javascript does not require you to do this.

Thanks for your help. I tried changing it to 20.0F but it still does not work. I even increased it to 200.0F. I am obviously doing something fundamentally wrong in my setup.

Good to know, thanks!

Changing to 20 works for me. Attached unitypackage with simple scene.

461026–16192–$Mercury.unitypackage (4.69 KB)

Thanks again! Your scene is working on my end as well…I’ll need to compare both to figure out what I was doing wrong. One thing that is different is that my camera is looking down from the top and yours from the left. Even if I’m using the wrong axis, I still should have seen some back and forth movement at least.