Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!uwm.edu!rpi!zaphod.mps.ohio-state.edu!usc!sdsu!crash!jcs From: jcs@crash.cts.com (John Schultz) Newsgroups: comp.graphics Subject: Re: FLIGHT SIMULATOR Message-ID: <2910@crash.cts.com> Date: 31 May 90 03:05:24 GMT References: <3370@umbc3.UMBC.EDU> Distribution: usa Organization: Crash TimeSharing, El Cajon, CA Lines: 31 In article <3370@umbc3.UMBC.EDU> petey@umbc5.umbc.edu writes: [stuff deleted] >If the viewers point of view is at coordinated px,py,pz >and given, yaw,pitch,roll( view rotation about the y,x,z axis's sp?) >and given that I want to move the plane forward say h units. >How do I compute the px'.py',pz' ? Is there an easy way? >Ive played around with sin's and cos's like crazy, but I cant get it >quite right. Yes, there's a really easy way to do this. First, you need to concatenate all of your rotations so that you have your rotations in 3x3 matrix form. See Microcomputers, Displays, Graphics and Animation, by Bruce Artwick if you don't know how to do this (It's covered in other graphics texts as well, and is just algebra). Assuming Z positive goes into the screen, do: dx = matrix.g*velocity; dy = matrix.h*velocity; dz = matrix.i*velocity; px' = px - dx; py' = py - dy; pz' = pz - dz; g,h,i are the z-row of the matrix, or a unit vector along the z-axis. Thus we are just scaling the vector in the direction we wish to travel, and using that value as a translation factor. So the nose of your "airplane" must be defined along the +z axis. John