Delegate : Helper

The Delegate helper object is a special pyramidal object used in crowd animation. By default, the point of the pyramid indicates the forward direction.

The Crowd object controls the delegate or delegates, whose motion can then be imparted to a biped or other object.

Constructor

Delegate ...

CrowdDelegate ...

Properties

<Delegate>.width                       Float       Default: 0.0   -- world units

The width of the Delegate object.

<Delegate>.depth                       Float       Default: 0.0   -- world units

The depth of the Delegate object.

<Delegate>.height                      Float       Default: 0.0   -- world units

The height of the Delegate object.

<Delegate>.velocityColor               Color       Default: (color 0 0 0)

When showVelocity is true, uses the specified color to draw a vector in the delegate's center during the simulation solution. The vector length indicates the delegate's relative speed.

<Delegate>.active                      Boolean     Default: True

The delegate object is subject to control by a Crowd object.

<Delegate>.showForces                  Boolean     Default: True

The forces being applied to a delegate by any applicable behaviors are drawn as vectors whose length indicate the extent of the forces. For example, if the delegate is affected by a Space Warp behavior and a Wander behavior, the vectors (using default colors) are yellow and blue-green, respectively. These vectors are visible only during solution of the crowd simulation.

<Delegate>.showVelocity                Boolean     Default: False

Uses the Velocity Color (see above) to draw a vector whose length depicts the delegate's relative speed. This vector is visible only during solution of the crowd simulation.

<Delegate>.showCogStates               Boolean     Default: True

During a solve, a text label appears next to the delegate showing the name of the cognitive controller state or transition that currently directs its behavior, if any.

<Delegate>.xyConstrain                 Boolean     Default: True

The delegate remains at its initial height (position on the world XY axis) throughout the simulation. When off, the delegate's height can change during the simulation, for example when seeking an object at a different height.

<Delegate>.useHierBbox                 Boolean     Default: True

  Alias Use_Hierarchy_in_Bounding_Box_Computation

When true, the Avoid behavior uses the bounding box of the delegate and all of its children to perform its behavior.

This bounding box is computed by the Crowd object, is used by the collision detector, and can be accessed by other behaviors.

<Delegate>.averageSpeed                Float       Default: 5.0   -- animatable; world units

Specifies the delegate's baseline velocity in 3ds max units (or the current unit type) per second. This can be modified during the simulation by a variety of factors, such as a linked biped's built-in speed and Deviation settings in a behavior.

<Delegate>.maxAccel                    Float       Default: 0.1   -- animatable; world units

Multiplied times Average Speed to determine the maximum acceleration.

<Delegate>.turnDecel                   Float       Default: 0.3   -- animatable; Alias: Turn_Deceleration_Weight

Specifies how much a delegate should slow down when turning. The higher this setting, the more the delegate slows down when it reaches the turn angle (see following parameter). A value of 0 specifies no slowdown; a value of 1 tells the delegate to stop.

The algorithm computes a value, d, which goes linearly from 0 to (1 - Decel Weight) as the turn angle of the delegate goes from 0 to the Turn Angle specified by the user. The speed of the delegate is then multiplied by d. For example, when the delegate turns at the Turn Angle or greater, its speed will be multiplied by 1 - Decel Weight, slowing it down as much as possible based on this parameter. When the delegate is not turning at all, its speed is not affected by the Decel Weight. When the delegate is turning at half the specified Turn Angle, d = Decel Weight / 2, so its speed will be multiplied by (1 - Decel Weight / 2).

As a practical example, take a delegate traveling at 10 units/sec, Decel Weight is set to 0.4, and At Turn Angle is set to 30. When the delegate has turned 15 degrees (half the At Turn Angle), the effective deceleration weight is 0.2. Subtract that quantity from 1 to get 0.8, and then multiply that times the delegate's speed to get 8 units per second halfway into the turn. At the full turn (30 degrees), the delegate travels at 6 units per second.

<Delegate>.turnDecelAngle              Float       Default: 10.0  -- animatable; Alias: Turn_Deceleration_Angle

Specifies the turn angle at which Decel Weight's full slowdown effect is applied. If the current turn angle is less than At Turn Angle, the algorithm divides the latter by the former, and then divides the Decel Weight setting by the result to derive the effective decel weight.

<Delegate>.inclineDecel                Float       Default: 0.1   -- animatable; Alias: Incline_Deceleration_Weight

Specifies how much the delegate should slow down when moving at an upward slant.

<Delegate>.inclineDecelAngle           Float       Default: 90.0  -- animatable; Alias: Incline_Deceleration_Angle

Specifies the upward slant angle at which Decel Weight's full slowdown effect is applied.

<Delegate>.declineAccel                Float       Default: 0.1   -- animatable; Alias: Decline_Acceleration_Weight

Specifies how much the delegate should speed up when moving at a downward slant.

See Decel Weight for a full explanation, taking into account that Accel Weight produces a speedup effect rather than a slowdown. Thus, the effective acceleration weight is added to 1, not subtracted from it.

<Delegate>.declineAccelAngle           Float       Default: 90.0  -- animatable; Alias: Decline_Acceleration_Angle

Specifies the downward slant angle at which Accel Weight's full speedup effect is applied.

<Delegate>.maxTurnVel                  Float       Default: 30.0  -- animatable; Alias: Max_Turn_Velocity

Specifies the maximum number of degrees a delegate can turn.

<Delegate>.maxTurnAccel                Float       Default: 3.0   -- animatable; Alias: Max_Turn_Acceleration

