Path: chuka.playstation.co.uk!chuka.playstation.co.uk!news From: James Russell Newsgroups: scee.yaroze.programming.3d_graphics,scee.yaroze.beginners Subject: Re: Moving an object locally? Date: Fri, 19 Sep 1997 16:14:03 +1200 Organization: Peace Computers NZ Ltd Lines: 38 Message-ID: <3421FC0B.63DE@peace.co.nz> References: <34216030.6706A19F@globalnet.co.uk> NNTP-Posting-Host: 202.37.70.35 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.0Gold (X11; I; IRIX 6.2 IP22) Xref: chuka.playstation.co.uk scee.yaroze.programming.3d_graphics:323 scee.yaroze.beginners:99 Kev wrote: > > Hi, > > Can anyone help with this problem, I think it's quite simple but I > can't suss it out... > > I've got a spaceship object and I've got it rotating and moving etc. > but it moves relative to the WORLD and I need it to move in the direction > it's pointing. So if I've got a rotation vector, how do I use it to get the > ship to translate/move in that direction?? (yeah, I know I need to brush up > on my 3D but I've been playing with 2D so far.... :) > With only a rotation matrix, I would: Make a unit vector pointing in a standard direction (X, Y or Z, can't remember which). Apply the rotation matrix to it. There's your direction vector. Multiply this by the 'distance' you want to go. Vector Add it onto the original position. yay! J -- ==PEACE COMPUTERS ==James.Russell@peace.co.nz - 64(9)3730400 -Fax 64(9)3730401 Trust me! Would I lie to you...again?