Jump to content
  • Advertisement


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


Quaternions for a 3rd person view?

This topic is 6032 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

Hiyas, firstly, yes i have done a search, but pretty much all post''s I found ended in: "great, thanx, ive solved the problem, bye." I''m currently working on a game, at the moment its development is ploding along in first person, but from the start i actually intended it to be 3rd person, but i didn''t know how to impliment a 3rd person view, so i started working in 1st person. Now i believe is the time to make the move to 3rd person. I''ve heard great things about Quaternions, and I''ve hacked myself together a quaternion class from various sources: Quaternion.cpp and Quaternion.h My current system is, i have a robust camera class, that gets manipulated based on the users imput, i then use glLookAt() with the 3 vectors from the camera class. This works great for first person... What i think would be best now would be to move most of the camera stuff over to the Player class, so that the player''s position etc gets changed based on user input, and then use quaternions somehow (???) to position the camera. I''ve heard a lot of people say quaternions are easy etc, but if this is true, why arn''t there any detailed tut''s on them? (the only one ive seen is on gamustura, but it doesn''t explain much in terms of how to impliment a 3rd person view, it just says it can and has been done) Thanks in advance for any help you can offer

Share this post

Link to post
Share on other sites
quarternions are just a clever mathematical way of doing rotations. quaternions != 3rd person view. your real problem seems to be how do i do a 3rd person view.

you CAN use quaternions if you want to to position the camera but your camera view is going to be much more complicated than in a 1st person view. the real trick is not should i use or not use quaternions to do the rotations, but how does the camera behave.

1st, you need a model or shape to display at the player's position so that your camera is looking at something.

2nd the easy part is that the camera is always looking at the player.

3rd there's the massive problem of where do you put the camera. a little above and looking slightly down but in the general direction of the player model's eyes is fairly decent 3rd person camera positioning. mostly you rotate the camera around a vector parallel with the +y-axis centered on the players coordinates.

however, if there are walls/trees other object in the world you have to be sure to place the camera such that the player character isn't obscured by those objects. that's where all the mess comes in.

draw out the geometry of how the camera is going to respond when the character looks up, looks left or right. and figure out how you're going to work things like doorways and other things. does the camera dip down and also go through the door? does it go through the wall? how do you make it go through the door?

a good way to figure that stuff out is to get a game with a 3rd person view and study how they move the camera.

once you get it basically working you're going to want to look into bezier curves so that you can get smooth camera movement instead of jerky movements.

3rd person view isn't that hard when you are outside and there are no walls or trees. it gets crazy when you are inside so it's not going to be a simple task. but it should definitely be fun.


[edited by - Palidine on June 6, 2002 2:13:25 AM]

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!