I am trying to rotate a helper in my 3ds max scene by changing the value of a spinner. Currently changing the value of the spinner does drive a rotation on the helper and rotating the helper updates the value on the spinner. There are still a couple of behavioural problems with my script that I need help solving.
1) I want the rotation on the helper to occur only on the local euler Z axis of the helper however currently its rotation is erratic and occurring on multiple axes.
2) I want to constrain the helper's rotation between a range of -90 and 90 degrees currently it rotates much further than that.
My current code is as follows.
Spin_R_Custom_attribute = attributes custom_Attributes
(
rollout SpinRollout "Helper Controls"
(
Spinner TheSpinner "The Spinner" range:[-10,10,0] controller: $Helper_R_Spin.rotation.z_rotation.controller \
on TheSpinner changed spin do
(
try (in coordsys local $Helper_R_Spin.rotation.z_rotation = spin) catch ()
)
)
)
Any help would be greatly appreciated.
on TheSpinner changed
clause entirely. The spinner is already linked to the rotation through its controller as you've set. And, I believe Rotation should always be in local space by virtue of setting the rotation controller value directly, because the raw controller value is inherently local. If you want to prevent movement beyond +-90 degrees even when manipulated in the viewport, you might have to apply an animation constraint or a scripted controller. – MichaelsonBritt