Hi,
I want to make a character that look to a point (x,y,z). Like Tombraider and Grim Fandango.
And if I move the point, the character move his/her head always looking the point.
Is there some code or ideas about it.
Thanks in advance.
Leo.
I want to make a character that look to a point (x,y,z). Like Tombraider and Grim Fandango.
And if I move the point, the character move his/her head always looking the point.
Is there some code or ideas about it.
Thanks in advance.
Leo.
If you have a character's head and a point to look at, then it fairly simple to find two angles which represent the x and y rotations by trigonometry.
You can find the x rotation by the difference in height between the head and the point and the distance in the y plane between the head and the point, using arcsin
You can find the y rotation by the distance between the head and the point in the x and z vectors using arcsin again.
Then rotate the head in the x then the y.
Sorry, but if I could draw, I'd do diagrams...
If this does not make sense, I suggest try drawing it on paper first....