KeatonMill
23rd September 2002 23:34 UTC
3D camera positioning
Hey there guys. I've got a problem. I've been working on various asundry 3D superscopes, and I've run into a small problem. I haven't figured out raytracing yet, and I don't know if that's part of the problem or not.
I know how to rotate the points around the origin with specific angles, but what I want to do is to move the camera around a specific point, and have it always point towards that point. Obviously, I haven't figured that one out yet. ;-)
Can someone give me a hand? Thanks.
Zevensoft
24th September 2002 06:26 UTC
Here's the order of transforms you need to do:
RotateObject
TranslateObject
-TranslateCamera
-RotateCamera
Try that.
dirkdeftly
24th September 2002 20:10 UTC
Except that 3D scopes don't use raytracing. If you just rotate the object the camera will automatically point to the origin. You can translate the object before rotation, and the camera will look at the origin, but the object will rotate around it. If you translate the object AFTER the rotation, however, the camera will be looking at the point negative to the translation, and the object will be rotating upon the origin (assuming it is centered at the origin and not translated before rotation). So if your pre-rotation translation is <0,0,0> and your pre-projection rotation is <1,0,0>, the camera will be looking at the point <-1,0,0> and the object will still be rotating upon <0,0,0> (again, assuming it is centered at the origin).