Path: chuka.playstation.co.uk!news From: James Russell Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: RotMatrixBUG???? Date: Fri, 10 Jul 1998 08:59:12 +0100 Organization: Sony Computer Entertainment Europe Lines: 44 Message-ID: <35A5C9D0.4C0C98EB@scee.sony.co.uk> References: <01bda686$31300120$4fa1f7c2@manolo> <359D8B5E.54DE@mdx.ac.uk> <35a427fd.88736196@news.scea.sony.com> <35A480D6.FA1F21A@scee.sony.co.uk> <35a52a58.93903711@news.scea.sony.com> NNTP-Posting-Host: camfw01.millennium.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.05 [en] (Win95; I) Jamin Frederick wrote: > > > > >No, that's fine. If you want to rotate your object 40 degrees MORE about the Z axis, > >then just add 40*4096/360 to 'c'. > > > > But this is the problem. It works at first, when still in the > original orientation, but gets screwed up when I change the > orientation of the model in X or Y directions, like the original post. > i.e., adding an amount t to the current angle c no longer has the same > effect when the model is tilted away (??). This is due to the gimbal lock problem. If you coded your program to increase/decrease the X/Y/Z angles in the rotation vector, then everything would have seemed fine until you rotate about more than one axis. If the results aren't what you _expect_, then you probably don't understand the way the rotations are done. Everything is first rotated around the Z axis, then _the_result_of_that_ is rotated about the Y axis, then the result of that is rotated about the X axis. If, on the other hand, you understand why you're getting those unusual results, but you want to get rid of them, then the next question is What sort of rotation behaviour do you want to achieve? and there are a few answers: 1) You want your object pointing in a certain direction (say, vector V) and then rotated an arbitrary amount around V. 2) Whatever the current orientation of the object, you want to rotate that around either X, Y or Z. 3) You want to specify the direction of your object in spherical coordinates (pitch, yaw, roll) which is kind of like (1). These aren't the only answers, of course. It's usually application dependent. For all these cases, using a single rotation vector V with RotMatrix is not appropriate for the job, and you'll have to write some other functions to create the transformation matrix required. If you can tell us what sort of control you want about the direction of your object, we can help you build such a function. Cheers, James -- == James_Russell@scee.sony.co.uk +44 (171) 447-1626 == Developer Support Engineer - Sony Computer Entertainment Europe Famous Last Words: "OK, I lit the emergency candle. Why is it red?"