www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/09/07:17:07

From: iecheruo AT newstand DOT syr DOT edu (The Ice Man)
Newsgroups: comp.os.msdos.djgpp
Subject: get_align_matrix()
Date: 9 Jan 1998 12:09:21 GMT
Organization: Syracuse University, Syracuse, NY (USA)
Lines: 27
Message-ID: <69541h$d7r@newstand.syr.edu>
Reply-To: nwadibia AT geocities DOT com
NNTP-Posting-Host: hydra.syr.edu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019