- Home /
Camera rotate around sphere centre
Ok I'm having a bit of trouble trying to sort out my camera (It's the last thing to do!)
So I have a sphere and the player runs round the the sphere mario galaxy style. At the centre of the sphere is a game object with smooth look at script with the player as the target. The main camera is the child to another game object which has another smooth look at script only this time the game object in the centre of the sphere is the target.
Now in my head this should work and it does until the player gets to the other side of the sphere at which point the camera starts to zoom in closer? I have tried to use the constrain position tick boxes, but they have had no effect.
Any help in this matter would be much appreciated.
Wait.. why is the game object at the center of the sphere looking at the player and why is that game object relevant? It sounds like you need to move the camera around the sphere at a constant altitude to follow the player as he moves around it.
The centre game object is relevant, so that the camera rotates correctly around the world - camera needs to constantly look at the centre of the world as well as stay locked to the player.
Answer by DaveA · Mar 09, 2012 at 09:02 PM
I would really look at the MouseOrbit script in Standard Assets (or Camera Scripts or where ever they put it). The only thing I could suggest with what you are doing is make sure your 'center of the sphere' object is really at the center. And you shouldn't need the second object to have smooth look-at on it. The camera would just a child of the central object, offset to orbital height, and oriented back down toward the center.