Path: chuka.playstation.co.uk!news From: Peter Passmore Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: RotMatrixBUG???? Date: Fri, 10 Jul 1998 01:03:09 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 38 Message-ID: <35A55A3D.F35@mdx.ac.uk> References: <01bda686$31300120$4fa1f7c2@manolo> <359D8B5E.54DE@mdx.ac.uk> <35a427fd.88736196@news.scea.sony.com> <35A46F21.2A41@mdx.ac.uk> <35a52d2d.94628579@news.scea.sony.com> NNTP-Posting-Host: staff-dialup5.mdx.ac.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.04 (Win95; I) Hi, It seems that James and I have been focussing on different aspects of problems in this area in our replies. James was pointing out that if you use rotmatrix specifying more than one angle for rotation eg: an x and a y rotation then you might get different results from those you expected if you wanted to rotate by y first instead of x first because of the order in which rotmatrix applies rotations. (ie order counts and it is a fixed order in rotmatrix). It appears that James' solution to the original problem works out because it is a special case - there were constraints on how things could rotate in the orginal problem and therefore was a good reply ... However it is still true that just using a rotation vector from scratch (and then adding to x, or y, or z increments to the vector) - works well for rotations around a single axis only - and for special (unusual cases) around more than one axis - screws up things for rotations around more that one axis eventually (pretty quickly usually) The problem you encounter is some variety of 'gimbal lock'. eg: if you look at the dino demo (which displays this problem)... In the dino demo we assume that the x and y axes are aligned with the screen and the z extends into the screen. With the dino facing you cross and triangle rotate the dino around its x axis and square and circle rotate it around it's y axis in a correct and obvious manner. However when you rotate the model by 90 degrees around the y axis (so you see it from the side) if you now rotate around the x axis the model rotates around what is it's local z axis (according to the orientation of the model) not its local x axis.... The techniques I was talking about address this... Peter.