MaxScript如何捕获当前的旋转

时间:2018-08-24 10:52:21

标签: maxscript

这是我第一次尝试为3ds max编写脚本。我正在尝试将所选对象的枢轴点旋转设置为(90,0,0)。到目前为止,每次运行脚本时,我都设法将旋转值增加了90。然后,我在线找到了一个解决方案,但出现错误:“未知属性objectoffsetrot”。这是脚本:

(
    fn RotatePivotOnly obj rotation = (
    local rotValInv=inverse (rotation as quat)
    animate off in coordsys local obj.rotation = RotValInv
    obj.objectoffsetrot *=RotValInv
    obj.objectoffsetpos *= RotValInv
)

fn RotatePivotAbsolute obj rotation =
(
        currentRot=obj.objectoffsetrot as quat
        wantRot = rotation 
        needRot =(currentRot as quat - wantRot as quat) as eulerangles
        RotatePivotOnly obj needRot
)

if (b = selection as array)[1] == undefined then
b = box()

b.pivot=[0,0,0] 
RotatePivotAbsolute b (EulerAngles 90 0 0) 
)

1 个答案:

答案 0 :(得分:0)

尝试这两个步骤的方法。转换obj,然后将其旋转回去:

slider.Template