- Home /
LookAt Camera over 90 degree
Hi,
I want to have a camera that has a fixed y and z position. The x is following the player object. The camera should always look at the player. The camera is attached to the celing and the rotation should follow the player.
The problem is, when I use LookAt() and the x rotation of the camera should exceed 90 degree to follow the player, the y rotation of the camera is turning for 180 degree and the view is flipped. How can I avoid this?
It is difficult to explain the problem for me. Check out the example to see the problem.
https://dl.dropbox.com/u/13327481/CC%20Ex/WebPlayer/WebPlayer.html
Answer by IgnoranceIsBliss · Nov 13, 2012 at 01:09 AM
Your best bet is not to use LookAt - if you are only rotating on one axis you should be able to work out the angle between the two objects with basic trigonometry and simply set the rotation.
This way you have complete control.