Mail Archives: djgpp/1998/01/09/07:17:07
What exactly does get_align_matrix() do. I've tried to use it in a 3d
engine Im writing but it doesnt seem to work the way I thought it would
I have my camera as a special object which i navigate with. Im trying to
write yawCAMERA(CAMERA *cam, fixed angle); which should swing the camera
left & right.
this is what Im doing .
MATRIX rot = identity_matrix; //playing safe
V3D v = setvector(0, 0, 1); // create a vector pointing forwards
v = rotatevector(0, yawangle, 0); //rotates the vector
//Now align the vector with cameras heading
get_align_matrix(&rot, cam->front.x, cam->front.y, cam->front.z,
cam->up.x, cam->up.y, cam->up.z);
apply_matrix(&rot, v.x, v.y, v.z, &v.x, &v.y, &v.z);
//point the camera in the new direction
cam->front = v;
v = setvector(0, -1, 0); //create a vector pointing up and repeat the
//above process this time store result in
//cam->up
I would be very greatful if someone could tell me what's going wrong.
--
- Raw text -