Jump to content
  • Advertisement

Archived

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

Cat_B

Best way to move in a world?

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

Hi, okay, I''m new to opengl & 3D There seems to be 2 method''s of moving around, and I would like to know your opinion on which is best. Method 1) From NeHe''s tutorial #10 "moving in a 3d world". Basically you just get the incremental amounts the camera moves and rotates and apply the opposite to the glRotate & glTranslate methods. I like this method better- easier to understand and seems to be alot fewer calculations. BUT NeHe states "Don''t even consider using this code to make a full-blown 3D engine" Why not?? I added twist,strafing & linear up/down and it now has all 6 dof''s. It seems great! What''s wrong with it? Method 2) From gametutorials.com tutorial "Camera5" which uses glLook. Geesh, why would one do this? It''s basically calculating all the rotations itself and well it''s just so much harder for me to understand and seems very convoluted. Ordinarily I would just dismiss this method, except for Nehe''s statement about method 1. Is glLook somehow better? There must be a reason why gametutorials.com uses this method? Yes, they use a mouse, but I''m sure I can add mouse movement to NeHe''s method.. Thank you

Share this post


Link to post
Share on other sites
Advertisement
Hey, I cant be sure, but I''ve read in many, many places, that lookat function uses glTranslatef/rotatef anyway... Plus, if you use translatef/rotatef, you get alot more versatility in your movement.... Thats what I use anyway, and I hanvt noticed any speed decrease or anything...

Transformers Rulez!!

Share this post


Link to post
Share on other sites
You're right, using gluLookAt or equivalent for doing quake style control is overkill. gluLookAt should be used for doing targetted camera shots (e.g. tracking an object through space from a fixed position) and similar.

gluLookAt does not use glTranslatef etc, it just calculates the matrix directly from the given data (it's pretty simple math and very useful when you want more cinematic camera control and also for making objects look at each other).

[edited by - JuNC on December 7, 2002 6:02:58 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by JuNC
You''re right, using gluLookAt or equivalent for doing quake style control is overkill.

why is that? glulookat is very convenient for implementing all kinds of cameras, including first-person ones.

Share this post


Link to post
Share on other sites
quote:
Original post by Cat_B
BUT NeHe states "Don''t even consider using this code to make a full-blown 3D engine" Why not?? I added twist,strafing & linear up/down and it now has all 6 dof''s. It seems great! What''s wrong with it?



Nehe''s tutorial says that, but his tutorials arent exactly great themselves. Doing it that way is a perfectly good way to do it, and is used in many games (Quake1 engined games, Quake2 engined games, likely Quake3 engined games as well).

If the leader in 3D game engines (John Carmack) prefers using that method, why should a ''newbie online tutorial'' (tm) discourage you from using it?

-----------------------
"When I have a problem on an Nvidia, I assume that it is my fault. With anyone else''s drivers, I assume it is their fault" - John Carmack

Share this post


Link to post
Share on other sites
I''m not saying you can''t do it that way, I just find it more readable to do:

glRotate(1,0,0,pitch)
glRotate(0,1,0,yaw)
glTranslatef(blah)

Especially as pitch and yaw are the variables tracked in these type of situations.

Share this post


Link to post
Share on other sites
Thanx all, I'm glad to see you agree.
Will keep in mind using glLook for 2 objects looking at each other- that might be cool :-)

ps: where the glLook method got very hairy was when once the camera was rotated around any of the global axis, it was very complicated to then tranverse the camera along its local x axis. Just really hairy.. but with method 1, I hardly had to think about it..

[edited by - Cat_B on December 7, 2002 9:46:47 PM]

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!