Phil Clute wrote:
> My sky vector is y.
>
> My only problem now is that if my stare_at x and z vectors are both 0.0
> POV barks at me about a "domain error in atan2".
> Other than that, it works very nicely.
> Thank you
Having the x and z vectors 0 mean you are looking straight up or down.
You just have to find out by comparing the eye_y with the stare_at_y.
indicator = (eye_y - stare_at_y)/abs(eye_y-stare_at_y);
this way you will get a -1 for looking down and a +1 for looking
straight up. Now rotate around x or z.
rotation x*indicator*180
Again there is a big danger having eye_y == stare_at_y. So you should
check before rotating at all, that the eye's position and the stare_at
point aren't equal.
Post a reply to this message
|