Skip to main content
gamedev.net
🔒 Locked

Camera

Started by Lord_Vader Jan 27, 2007 at 4:43 AM 5 replies 550+ views
Original Post
Lord_Vader
Lord_Vader
Hello all, Can anyone tell me how to create a space camera that rotates only relatively to its own axes(that they are const oriented relatively to the camera(or the model)? thanks [Edited by - Lord_Vader on January 27, 2007 5:20:10 AM]
Zakwayda
Zakwayda
Quote:
Original post by Lord_Vader
Hello all, Can anyone tell me how to create a space camera that rotates only relatively to its own axes(that they are const oriented relatively to the camera(or the model)?
I'm going to be lazy and just direct you to this source code.
Zakwayda
Zakwayda
Quote:
Original post by Anonymous Poster
Not exactly sure what you are getting at, however...

When you are using the MODELVIEW matrix stack it defaults to the viewing stack and any rotations/translations etc... you do will transform your camera/world.

Now if you want to transform an individual object, before you give gl it's vertices's you must call glPushMatrix(), then any transformations you do will effect only those vertices's on their local coordinate system. Should usually make a call to glLoadIdentity() before you transform, to clear any left overs in that matrix.

Don't forget to call glPopMatrix() after that object is done being transformed/vertexed(gave the vertex coord's). Or else you will be in MODEL mode the whole time.
What the OP is getting at is the problem of 6DOF motion, which the above does not address. 6DOF motion cannot be implemented in a direct way via OpenGL calls alone (at least not without awkward and perhaps costly state queries).

The code I linked to above implements both 6DOF and 'standard' FPS-style motions (and requires only a basic 3D vector class as support).
Lord_Vader
Lord_Vader
I tried and I dont think its possible only with simple glTranslate and glRotate calls.

jyk's code is fine but a little more documentation is needed
to it.
Zakwayda
Zakwayda
Quote:
Original post by Lord_Vader
jyk's code is fine but a little more documentation is needed to it.
If you have specific questions about the code, feel free to post them here (or PM me if you prefer), and I'll be happy to try and help.
Lord_Vader
Lord_Vader
Quote:
Original post by jyk
If you have specific questions about the code, feel free to post them here (or PM me if you prefer), and I'll be happy to try and help.


I have found your code very useful. I am trying to make it work with my little engine...

thanks again

Topic Locked

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

Sign in to reply to this topic.