Go to: Synopsis. Return value. Flags. MEL examples.
angleBetween [-constructionHistory boolean] [-euler] [-vector1 linear linear linear] [-vector2 linear linear linear]
angleBetween is undoable, NOT queryable, and NOT editable.
Returns the axis and angle required to rotate one vector onto another.
If the construction history (ch) flag is ON, then the name of
the new dependency node is returned.
float[] | 3 Euler angles or axis and angle |
string | When constructionHistory flag is used. |
constructionHistory, euler, vector1, vector2
Long name (short name) |
Argument types |
Properties |
|
-constructionHistory(-ch)
|
boolean
|
|
|
Turn construction history on or off. If true, a dependency
node will be created and its name is returned.
Default: false
|
|
-euler(-er)
|
|
|
|
return the rotation as 3 Euler angles instead of axis + angle
|
|
-vector1(-v1)
|
linear linear linear
|
|
|
vector to compute the rotation from
|
|
-vector2(-v2)
|
linear linear linear
|
|
|
vector to compute the rotation to
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command.
|
// To find the euler angle between these two vectors. The result is three
// angles in the current angular unit. In this example, the first vector
// must be rotated -63.434949 degrees about the X axis, 16.60155 degrees
// about the Y axis and -26.565051 degrees about the Z axis to achieve
// the second vector.
angleBetween -euler -v1 0.0 1.0 2.0 -v2 1.0 2.0 0.0;
// Result: -63.434949 16.60155 -26.565051 //
// To find the angle between these two vectors. The result is an axis and
// an angle (in the current angular unit). In this example, the first
// vector must be rotated 66.421822 degrees about the axis
// (-0.8728716, 0.4364358, -0.2182179) to achieve the second vector.
angleBetween -v1 0.0 1.0 2.0 -v2 1.0 2.0 0.0;
// Result: -0.8728716 0.4364358 -0.2182179 66.421822 //
// How to create a dependency node that calculates the angle between two
// vectors. This example shows how the (x,z) position of a sphere
// can be used to control the rotate factors (about y) of a cone shape.
string $angleBtwnNode = `angleBetween -v1 1 0 0 -v2 1 0 0 -ch on`;
string $sphere[] = `sphere -ch off`;
move 5 0 5 $sphere[0];
connectAttr ($sphere[0]+".translateX") ($angleBtwnNode+".vector2X");
connectAttr ($sphere[0]+".translateZ") ($angleBtwnNode+".vector2Z");
string $cone[] = `cone -ch off`;
string $convert = `createNode unitConversion`;
connectAttr ($angleBtwnNode+".eulerY") ($convert+".input");
connectAttr ($convert+".output") ($cone[0]+".rotateY");