[Closed] rotate values seem to add together
I’m trying to rotate an object using float values read from an array. When I keyframe the values, Max seems to add the values together and then keyframe the result.
For instance, here is a sample of the values i’m working with
XrollArray = #(0.0, -0.03, -0.03, -0.03, -0.09)
The first value is keyframed properly with an X rotation value of 0.00, and the second is correct as well at -.03, the third value seems to get added to the second and ends up keyframed as -.06 instead of -.03, the forth is -.09 instead of -0.3, and finally the fifth value is keyframed at -.18.
Does anyone know why this happens and how to have max not add these numbers together?
As you are not resetting the rotation at each key, the rotation value of each array element is taken as a rotation FROM the current rotation
XrollArray = #(0.0, -0.03, -0.03, -0.03, -0.09)
So, if your initial rotation is 0.0, then:
a rotation of XrollArray[1] rotates FROM 0.0 BY 0.0 == 0.0
a rotation of XrollArray[2] rotates FROM 0.0 BY -0.03 == -0.03
a rotation of XrollArray[3] rotates FROM -0.03 BY -0.03 == -0.06
a rotation of XrollArray[4] rotates FROM -0.06 BY -0.03 == -0.09
a rotation of XrollArray[5] rotates FROM -0.09 BY -0.09 == -0.18
You could either reset the rotation before each new rotation is applied, or change the array to:
XrollArray = #(0.0, -0.03, 0.0, 0.0, -0.06)
Thank you for your post Nirrol.
What you posted is dead on. I found the difference between the number values I originally put in the array is what was needed to get the obj to rotate properly on Z.
Interesting to note that while the object started to move correctly, it would hang up and point in strange directions midpoint in the animation and continue incorrectly to the end.
Fixed that by making the Z axis the priority and letting x and y be processed second.
Thank you again Sir.