
Camera creation
Posted Tuesday, 5 June, 2012 - 11:52 by lid6j86Ive been scouring places for information on transformations in order to make a decent moving camera to explore the vast empty void. So far ive found a few different methods:
One with quadernerions
One that simply calls rotate three time ( one for each axis) then translates the coords
One that uss the lookat function
My question is which method would make the most sense? Ive tried 1 and 3, and have seen many people reccomend against 1.
Also in regards to lookat(), the parameters are simple enough but i have a question about its application.
The eye coordinates are very easy because that can be thought of as the physical location of the camera. If im trying to make a freeform camera that can look around in 3d space, how do i get the point it should be looking at? Im guessing i will have to figure out some circle math? If thats the case how do i get it to translate into a point to look at?
And finally for the up vector, i should be able to just take the perpendicular vector of the arbitrary point im looking at, correct?
Thanks for the help
- lid6j86's blog
- Login or register to post comments


Comments
Re: Camera creation
Apologies for the typos, im typing this on my ipad from the hospital (just had a baby)
Re: Camera creation
Congrats, you must be a proud dad now :)
Re: Camera creation
I have a reasonably good camera class at the moment, using quaternions for rotation. I'll post the relevant code here for you, it might help :)
Camera interface
Actual camera code
Simple camera mode enum
It's a bit confusing with a lot of parameters (that constructor, my god), but it does the job and works quite well. Also has a nice 'flight' camera mode using quaternion slerps. Oh, and disregard the FirstPerson enum, that's just a test I did where you're locked to y=0.
Re: Camera creation
I do have a question since you posted a quaternion camera: I've seen a lot of people recommending against it. i can't remember specific reasons to be honest, but i was wondering if you could think of any reason quaternion would not be preferred over other methods?
thanks for the example, by the way.
Re: Camera creation
Great camera code, I will use it also.
By the way, what is this Revolution namespace, something crazy I guess? :)