ConvertPosAnimToPath

Introduced

v1.0

Categories

animation constraint

Description

Converts an object's position animation (animated position parameters) to path animation (animation along the path of a curve). The conversion is done by plotting the position animation into a curve (see the PlotCurve command). The object is then path-constrained to the new curve, and the constraint's percentage parameter is keyed at each frame step to create the path animation (see the ApplyPath command). The original position animation is deleted.

Scripting Syntax

ConvertPosAnimToPath( [InputObjs], [Name], [StartTime], [EndTime], [StepFrame] );

Parameters

Parameter Type Description
InputObjs String List of objects with position animation

Default Value: Selected objects

Name String Name to give to the plotted curve

Default Value: "Path"

StartTime Double First frame to convert

Default Value: 0

EndTime Double Last frame to convert

Default Value: 0

StepFrame Double Number of frames for each step

Default Value: 1

Examples

VBScript Example

'
' Position animate a null with an modulated sine wave.
' Plot this as a curve, and convert the animation to path animation.
' 
dim oNull,i, p
set oNull = GetPrim("Null")
for i = 5 to -5 step -0.1
        SetValue oNull & ".kine.local.posx",i
        SaveKey  oNull & ".kine.local.posx", 50+(i*10)
        SetValue oNull & ".kine.local.posz",5*sin(i)*(0.5*sin(20*i))
        SaveKey  oNull & ".kine.local.posz", 50+(i*10)
next 
'
' use the X3DObject.NodeAnimatedParameters property to 
' log which parameters are animated before the conversion
'
for each p in oNull.NodeAnimatedParameters( siAnySource )
        logmessage "Animated before conversion :" & p.FullName 
next 
ConvertPosAnimToPath oNull, "Path", 1, 100, 1
'
' use the X3DObject.NodeAnimatedParameters property to 
' log which parameters are animated after the conversion
'
for each p in oNull.NodeAnimatedParameters( siAnySource )
        logmessage "Animated after conversion :" & p.FullName
next 
'Results of running this script:
'INFO : "Animated before conversion :null.kine.local.posx"
'INFO : "Animated before conversion :null.kine.local.posz"
'INFO : "Animated after conversion :null.kine.global.posx"
'INFO : "Animated after conversion :null.kine.global.posy"
'INFO : "Animated after conversion :null.kine.global.posz"
'INFO : "Animated after conversion :null.kine.pathcns.perc"

See Also

PlotCurve ApplyPath