Specifies how much the delegate's turn angle can change per frame. If this is not small, the delegate's direction might jerk around. It would be allowed to turn suddenly, rather than smoothly.

<Delegate>.maxIncline                  Float       Default: 90.0  -- animatable; Alias: Max_Incline_Velocity

Specifies the maximum number of degrees a delegate can turn upward per frame.

<Delegate>.maxDecline                  Float       Default: 90.0  -- animatable; Alias: Max_Decline_Velocity

Specifies the maximum number of degrees a delegate can turn downward per frame.

<Delegate>.maxBank                     Float       Default: 30.0  -- animatable

Specifies the maximum number of degrees a delegate can bank.

<Delegate>.maxBankVel                  Float       Default: 3.0   -- animatable; Alias: Max_Bank_Velocity

Specifies how much the delegate's bank angle can change per frame.

<Delegate>.bankPerTurn                 Float       Default: 1.0   -- animatable

The number of degrees the delegate will bank as a function of the turn angle at the current frame. For example, if Bank per Turn=1, the delegate will bank one degree for every degree it is turning at a given frame.

<Delegate>.useBiped                    Boolean     Default: False

When true, the delegate is associated with a biped.

<Delegate>.biped                       Node        Default: Undefined

The biped with which the delegate is associated.

<Delegate>.startFrame                  Integer     Default: 0

The frame at which the associated biped's first clip will begin to play.

<Delegate>.priority                    Integer     Default: 0

Sets the delegate priority, which determines the order of solution in biped/delegate simulations.

<Delegate>.startClip                   Integer     Default: 0

0 û First clip of current script

1 û Random start clip

<Delegate>.duration                    Integer     Default: 0

The number of frames the delegate has been in the current state.

<Delegate>.behaviors            ArrayParameter     Default: #()

The behaviors property contains valid values only during a solve. Contains the behaviors being used during the solve.

<Delegate>.weights              ArrayParameter     Default: #()

The weights property contains valid values only during a solve. Each element contains the weight of the corresponding behavior in the behaviors property value.

<Delegate>.simpos                       Point3     Default: [0,0,0]

The simpos property contains a valid value only during a solve. Contains the current position of the delegate during the simulation.

<Delegate>.randID                      Integer     Default: 0     

A possibly non-unique identifier whose purpose is to be used by behaviors as part of it's seed calculation. If more than one delegate has the the same randId then they should have the same random behavior. By defualt, crowd creates unique randIds.

<Delegate>.index                       Integer     Default: -1   -- Read-only

Index used by various behaviors as indices into internal arrays. Before a solve, Crowd makes sure that the delegates who are participating in the solve are given a contiguous set of indices, so that behaviors can set up arrays which use these indices.

Related Delegates Methods

delegates.isComputing <delegate_node>

Returns a '1' if the delegate is currently active in a crowd solve simulation, it returns a '0' otherwise.

delegates.velocity <delegate_node>

Returns the normalized velocity of the delegate at the current simulation frame as a Point3 value.

delegates.prevVelocity <delegate_node>

Returns the normalized velocity of the delegate at the previous simulation frame as a Point3 value.

delegates.startVelocity <delegate_node> <time>

Returns the normalized velocity of the delegate at the start of the crowd simulation as a Point3 value. Thus the <time> parameter is a time value that should be equal to crowd.simStart.

delegates.speed <delegate_node>

Returns the speed of the delegate at the current simulation frame as a float.

delegates.isAssignmentActive <delegate_node> <assignmentIndex> <time>

Returns a '1' if the delegate is active for a particular crowd assignment at the time specified, if not it returns a '0'. The <assignmentIndex> directly corresponds to the index of the assignment in the crowds.assignment array.

Note

The functions lineDisplay ,sphereDisplay ,bboxDisplay , and textDisplay are all functions which can be used to draw a graphic primitive for a particular delegate when the crowd simulation is being solved. All of the positional values are in world space. Usually these functions will be used within a scripted behavior to visually demonstrate the behavior. For example, lineDisplay could be used to draw a line that represents the force that the behavior is exerting on that delegate.

delegates.lineDisplay <delegate_node> <startPosition> <endPosition> <color> <vectorScale>

This function will draw a line from the start position to the endPosition with the color specified .

<startPosition> is a point3 value.

<endPositions> is a point3 value.

<color> is a color value.

<vectorScale> boolean value. Whether or not to scale the line display by the Crowd.vectorScale value.

delegates.sphereDisplay <delegate_node> <position> <radius> <color>

This function will draw a sphere at the position <position>, with a radius of size <radius>, and a color of <color>. <position> is a point3 value, radius is a float and <color> is a color value.

delegates.bboxDisplay <delegate_node> <minPosition> <maxPosition> <color>

This function will draw a bounding box specifed by the two extrema points, <minPosition> and <maxPosition>, with the color specified. <minPosition> and <maxPosition> are point3 values and <color> is a color value.

delegates.textDisplay <delegate_node> <position> <color> <string>

This function will draw the text found in the <string> parameter at the position specified at <position>, with the color found in <color>. <position> is a point3 value, <color> is a color value, and <string> is a string value.

delegates.simTransform <delegate> <time>

Returns the delegate's transformation matrix at the specified time as a Matrix3 value. This method returns valid values during a solve.

Note

During a Solve, the simulation doesn't set the delegate nodes' position and rotation keys until the simulation stops. As such, accessing the delegate nodes' position and rotation during the solve will return incorrect results. The position of a delegate during a solve can be accessed via the .simpos property.

Delegates cannot be rendered, so the size of the Delegate object is primarily for use in scene setup and for determining bounding box extents.

See also