Re: [Plib-users] Matrix rotation question
Brought to you by:
sjbaker
|
From: Curtis L. O. <cu...@me...> - 2001-07-12 11:17:08
|
It sounds like you may be experiencing "gimble lock". If so, you
should take a look at the definitive document on the subject:
http://web2.airmail.net/sjbaker1/eulers_are_evil.html
Regards,
Curt.
McEvoy, Nick writes:
> Sorry matrix operations are not my strong point ... can somebody please
> point out my stupid mistake !?
>
> I'm developing a space sim with PLIB ... and I have a problem where my
> spaceship behaves in a crazy manner when its heading is directly 'UP' and
> tries to roll to the left or right.
>
> // Say my initial my position is as follows: (ie. I'm pointing directly up
> ... NOTE: this only happens when pointing directory UP !!!)
> sgCoord mPosition;
> sgSetCoord(&mPosition, 0.0f, 0.0f, 0.0f, 0.0f, 90.0f, 0.0f);
>
> // Say my direction change is as follows: (ie. I'm rolling to the left)
> sgVec3 mDirChange;
> sgSetVec3(mDirChange, 0.0f, 0.0f, -0.01f);
>
> // I have a loop where the direction change is applied as follows to update
> the hpr:
> sgMat4 POS, ROT;
> sgMakeCoordMat4(POS, &mPosition);
> sgMakeRotMat4(ROT, mDirChange);
> sgPreMultMat4(POS, ROT);
> sgSetCoord(&mPosition, POS);
>
> // Why does this loop toggle the hpr part of my mPosition as follows:
> (causing the model to FREAK OUT flipping between ~0 and 90)
> hpr: 0, 90, 0
> hpr: 0, 90, 90.01
> hpr: 0, 90, 6.18986e-006
> hpr: 0, 90, 90.01
> hpr: 0, 90, 1.38196e-005
> hpr: 0, 90, 90.01
> hpr: 0, 90, 1.38196e-005
> etc ...
>
> Any help appreciated,
> Nick
> mailto:nic...@as...
> http://members.ozemail.com.au/~ndmcevoy/
>
>
> _______________________________________________
> plib-users mailing list
> pli...@li...
> http://lists.sourceforge.net/lists/listinfo/plib-users
--
Curtis Olson Human Factors Research Lab FlightGear Project
Twin Cities cu...@hf... cu...@fl...
Minnesota http://www.menet.umn.edu/~curt http://www.flightgear.org
|