[Closed] Controlling a rotation by a spinner value
Does anyone have an Idea, what’s wrong with this script?
I try to rotate an object named “DummyInnen” in 25 steps by 14.4 degrees.
Should say from 14.4, 28.8, 43.2, … ,360 degrees.
The script returns no errors, but the returning values are not as expected.
Please don’t be too strict with me, I’m heavily dyslectic on maxscript.
rollout GRadA "Controls Innenkreis"
(
spinner innerOffset "Symbol# (1-25)" type:#integer range:[1,25,1] align:#left fieldwidth:28
on innerOffset changed val do
(
currentMatrix = $DummyInnen.transform
preRotate currentMatrix (eulertoquat (eulerAngles 0 0 (val*14.4)))
$DummyInnen.transform = currentMatrix
)
)
GRadAniFloater = newRolloutFloater "GRad Ani Controls" 218 250
addRollout GRadA GRadAniFloater
changing: prerotate currentMatrix to currentMatrix.rotation seems to work (unless you’re going for something different)
I’ve tried to change the script, hope I got you right.
This code
preRotate currentMatrix.rotation (eulertoquat (eulerAngles 0 0 (val*14.4)))
returns an error:
-- No ""PreRotate"" function for (quat 0 0 -2.92476e006 1)
this code
currentMatrix.rotation (eulertoquat (eulerAngles 0 0 (val*14.4)))
returns
-- Type error: Call needs function or class, got: (quat 0 0 -2.92476e006 1)
Either I’m doing it wrong or it doesn’t work for me.
Yeah, that works!
With an unwanted side effect however:
It resets the position center and scale value of the helper to 0,0,0.
I could live with that if I set the helper to 0,0,0 before linking all further elements together.
Thanks!