MotionPathConstraint

MotionPathConstraint

A constraint which makes the constrained object move along the curve path.

To influence some object, push a MotionPathConstraint instance into the Object3D.constraints array.

Constructor

MotionPathConstraint()

The constructor takes no arguments.

Properties

See the base Constraint class for common properties.

.bank : Boolean

Enables banking. Banking means the object will lean in towards the center of the curvature of the curve that it travels along, like a motorcycle going around a corner, i.e. it is a kind of roll to left-right. Default is false.

.bankScale : Float

Scales the banking angle. Default is 1.

.bankLimit : Float

The maximum allowed absolute banking angle in radians. Default is Infinity.

.chordLengths : Array

The array of sums of chord lengths. Chord lengths are stored like this:

[lengthOfChord1, lengthOfChord1 + lengthOfChord2, ...]

The last element equals to approximated curve length. Note: does not work when useChordLength is disabled. Default is [].

.chordsNum : Integer

The total chords count on the curve, used when useChordLength flag is enabled. The bigger the number the more uniformly will be object movement. If chordsNum <= 0 then it will be computated automatically. Note: always call init method to apply changes. Default is 0.

.cvs : Array

The packed array of NURBS curve's control points. "Packed" means that the control points stored like this:

[point_1.x, point_1.y, point_1.z, point_2.x, point_2.y, point_2.z, ...]

Note: always call init method to apply changes. Default is [].

.degree : Integer

The degree of NURBS curve, i.e. the degree of path curve. Note: always call init method to apply changes. Default is 3.

.fixCameraLightRotation : Boolean

In Verge3D we use right-handed coordinate system with the Y axis pointing in the up direction, but Blender and 3ds Max uses right-handed coordinate system with Z axis pointing in the up direction (Verge3D Wiki). So, to correct the rotation for cameras and lights, set fixCameraLightRotation = true. Default is false.

.fixedValue : Float

Object will stay locked to a single point along the curve regardless of animation. Default is 0.0.

.follow : Boolean

If on, computes the object’s orientation (rotation) as it moves along the curve. Default is true.

.frontAxis : String

The axis of the constrained object that aligns with the front vector, in other words the axis that aligns to the curve tangent. Can be one of the 'X', '-X', 'Y', '-Y', 'Z', '-Z'. Default is 'Z'.

.influence : Float

The percentage of influence the constraint has on the object. Default is 1.0 (100%).

.isMotionPathConstraint : Boolean

Read-only flag to check if a given object is of type MotionPathConstraint.

.knots : Array

The array of NURBS curve knots. Note: it's length always have to be number of control points + degree + 1. Note: always call init method to apply changes. Default is [].

.objOffsetMode : Integer

Set how the offset transformation will be applied to current constraint transformation:
0 — the position and rotation transformations will be applied separately (3ds Max behavior).
1 — the transformation will be applied as an matrix multiplication (Blender behavior).
Default is 0.

.objOffsetRotMode : Integer

Set how the offset rotation will be applied to current constraint rotation:
0 — only constraint rotation will be applied (3ds Max, Maya behavior).
1 — the constraint rotation will be applied first, then offset rotation (Blender).
Default is 0.

.offsetValue : Float

An additional offset to value. Note: does not work when useFixedLocation is enabled. Default is 0.0.

.pointsTilt : Array

The array of tilt angles (bank angles, roll angles) in radians at each curve control point. This is an alternative for bank. The values are stored like this:

[tiltAngleForFirstPoint, tiltAngleForSecondPoint, ...]

Note: does not work when usePointsTilt is disabled. Note: always call init method to apply changes. Default is [].

.type : String

The constraint's type. Equals to "MotionPathConstraint".

.upAxis : String

The axis of the constrained object that's always aligned with the worldUpVector as much as possible. Can be one of the "X", "-X", "Y", "-Y", "Z", "-Z". Default is "Y".

.useChordLength : Boolean

Enable it to make object uniformly move along the curve. Default is false.

.useClampValue : Boolean

When enabled the value will be clamped to interval [0.0, 1.0]. Note: does not work when useCyclic is enabled. Default is false.

.useCyclic : Boolean

Enable it to make value cyclic, for example if value = 1.6 then it will be 0.6, if value = -1.6 it will be 0.4. Default is false.

.useFixedLocation : Boolean

Enable it to make object stay locked to a single point along the curve regardless of animation defined by fixedValue. Default is false.

.useObjOffset : Boolean

Enable or disable object's offset. Default is false.

.usePointsTilt : Boolean

Similar to bank, but to use it the pointsTilt array have to be specified. Note: does not work when bank is enabled. Default is false.

.usePosOffset : Boolean

Enable or disable object's position offset. Note: works only if useObjOffset enabled. Default is true.

.useRelative : Boolean

If enabled the object will follow the path with an offset distance based on its original world space position which was saved at first call of update function. Note: works only if useObjOffset enabled. Default is false.

.value : Float

The current constraint value. Have to be in interval [0.0, 1.0] if useCyclic disabled. Default is 0.0.

.weights : Array

The array of weights for each curve control point. Note: always call init method to apply changes. Default is [].

.worldUpVector : Vector3

A Vector3 in world space that the upAxis tries to align with as closely as possible. Default is (0, 1, 0).

Methods

See the base Constraint class for common methods.

.init() → this

Initialize constraint path curve. Note: always call this function after changing path curve parameters.

Source

For more info on how to obtain the source code of this module see this page.