Advertisement

3rd person camera theory...

Started by November 30, 2000 07:42 PM
4 comments, last by Peacekeeper3 23 years, 11 months ago
yeah. newbie alert. Can anyone please enlighten me with the theory behind 3rd person camera systems?
Well, from playing games long enough, ill speak what i have to say...

If you mean like a tomb raider (or follow)) camera, that moves with the player, than (think bigger now) the *world* (ie the the stuff teh player is moving though) moves around the character. Meaning the charactar never changes position on teh screen, just the world moving around him, giving the illusion of the character moving.

If you want to move the camera (or view fromteh players perspective) then what you actually do in yor game is move Everything else (ie the background players etc) in reverse of how you would want to move the view angle.

example: you wantto move the camera to get a more top down view: then you would simulate this by rotating your game world *down* so you see more top down

Do you kinda understand? this is just what i think you were asking about... hope i helped you out in some way or the other...

Jjesterr
"A smile can take you a long way. A smile and a gun will take you even farther" - Al Capone
Advertisement
Hrmm. ok I sounded too much of a newbie there.

Yes I know you have to move the world around the "camera" to simuluate movement.

Yes I am making a tombraider/twisted metal/rune type game and I havent got a clue on how to rotate the world around the camera.

I am thinking of doing some sort of tile based engine and when the player turns left or right I have to rotate the world left or right and I haven't got the slightest clue on how to move and rotate all the tiles to their correct places.(excuse the huge run on sentence)

I already figured out the trig math involved with figuring out how to move the player around according to the players heading.

Now I need to figure out how to rotate the world according to the players heading so when I move the world the illusion looks right.

(is this making any sense at all?)
Can anyone help me out?

Edited by - Peacekeeper3 on November 30, 2000 11:32:43 PM
Check out Nehe tutorial 10 you can use that and just draw you player model in front of the camara before the translates that move the world so it will appear that the camara is following the player. If you look at a third person game and disregard the character it looks a lot like a first person game!



Open mouth, insert foot
PeaceKeeper, as you have already figured out the math, so I assume you have the player''s position and rotation stored in a the Player Class variable or some global. Then all you need to do before calling the drawing routine is to translate the modelview matrix(MVM) to the origin, rotate the MVM by the player''s rotation and about the Player''s rotation axis. and translate the MVM back to the player''s position negating the x,y and z.

glTranslatef(0.0f,0.0f,0.0f);
glRotatef(angle,axis.x,axis.y,axis.z);
glTranslatef(-Player.GetPosX(),-Player.GetPosY(),-Player.GetPosZ());

Hope this helps
NeoGl
That is correct, I have the players x,y, and heading stored in a global

So your saying before I begin drawing my tiles I rotate the MVM to whatever heading then when I draw the player cancel out the heading?

I posted in another forum, and they suggested that I mess with the viewport then cancel out the rotate for the player.

They are both basically the same so I will try them both out later.

Thanks NeoGL

OGLman: Gonna hafta check out those tutorials again

This topic is closed to new replies.

Advertisement