[Plib-users] Matrices and sgCoord
Brought to you by:
sjbaker
From: Dimitris M. <dm...@ya...> - 2007-07-24 14:25:36
|
The following code has been a success in order to make the object move at a= constant speed.=0A=0AsgCoord stigma;=0A=0Avoid GLObject::setStigma( sgMat4= & objDst){=0A sgSetCoord( & stigma, objDst);=0A}=0A=0AGLObject::move(){= =0A //The rotation matrix for moving around trireme.=0A sgMat4 Rotate= Matrix =3D {=0A 1, 0, 0, 0,=0A 0, 1, 0, 0,=0A 0, 0, = 1, 0,=0A 0,( getSpeed()), 0, 1=0A };=0A =0AsgMakeCoordMat4( SH= IPSRC, &trireme->getStigma());=0AsgMultMat4( SHIPDST, SHIPSRC, RotateMatrix= );=0AsetStigma( SHIPDST);=0A=0AWhat I don;t understand is that I took the u= sual matrix and instead tweaking the last column element by the second row,= =0AI inversed it and put the getSpeed() which is <>0 in the bottom row! Why= ? this?=0AI made then the matrix multiplications, and took the result to sg= Coord.=0AIs this right approach? Ok it works, but it worths?=0A=0A=0A=0A=0A= =0A =0A______________________________________________________________= ______________________=0ANeed a vacation? Get great deals=0Ato amazing plac= es on Yahoo! Travel.=0Ahttp://travel.yahoo.com/ |