Ok, my maths skills are now apparently zero…I have an “Orientation” class that maintain pos, up and face vectors. It provides the transformation matrix for my objects and has tiltLeft/right, lookUp/Down, etc. I wrote it years ago and haven’t touched it since.
I now want to add a scale vector. So to the getTransformationMatrix method I added
Matrix4x4 mT // The X column (0,1,2,3) is the crossProduct of the // Up and Facing vectors i.e. the vector which is // perpendicular to them (the X-axis) Vector3 vxAxis = crossProduct( vUp, -vFace) mT = vxAxis * vScale mT = vxAxis mT = vxAxis mT = 0; // The Y column (4,5,6,7) is the Up vector mT = vUp mT = vUp * vScale mT = vUp mT = 0; // The Z column (8,9,10,11) is the Facing vector mT = vFace mT = vFace mT = vFace * vScale mT = 0 // The Location column (12,13,14,15) is the position mT = vPos mT = vPos mT = vPos mT = 1;
I was only using this for objects drawn with no rotations (so vUp=0,1,0 and vFace=0,0,-1) and it all worked. The shapes were translated and scaled (these were 2D GUI shapes).
However I just rotated (tiltRight, again 2D GUI shape) an object and it all goes wrong (the shape rotates, but also sort of shrinks, grows, shinks, grows with a period of 90 degrees (so 0,180 it is normal, 90,270 is at it’s smallest).
I guess I need to use vScale elsewhere or differently, but where? The other relevant parts are the Orientation tiltRight code that changes the vUp
Matrix4x4 mRot mRot.loadRotation(degrees, vFace) vUp.rotate(mRot)
and Maxtrix4x4 loadRotation and Vector3 rotate code.
Sorry for a newbie question. Cheers,