CreateUserMotion

Introduced

v10.5 (2012)

Description

Creates a user motion property. User motions are used to control motion vectors on vertices of an object's geometry. User motions can only be created on vertex clusters. A user motion property stores three floating point values for each vertex of the cluster. When a user motion property is applied to an object, the motion blur is no longer computed and instead uses the motion data from this property.

Scripting Syntax

oReturn = CreateUserMotion( [InputObjs], [PropertyName], PropPresetObj );

Return Value

Returns an XSICollection of the newly created properties.

Parameters

Parameter Type Description
InputObjs String List of objects or complete point clusters

Default Value: Current selection

PropertyName String Name of the user motion property

Default Value: "UserMotion"

PropPresetObj Preset object User motion property preset

Default Value: "User Motion Property" preset

Examples

JScript Example

/* 

	This JScript example illustrates how to set the user motion vectors on

	the UserMotion Cluster Property with ICE. The motion vectors of a static

	cylinder are set by the motion of an animated cylinder.

*/

// Create the cylinders

NewScene(null, false);

CreatePrim("Cylinder", "MeshSurface");

Duplicate("cylinder");

// Animate the cylinder

Translate(null, -8, 5, 0);

SaveKeyOnKeyable("cylinder1", 1);

Translate(null, 16, 0, 0);

SaveKeyOnKeyable("cylinder1", 25);

Translate(null, 0, -10, 0);

SaveKeyOnKeyable("cylinder1", 50);

Translate(null, -16, 0, 0);

SaveKeyOnKeyable("cylinder1", 75);

Translate(null, 0, 10, 0);

SaveKeyOnKeyable("cylinder1", 100);

SelectObj("cylinder", null, true);

// Add a User Motion Cluster Prop on the static cylinder and set its ICE Tree

CreateUserMotion();

var oICETreeColl = CreateSimulatedICETree("cylinder", siNode, null);

var oICETree = oICETreeColl.Item(0);

AddICENode("GetDataAtPreviousFrameNode", oICETree);

SetValue(oICETree + ".GetDataAtPreviousFrameNode.reference", "cylinder1.PointPosition");

AddICENode("GetDataAtPreviousFrameNode", oICETree);

SetValue(oICETree + ".GetDataAtPreviousFrameNode[1].reference", "cylinder1.kine.local");

AddICENode("MultiplyVectorByMatrixNode", oICETree);

ConnectICENodes(oICETree + ".MultiplyVectorByMatrixNode.vector", oICETree + ".GetDataAtPreviousFrameNode.value");

ConnectICENodes(oICETree + ".MultiplyVectorByMatrixNode.matrix", oICETree + ".GetDataAtPreviousFrameNode[1].value");

AddICENode("GetDataNode", oICETree);

SetValue(oICETree + ".SceneReferenceNode.reference", "cylinder1.PointPosition", null);

AddICENode("GetDataNode", oICETree);

SetValue(oICETree + ".SceneReferenceNode[1].reference", "cylinder1.kine.local", null);

AddICENode("MultiplyVectorByMatrixNode", oICETree);

ConnectICENodes(oICETree + ".MultiplyVectorByMatrixNode[1].vector", oICETree + ".SceneReferenceNode.value");

ConnectICENodes(oICETree + ".MultiplyVectorByMatrixNode[1].matrix", oICETree + ".SceneReferenceNode[1].value");

AddICENode("SubtractNode", oICETree);

ConnectICENodes(oICETree + ".SubtractNode.first", oICETree + ".MultiplyVectorByMatrixNode.result");

ConnectICENodes(oICETree + ".SubtractNode.second", oICETree + ".MultiplyVectorByMatrixNode[1].result");

AddICENode("DivideByScalarNode", oICETree);

ConnectICENodes(oICETree + ".DivideByScalarNode.value", oICETree + ".SubtractNode.result");

SetValue(oICETree + ".DivideByScalarNode.divideby", 2, null);

AddICECompoundNode("Set Data", oICETree);

SetValue(oICETree + ".Set_Data.Reference", "cylinder.cls.UserMotionCls.UserMotion.Motions", null);

AddICENode("SwitchContextNode", oICETree);

ConnectICENodes(oICETree + ".SwitchContextNode.value", oICETree + ".DivideByScalarNode.result");

ConnectICENodes(oICETree + ".Set_Data.Value", oICETree + ".SwitchContextNode.result");

ConnectICENodes(oICETree + ".port1", oICETree + ".Set_Data.Execute");

// Draw a render region with motion blur on, and playback the scene

RenderRegionCreate(siViewportB, 0, 1, 0, 1);

SetValue("Views.ViewB.RenderRegion.MotionBlur", true, null);

PlayForwardsFromStart();

See Also

AddProp ClusterProperty