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: by explicitly specifying their names in the command line, orby making the objects selected (interactively, or through a MEL command).Likewise, there are two ways to specify a motion curve: by explicitly specifying the name of the motion curve in the command line (i.e. using the -c curve_name option), orby 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.
Long name (short name) | Argument Types | Properties | |
---|---|---|---|
bank (b) | bool | ||
|
|||
bankScale (bs) | float | ||
|
|||
bankThreshold (bt) | float | ||
|
|||
curve (c) | unicode | ||
|
|||
endTimeU (etu) | time | ||
This flag specifies the ending time of the animation for the u parameter.Default is NONE.When queried, this flag returns a time.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list. |
|||
endU (eu) | float | ||
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) | bool | ||
|
|||
followAxis (fa) | unicode | ||
|
|||
fractionMode (fm) | bool | ||
|
|||
inverseFront (inverseFront) | bool | ||
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) | bool | ||
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) | unicode | ||
|
|||
startTimeU (stu) | time | ||
|
|||
startU (su) | float | ||
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) | unicode | ||
|
|||
useNormal (un) | bool | ||
|
|||
worldUpObject (wuo) | PyNode | ||
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) | unicode | ||
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 | ||
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. |
Derived from mel command maya.cmds.pathAnimation
Example:
import pymel.core as pm
import maya.cmds as cmds
# Create a set of simple objects for the motion path animation
# create a path, e,g, a curve
path = pm.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 = pm.sphere()
pm.scale( 0.5, 2.0, 0.2 )
# 1. To animate the sphere along the curve, with one keyframe at
# the current time:
pm.pathAnimation( object[0], c=path )
# Result: u'motionPath1' #
# or:
pm.select( object[0], path )
pm.pathAnimation()
# 2. To animate the sphere along the curve, from time 0 to time 30:
pm.pathAnimation( object[0], stu=0, etu=30, c=path )
# 3. To align the sphere to its path:
pm.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:
pm.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:
pm.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):
pm.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.