Skip to main content
gamedev.net
🔒 Locked

camera rotation

Started by hello_there Jun 16, 2002 at 3:47 AM 6 replies 700+ views
Original Post
hello_there
hello_there
ok i have anouther camera problem. i want the camera to rotate around the player but still look at the player. like the camera on dungeon siege. i was wondering how i would do it.
____________How could hell be worse?
TheMatrixXXX
TheMatrixXXX
check out the camera tutorials on www.gametutorials.com
maybe it helps





--=[[TheMatrixXXX]]=--
--=[[TheMatrixXXX]]=--
hello_there
hello_there
i can now get the camera to rotate but it doesn''t stay on the player. or i can get it to stay on the player but then when you move left or right the camera rotates when i want it to stay flat. that makes no sence you''ll probably have to see to understand. but just incase you do can you give any surgestion.
____________How could hell be worse?
uNiQue0815
uNiQue0815
don''t really know, what you mean...
''when you move left/right, the camera rotates when i want it to stay flat'' ???

what do you mean by ''flat'' ?
think you want to have a 3rd person view that always stays behind your character in some distance & angle, right ?

hope, your character has an own matrix for position/angle... if so, it''ll be really easy... you just define a vector pointing out of your character''s back to where the camera should be (relative to your char''s matrix)... it should be something like [x: 0, y: 0, z: -1 ] (for z being the depth-axis and -1 pointing to the viewer... but that''s not really important...). this would be for a view directly behind your char, looking directly to his origin-point.
you translate these relative coordinates into absolute (world-) coordinates and you should have your camera parameters...
the vector you just calculated will be the eye-point, the look-at-point will be your char''s position (whatever part of him you want to look at). this should create a view, that''s always behind your player... you can play around with the parameters and the angle that the vector (the one ''pointing out of his back'') has...

maybe i my description''s a little hard to understand (don''t know, how to explain better). i haven''t made anything like a 3rd-person view before, but what i explained is the first idea i had, how to do it. maybe there''s some better way... you should search the forum some more... i''m sure, you''ll find some threads about this topic...
LockePick
LockePick
quote:
i can now get the camera to rotate but it doesn''t stay on the player. or i can get it to stay on the player but then when you move left or right the camera rotates when i want it to stay flat. that makes no sence you''ll probably have to see to understand. but just incase you do can you give any surgestion.

I know what you mean. Normally if you strafe the camera, both the camera''s position and the camera''s view position moves.
If you continually have the view on the character, by strafing only the position ends up moving.

I did a quick hack with that, I just kept changing the camera''s strafing speed until it matched the character movement. But I wouldn''t advocate that at all, screws up if you zoom...

Here''s an idea for you though (whether it works or not, don''t know, haven''t tried it yet):
Keep records of you characters previous position.
So if you start at 10,5,2, then move to 5,5,2. You can get a -5,0,0 vector. Then just add that to the camera''s position and it should follow accordingly.

Hope that helps, not sure though.

------------
aud.vze.com - The Audacious Engine <-- It''s not much, yet. But it''s mine... my own... my preciousssss...
MSN: nmaster42@hotmail.com, AIM: LockePick42, ICQ: 74128155
hello_there
hello_there
i havn''t got into using matrixes to hold player position yet. matrix maths makes my head hurt . but my player position in just stored in a variable.
____________How could hell be worse?
hello_there
hello_there
oh no i''m going to have to change my collision detection if i want to do my camera stuff damn it took me ages to get that working . oh well i know sort of how to do it now so i should be alright. I hope
____________How could hell be worse?
uNiQue0815
uNiQue0815
mmh... matrices are not that hard to understand... in fact they''ll make lots of operations VERY easy... especially camera positioning & rotation. or whenever you''ll want to create complex objects (bones), you should also use matrices for every object...

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.