using quaternions
Hi,
I know there are a lot of threads on quaternions, but none of them answers what I think to be my question.
I have a program right now, and I am trying to build a 3d follow cam, for a freely rotating and moving object.
I have figured out how to use the quaternions to rotate the object, but I can't figure out how to rotate the camera.
How do you find the position of the camera after the the object rotates?
I have heard you can use quaternions for 3d cameras, but I can't figure out how. Thanks for any help.
EDIT: Ok, I want to use SLERP to interpolate the camera, but I still need to find the position and orientation of it somehow. Thanks!
[edited by - crossbow on July 31, 2003 6:01:56 PM]
[edited by - crossbow on August 1, 2003 11:09:22 PM]
Basically, all I need to know is how to find the position of the camera and how to orient it, and i will be set. It seems like it should be simple, but I can''t figure it out. Any help?
does any body know of any program that does what I am trying to do? Or psuedo-code would be great.
Thanks.
Thanks.
I fail to see the problem. If the camera is at Position P in the object''s local space, and at orientation O in the object''s local space, the camera in world coordinates would be
then convert the worldcoord position and orientation to a 4x4 matrix and feed that to OpenGL or Direct3D.
if you want to slerp the values, either slerp the object''s position and orientation before the equation, or slerp the final camera''s world position and orientation at the very end.
Cam.WorldCoord.Pos = Cam.LocalCoord.Pos * Obj.WorldCoord.Ori + Obj.WorldCoord.PosCam.WorldCoord.Ori = Cam.LocalCoord.Ori * Obj.WorldCoord.Ori
then convert the worldcoord position and orientation to a 4x4 matrix and feed that to OpenGL or Direct3D.
if you want to slerp the values, either slerp the object''s position and orientation before the equation, or slerp the final camera''s world position and orientation at the very end.
Everything is better with Metal.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement