3d 在MEL中,如何仅在一个方向上平移对象轴?
我想编写一个脚本,该脚本将获取多个对象,将它们各自的轴居中,然后将y轴上的轴转换为0 以下是我迄今为止的两种尝试:3d 在MEL中,如何仅在一个方向上平移对象轴?,3d,maya,mel,3d,Maya,Mel,我想编写一个脚本,该脚本将获取多个对象,将它们各自的轴居中,然后将y轴上的轴转换为0 以下是我迄今为止的两种尝试: string $sel[] = `ls -sl -typ transform`; string $obj; for ($obj in $sel) { CenterPivot setAttr ($obj + ".scalePivot") -ty 0; setAttr ($obj + ".rotatePivot") -ty 0; } 及 在第二个脚本中,平移
string $sel[] = `ls -sl -typ transform`;
string $obj;
for ($obj in $sel) {
CenterPivot
setAttr ($obj + ".scalePivot") -ty 0;
setAttr ($obj + ".rotatePivot") -ty 0;
}
及
在第二个脚本中,平移y从其起始位置移动到零-0.098814,但z和x从源对象的中心移动
string $sel[] = `ls -sl -typ transform`;
string $obj;
for ($obj in $sel)
{
xform -ws -cp;
xform -ws -piv 0 -0.098814 0;
}
我认为,添加世界空间将解决您的问题。如果我理解正确:
for( $i in `ls -sl`){
select $i;
xform -ws -cp;
$p = `xform -q -piv -ws`;
xform -ws -piv $p[0] 0 $p[2];}
仍然在距离上结束:/n现在仍然排序-我使用上面的命令将所有枢轴居中,然后手动将它们捕捉到网格中
for( $i in `ls -sl`){
select $i;
xform -ws -cp;
$p = `xform -q -piv -ws`;
xform -ws -piv $p[0] 0 $p[2];}