I am trying to rotate an object around a point. I want the user to be rotate both vertically and horizonatly so with those controls the user can position the light around the object in any place they wish. I am using (just rotating around the origin for now. transform.RotateAround (Vector3(0,0,0), Vector3.up, 40 * Time.deltaTime); and transform.RotateAround (Vector3(0,0,0), Vector3.forward, 40 * Time.deltaTime); Now both work if you don't touch the other. But as soon as one moves the other doesn't for the new position and doesn't behave the way I want. Is there a better way to do this? If i could move the pivot to the origin I could just straight rotate but I don't know how to do that, or if it is even a good solution.
The easiest way is to parent your object to an empty gameObject located at the pivot, and rotate that. Always works like a charm for me.
How about something like this (saw this code here in the forums: http://forum.unity3d.com/threads/47353-Rotate-the-camera-around-the-object ) Code (csharp): public Transform target; void Update () { transform.LookAt(target); if (Input.GetMouseButton(1)) { transform.Translate(Vector3.right * Time.deltaTime); } }