Path_Constraint - superclass: PositionController

Path_Constraint - superclass: PositionController; super-superclass:MAXWrapper - 12:0 - classID: #(8209, 0) 

Value > MAXWrapper > PositionController > Path_Constraint

 

   

Animation Controllers - Quick Navigation

A PathConstraint restricts an object’s movement along a spline or at an averaged distance between multiple splines.

   

Constructor

Path_Constraint ... path ... 

Properties

<Path_Constraint>.path UndefinedClass default: undefined -- node; Path_Constraint 

Gets/sets the first path on the list of paths to constrain to.

NOTE:

This property is exposed mainly for backwards compatibility with the legacy PathPositionController available in 3ds Max prior to version 4 before the Path_Constraint was introduced. The old controller supported only one path that can be get/set using the .path property.

The .path property in the Path_Constraint always returns the first object from the list of paths.

Setting the .path property will always replace the top path on the list with a new one.

If there are two or more objects on the list and the object assigned to the .path property is already on the list, but not the first one, the new object will replace the first entry on the list and because the path can only be on the list once, the second entry will be removed.

To set and manage multiple paths, use the methods exposed in the constraints interface that is described later in this topic.

   

<Path_Constraint>.percent Float default: 0.0 -- animatable; percentage 

Sets the percent that the object is positioned along the path. Corresponds to the % Along Path spinner.

   

<Path_Constraint>.follow Boolean default: false -- boolean 

Aligns one object axis to the tangent at the current position along the spline. The axis to follow with can be specified using the . axis and . axisflip properties.

   

<Path_Constraint>.bank Boolean default: false -- boolean 

Allows the object to bank (roll about the follow axis) as it negotiates the curves of the spline. This property only has effect when the .follow property is set to true . The axis to roll about when banking is the same as for the follow behavior.

   

<Path_Constraint>.bankAmount Float default: 0.5 -- animatable; float; Bank_Amount 

Adjusts the amount of banking to one side or the other, depending on whether the value is positive or negative.

   

<Path_Constraint>.smoothness Float default: 0.5 -- animatable; float 

Controls how rapidly the roll angle changes as the object moves through bends in the trajectory. Smaller values will make the object more responsive to subtle changes in the curve, while larger values smooth out jerking. The default value is a good value for general damping along the curve. Values below two tend to make the action jerky, but values around three can be very useful for simulating a certain degree of realistic instability.

   

<Path_Constraint>.allowUpsideDown Boolean default: false -- boolean; Allow_Upside_Down 

Set to true to avoid the situation in which an object flips when going around a vertically oriented path.

   

<Path_Constraint>.constantVel Boolean default: false -- boolean; Constant_Velocity 

When set to true, provides a constant velocity along the path using path length interpolation. When set to false, the velocity of the object along the path varies depending on the distance between the vertices on the path.

See notes and examples in SplineShape-VertexandLengthInterpolationMethods for details on the two interpolation methods.

   

<Path_Constraint>.loop Boolean default: true -- boolean 

If set to false and the constrained object reaches the end of a path, it can no longer move past the end point. When set to true (default) and the constrained object reaches the end of the path, it loops back to the starting point.

   

<Path_Constraint>.relative Boolean default: false -- boolean 

When set to true , the constrained object will maintain its original position. The object will follow the path(s) with an offset distance based on its original world space position. When set to false (default), the object will be moved to the path or the weighted position between the multiple paths.

   

<Path_Constraint>.axis Integer default: 0 -- integer 

Gets/sets which axis of the object is aligned to the tangent of the path when the .follow property is set to true .

Possible values are:

0 - X axis

1 - Y axis

2 - Z axis

   

<Path_Constraint>.axisFlip Boolean default: false -- boolean; Axis_Flip 

When set to false , the axis specified by the .axis property will be used. When set to true , the axis specified by the .axis property will be taken with the negative sign (flipped).

   

Path_Constraint interfaces:

Interface:constraints 

Methods

<integer>getNumTargets () 

Returns the number of target nodes (paths) in the Target list.

   

<node>getNode <index>targetNumber 

Returns the indexed node from the list of paths.

   

<float>getWeight <index>targetNumber 

Gets the weight of the indexed path node from the list of Targets. Returns the target's weight value at the current time if the target Number is less then the number of targets, 0.0 otherwise.

   

<boolean>setWeight <index>targetNumber<float>weight 

Sets the weight of the indexed node specified by targetNumber to the given value. Returns true on success, false otherwise.

   

<boolean>appendTarget <node>target<float>weight 

Appends the specified node to the list. The default weight is 50.0. Returns true on success, false otherwise.

   

<boolean>deleteTarget <index>targetNumber 

Deletes the indexed target. Returns true on success, false otherwise.

   

NOTES ON PATH TARGET OBJECTS:

A path target can be any type of Shape. The spline curve (target) defines a path of motion for the constrained object. Targets can be animated using any of the standard translation, rotation, and scale tools.

Setting keys on the path's sub object level such as, vertex or segment, or deforming the path using modifiers and space warps will animate the path while affecting the constrained object.

If the shape contains multiple splines (for example, the Donut Shape), the first spline from the shape will be used.

EXAMPLE

path1 = Circle()--create a circular path
--> $Circle:Circle001 @ [0.000000,0.000000,0.000000]
path2 = Ellipse length:20 width:200--create another path
--> $Ellipse:Ellipse001 @ [0.000000,0.000000,0.000000]
s = sphere radius:5--create a sphere
--> $Sphere:Sphere001 @ [0.000000,0.000000,0.000000]
pc = path_constraint()--create a path constraint
--> Controller:Path_Constraint
s.position.controller = pc--assign it to the sphere's position
--> Controller:Path_Constraint
pc.path = path1--assign the first path to the path property
--> $Circle:Circle001 @ [0.000000,0.000000,0.000000]
pc.path = path2--assign the second path - it replaces the first
--> $Ellipse:Ellipse001 @ [0.000000,0.000000,0.000000]
pc.appendTarget path2 50--try to append the second path
--> false--you cannot because it is already assigned!
pc.appendTarget path1 50--try to append the first path
--> true--you can because it was not assigned to the list yet
pc.getNumTargets()--see how many paths there are on the list
--> 2
pc.getWeight 1--get the weight of the first path
--> 50.0
pc.getWeight 2--get the weight of the first path
--> 50.0
pc.getWeight 3--get the weight of thethirdpath
--> 0.0--returns zero because there is no such path!
pc.setWeight 1 100--set the weight of the first path to 100
--> true--success, the sphere moves closer to the ellipse
pc.setWeight 2 0--set the weight of the second path to 0
--> true--success, the sphere moves to the ellipse
pc.path = path1--try to assign the circle to the path
--At this point, the Circle replaces the Ellispe on the list,
--and the second entry which used to be the Circle is removed
--because "There can be only one"!
--> $Circle:Circle001 @ [0.000000,0.000000,0.000000]
pc.deleteTarget 2--try to delete the second path
--> false--you cannot, there is no second path anymore
pc.deleteTarget 1--try to delete the first path (the Circle)
--> true

See Also