Camera follow rotating object

In all of my games that I’ve made so far I’ve made the camera a child of the main character. In this game the character is a sphere that you move around levels. I thought It’d be cool if I could have the ball rotate and move around. The only problem is that when the ball rotates so does the camera. Is there any way to achieve the effect of the camera following the ball besides parenting that wouldn’t be too hard. I’m not really to worried about this, the visuals in my game aren’t very good, so if it’s going to be difficult i’ll just deal with what i have currently.


Just add a script to your camera, and drag your ball as the target.

var target:GameObject; // drag your ball onto this

function Update() // set gameObject position the same as target, follow behind 0.5m Z-Axis
{ gameObject.transform.position=target.transform.position+Vector3(0.0,0.0,-0.5); }

If you want the camera to stare at the ball, add this to your update function


Go get’em!