Path: chuka.playstation.co.uk!news From: "Martin Keates" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: libps - RotMatrix() Date: Fri, 26 Oct 2001 14:31:27 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 35 Message-ID: <9rbol5$2i3@www.netyaroze-europe.com> References: <3BD923D9.872FC1A0@127.0.0.1> NNTP-Posting-Host: modem-794.abra.dialup.pol.co.uk X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 > x = banking angle > y = pitch > z = direction > > so the planes have +ve z as up, and fly in the direction of the +ve y That makes y roll not pitch, and x,y,z is basically pitch, roll and yaw. > RotMatrixX(x, mtrx); > RotMatrixY(y, mtrx); > RotMatrixZ(z, mtrx); This is not quite right. For example, if a plane pitches 45 degrees up and rolls 90 degrees right it will be pointing between the x and y axes, but its direction of travel will be along the y axis. You need to swap the x and y rotations (or make your planes point along the x axis and travel along +ve x) - it's not known as "roll, pitch and yaw" for nothing. :) Also, you need to make sure you keep your rotations within a suitable range. Anything for roll and yaw, but pitch needs to be within -90 to 90 degrees. I don't think you'll get any sort of Gimbal Lock problem here. When pitch is +/- 90 degrees the plane will be vertical so you probably won't want it to be moving along the y axis. But it should have the correct orientation. Presumably you move the planes on the z-axis as well as the y-axis depending on their pitch. You could get the direction vector of the plane by putting (0,1,0) through the rotation matrix. Martin.