whyasky Posted September 20, 2015 Share Posted September 20, 2015 I've been experimenting with rotating an object in T3D.At first, I setup the camera to orbit around the object.But that didn't have the desired affect.Instead, I'd like to rotate the object itself -Leaving the camera in a fixed position.So, far I've only been able to get it to rotate on the Z axis ... not X or Y.Not sure if I'm trying the wrong approach or what -- %txfm = %object.getTransform(); echo(" object starting transform=" @ %txfm ); // change the rotation based on number keys // switch$(%direction) { case "LEFT": %rotMod = "0 0 0.1"; case "RIGHT": %rotMod = "0 0 -0.1"; case "DOWN": %rotMod = "0 1 0"; case "UP": %rotMod = "0 -1 0"; } // create rotation matrix from radian angles %rotTrans = MatrixCreateFromEuler(%rotMod); // multiply against objects original transform %newTransform = MatrixMultiply(%txfm, %rotTrans); // set the transform %object.setTransform( %newTransform ); This seems to rotate it correctly on the horizontal axis (Z?) But not the other axis's (guessing it X and Y not rotating) Is this the correct approach -- Using a matrix multiply ? Any ideas or examples of how to get it rotating in all directions?in other words ... +/- X or Y or Z ... based on input.I get the key mapping, etc ... just need a working example of the matrix math to use. Quote Link to comment Share on other sites More sharing options...
cybore Posted September 20, 2015 Share Posted September 20, 2015 This might help you figure out what your after. Torque3D Script Rotations Explained and Converted Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.