Maya の Expression で Aim Constraint をするメモ。
obj が回転対象、targetが目標物。
float $axis_x = 0.0;
float $axis_y = 1.0;
float $axis_z = 0.0;
float $dx = target.translateX - obj.translateX;
float $dy = target.translateY - obj.translateY;
float $dz = target.translateZ - obj.translateZ;
float $angles[] = `angleBetween -euler -v1 $axis_x $axis_y $axis_z -v2 $dx $dy $dz`;
obj.rotateX = $angles[0];
obj.rotateY = $angles[1];
obj.rotateZ = $angles[2];