Notifications
Clear all

[Closed] Rotation question

So I’m trying to rotate using basic trig functions, and have found that I need to use a negative angle when rotating around the Y axis for it to count as positive rotation in Max. Is this because of the right hand rule or something else I’m not understanding?

Example using a positive angle:

obj = Box pos:[0,0,0] isSelected:on width:5 length:5 height:5
objTM = obj.transform
allPoints = #(objTM[1], objTM[2], objTM[3])
theta = 25

sin_t = sin(theta)
cos_t = cos(theta)
newPos = #()
for thePoint in allPoints do (
    x = thePoint[1]
    z = thePoint[3]
    xPrime = x * cos_t - z * sin_t
    zPrime = x * sin_t + z * cos_t
    append newPos [xPrime , thePoint[2] , zPrime]
)

obj.transform = (matrix3 newPos[1] newPos[2] newPos[3] objTM[4])
1 Reply

max use right-hand rule with mxs , but store data use left-hand rule
if possible , use matrix dot product to change transform

obj = Box pos:[0,0,0] isSelected:on width:5 length:5 height:5
obj.transform=((EulerAngles 0 25 0) as matrix3)*obj.transform