ApplyPath

Introduced

1.0

Description

Constrains an object so that it follows the path of a curve. This is the scripting equivalent of choosing Animate > Create > Path > Set Path for an object. A picking session is started if no constraining curve is specified.

You can also set the path percentage, which controls the location of the constrained object over the length of the curve. At zero percent the object is at the beginning of the curve, and at 100% it is at 100% of the length of the curve. By default the constrained object is animated to travel the entire path between the given start and end frames.

Scripting Syntax

    ApplyPath( [InputObjs], [Path], [StartFrame], [EndFrame], [NbKeys], [Linear], [Tangent] )

Parameters

Parameter | Type | Description
InputObjs | String | List of objects to put on a path. Default Value: Selected objects
Path [in/out] | String | Curve to use as the path Default Value: User is prompted to pick a curve
StartFrame [in/out] | Double | Start frame for path animation Default Value: 0
EndFrame [in/out] | Double | End frame for path animation Default Value: 0
NbKeys [in/out] | Long | Number of keys to set on the timing curve Default Value: 2
Linear [in/out] | Boolean | True for a linear fcurve, False for a spline fcurve. Default Value: False
Tangent [in/out] | Boolean | True to set a tangency constraint on the object. Default Value: False

Examples

VBScript Example

    '
    ' Applies a circular path to two cubes.
    ' One cube travels tangent to the path the other does not.
    ' The cubes travel in opposite directions.
    '
    dim oCircle,oCube1,oCube2

    '
    ' Setup: create the circle and cubes
    '
    set oCircle = CreatePrim("Circle", "NurbsCurve")
    oCircle.radius = 3
    Rotate oCircle, -90, 0, 0, siRelative, siAdd, siObj, siXYZ

    set oCube1 = CreatePrim("Cube", "MeshSurface")
    set oCube2 = CreatePrim("Cube", "MeshSurface")
    oCube1.length = 1
    Scale oCube1, 2.5, 0.3, 0.3, siRelative, siLocal, siObj, siXYZ
    oCube2.length = 1
    Scale oCube2, 2.5, 0.3, 0.3, siRelative, siLocal, siObj, siXYZ

    '
    ' Apply the paths to the cubes.
    ' Make oCube2 travel tangent to the path.
    ' By swapping the start and end frames, oCube2 will travel in the opposite direction.
    '
    ApplyPath oCube1, oCircle, 1, 100, 2, False, False
    ApplyPath oCube2, oCircle, 100, 1, 2, False, True

    '
    ' Display the path constraint relation in the top
    ' view of viewport A
    '
    SetValue "Views.ViewA.TopCamera.camvis.*constraint*", True

    '
    ' Play the animation
    '
    PlayForwardsFromStart

See Also

RemoveAllCns | RemoveCns | SIApplyCns

Autodesk Softimage v7.5