A---------------------------B
\ | /
\ | /
\ | /
\ | /
\ | /
\ | /
\ | /
\ | /
\ | /
\ | /
\ | /
\ | /
\|/
C
rotating camera
Hi,
Im making a game where to characters will fight eachother.
The characters can move along the x- and z-axis.
I want the camera to always follow them. I''ll draw an illustration to explain my problem.
A = character 1 (x- and z-coordinates)
B = character 2 (x- and z-coordinates)
C = camera (x- and z-coordinates)
As you can see the distance between the camera
and the centerpoint of the characters can be
calculated (we know that the angle C = the camera''s field of view).
I want the camera to always show both characters on the screen
and also being able to rotate along the characters when they move
along the z-axis. I want the camera to always be in the middle of the characters (90 degress from the centerpoint between the characters).
Now, how do I do this? Ive comed up with a solution, but when the camera has rotated over 90 degrees everything gets wrong.
Anyone recognise my problem? Has anyone done anything similiar?
This is the "normal" camera movement which can be found on 3D-fighting games such as Tekken etc...
If you want my code, just ask and I''ll post it here.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement