Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Peacekeeper3

3rd person camera theory...

This topic is 6414 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!