Skip to main content
gamedev.net
🔒 Locked 🎮 Unity

Maxscript Rotation Transform

Started by vaughanknight Apr 12, 2009 at 3:34 AM 0 replies 2.8k views
Original Post
vaughanknight
vaughanknight
I'm currently looking to transform an object from the 3DSMAX coordinate system (Z-up, Y-forward, X-right) to a different coordinate system (Z-forward, Y-down, X-right). Both are Right Hand Rule rotation. To do this I wrote the following code... fn convertRotation origRotation = ( Original_Matrix = origRotation as matrix3 format "Original: %\n" Original_Matrix -- Transform matrix zero = Point3 0 0 0 nb = Point3 0 0 -1 -- y bank becomes -z bank nh = Point3 0 -1 0 -- z heading becomes -y heading np = Point3 1 0 0 -- x pitch stays Transform_Matrix = matrix3 np nb nh zero format "Transform: %\n" (Transform_Matrix); -- Result Resultant_Matrix = Transform_Matrix * Original_Matrix; format "Resultant: %\n" Resultant_Matrix; format "Result Angles: %\n" (Resultant_Matrix as eulerangles); return Resultant_Matrix as eulerangles; ) My problem seems to be, simply, it doesn't work. It may be that the destination coordinate system applies the euler angles in a different order than I'm expecting, but I was hoping someone here could tell me if the code I've written is correct or not.
vaughanknight
vaughanknight
Target coordinate system seems to have an euler angle order of X Y Z.

If I set up an object to an original rotation, a quick test has objects rotating around X just spinning on the original X axis, Y spins on the original Y axis (with offset of X in place still) and Z spins around in a strange way, which I assume is holding Y and X.

[Edited by - vaughanknight on April 12, 2009 5:27:38 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.