Go to: Synopsis. Return value. Flags. Python examples.

Synopsis

pathAnimation( [objects] , [bank=boolean], [bankScale=float], [bankThreshold=angle], [curve=string], [endTimeU=time], [endU=float], [follow=boolean], [followAxis=string], [fractionMode=boolean], [inverseFront=boolean], [inverseUp=boolean], [name=string], [startTimeU=time], [startU=float], [upAxis=string], [useNormal=boolean], [worldUpObject=name], [worldUpType=string], [worldUpVector=[float, float, float]])

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

pathAnimation is undoable, queryable, and editable.

The pathAnimation command constructs the necessary graph nodes and their interconnections for a motion path animation. Motion path animation requires a curve and one or more other objects. During the animation, the objects will be moved along the 3D curve or the curveOnSurface.

There are two ways to specify the moving objects:

  1. by explicitly specifying their names in the command line, or
  2. by making the objects selected (interactively, or through a MEL command).

Likewise, there are two ways to specify a motion curve:

  1. by explicitly specifying the name of the motion curve in the command line (i.e. using the -c curve_name option), or
  2. by selecting the moving objects first before selecting the motion curve. I.e. if the name of the motion curve is not provided in the command line, the curve will be taken to be the last selected object in the selection list.

When the end time is not specified: only one keyframe will be created either at the current time, or at the specified start time.

Return value

string(name of the created motionPath node)

In query mode, return type is based on queried flag.

Flags

bank, bankScale, bankThreshold, curve, endTimeU, endU, follow, followAxis, fractionMode, inverseFront, inverseUp, name, startTimeU, startU, upAxis, useNormal, worldUpObject, worldUpType, worldUpVector
Long name (short name) Argument types Properties
bank(b) boolean query
If on, enable alignment of the up axis of the moving object(s) to the curvature of the path geometry.
Default is false.
When queried, this flag returns a boolean.
bankScale(bs) float query
This flag specifies a factor to scale the amount of bank angle.
Default is 1.0
When queried, this flag returns a float.
bankThreshold(bt) angle query
This flag specifies the limit of the bank angle.
Default is 90 degrees
When queried, this flag returns an angle.
curve(c) string query
This flag specifies the name of the curve for the path.
Default is NONE
When queried, this flag returns a string.
endTimeU(etu) time querymultiuse
This flag specifies the ending time of the animation for the u parameter.
Default is NONE.
When queried, this flag returns a time.
endU(eu) float query
This flag specifies the ending value of the u parameterization for the animation.
Default is the end parameterization value of the curve.
When queried, this flag returns a linear.
follow(f) boolean query
If on, enable alignment of the front axis of the moving object(s).
Default is false.
When queried, this flag returns a boolean.
followAxis(fa) string query
This flag specifies which object local axis to be aligned to the tangent of the path curve.
Default is y
When queried, this flag returns a string.
fractionMode(fm) boolean query
If on, evaluation on the path is based on the fraction of length of the path curve.
Default is false.
When queried, this flag returns a boolean.
inverseFront(inverseFront) boolean query
This flag specifies whether or not to align the front axis of the moving object(s) to the opposite direction of the tangent vector of the path geometry.
Default is false.
When queried, this flag returns a boolean.
inverseUp(iu) boolean query
This flag specifies whether or not to align the up axis of the moving object(s) to the opposite direction of the normal vector of the path geometry.
Default is false.
When queried, this flag returns a boolean.
name(n) string query
This flag specifies the name for the new motion path node. (instead of the default name)
When queried, this flag returns a string.
startTimeU(stu) time querymultiuse
This flag specifies the starting time of the animation for the u parameter.
Default is the the current time.
When queried, this flag returns a time.
startU(su) float query
This flag specifies the starting value of the u parameterization for the animation.
Default is the start parameterization value of the curve.
When queried, this flag returns a linear.
upAxis(ua) string query
This flag specifies which object local axis to be aligned a computed up direction.
Default is z
When queried, this flag returns a string.
useNormal(un) boolean createqueryedit
This flag is now obsolete. Use -wut/worldUpType instead.
worldUpObject(wuo) name createqueryedit
Set the DAG object to use for worldUpType "object" and "objectrotation". See -wut/worldUpType for greater detail. The default value is no up object, which is interpreted as world space.
worldUpType(wut) string createqueryedit
Set the type of the world up vector computation. The worldUpType can have one of 5 values: "scene", "object", "objectrotation", "vector", or "normal". If the value is "scene", the upVector is aligned with the up axis of the scene and worldUpVector and worldUpObject are ignored. If the value is "object", the upVector is aimed as closely as possible to the origin of the space of the worldUpObject and the worldUpVector is ignored. If the value is "objectrotation" then the worldUpVector is interpreted as being in the coordinate space of the worldUpObject, transformed into world space and the upVector is aligned as closely as possible to the result. If the value is "vector", the upVector is aligned with worldUpVector as closely as possible and worldUpObject is ignored. Finally, if the value is "normal" the upVector is aligned to the path geometry. The default worldUpType is "vector".
worldUpVector(wu) [float, float, float] createqueryedit
Set world up vector. This is the vector in world coordinates that up vector should align with. See -wut/worldUpType for greater detail. If not given at creation time, the default value of (0.0, 1.0, 0.0) is used.

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 have multiple arguments, passed either as a tuple or a list.

Python examples

import maya.cmds as cmds

# Create a set of simple objects for the motion path animation

# create a path, e,g, a curve
path = cmds.curve(d=3,p=[(-10, 0, 0),(-6, 0, 10),(-3, 0, -10),(10, 0, 0)],k=[0, 0, 0, 1, 1, 1])

# create an object, e.g. a sphere
object = cmds.sphere()
cmds.scale( 0.5, 2.0, 0.2 )

# 1. To animate the sphere along the curve, with one keyframe at
# the current time:

cmds.pathAnimation( object[0], c=path )

# or:

cmds.select( object[0], path )
cmds.pathAnimation()

# 2. To animate the sphere along the curve, from time 0 to time 30:

cmds.pathAnimation( object[0], stu=0, etu=30, c=path )

# 3. To align the sphere to its path:

cmds.pathAnimation( object[0], stu=0, etu=30, follow=True, c=path )

# 4. To align the Z axis of sphere to the tangent of the curve, and
# to align the Y axis of the sphere to the up direction of the
# motion curve:

cmds.pathAnimation( object[0], stu=0, etu=30, fa='z', ua='y', c=path )

# 5. To align the Z axis of sphere to the tangent of the motion curve,
# to align the Y axis of sphere to the up direction of the motion
# curve, and to bank with the curvature of the motion curve:

cmds.pathAnimation( object[0], stu=0, etu=30, fa='z', ua='y', bank=True, c=path )

# 6. To change the setting on the bankScale for the motionPath1
# to negative 2.5 (i.e. bank out and multiply the computed
# bank value by 2.5):

cmds.pathAnimation( 'motionPath1', edit=True, bankScale=-2.5 )

# Notes:
# If the computed bank angles are not large enough, the user can
# specify the bankScale to amplify them. The default value is 1.

# Positive bankScale produces inward bank angle,
# negative bankScale produces outward bank angle.

# The user can also change the maximum bank angle through
# the bankThreshold option. Default value is 90 degrees.