Skip to content

Constraint

Description of a Powered Constraint.

NOTE: The <Constraint> tag within the <Group> tag has a meaning different from the regular <Constraint> described within the <PhysicsModel> and also has different attributes. The <PhysicsModel><Constraint> describes the constraint itself, the <PoweredConstraints><Constraint> describes the "powered" nature of this constraint.

The <PoweredConstraints><Constraint> tags must be tied to the corresponding regular <PhysicsModel><Constraint> tags by thier Name. I.e., they must have the same value of the Name attribute.

NOTE: The <Motor> tag within a <PhysicsModel><Constraint> tag must have Type attribute equal to Position, if this constraint is tied to a <PoweredConstraints><Constraint> tag as described above.

For details, see Powered Constraints: Overview in the Additional Info on Trucks.

Attributes:

  • InitialFix="true"
    If enabled, then, prior to being activated (either by the player pressing a button, or by internal code of the game), a constraint behaves like a fixed constraint. That is, if the force of the constraint is small, then, for example, the constraint will spring when the player is driving on bumps. See also: TerminalFix below.

  • Name="Leg"
    This attribute sets the name of the regular constraint from the <PhysicsModel> that is controlled by this Powered Constraint. I.e., the value of the Name attribute of the <PoweredConstraints><Constraint> must be equal to the Name of some <PhysicsModel><Constraint>.

  • SpeedMult=".4"
    The multiplier for the speed of the Powered Constraint when it moves to target position and back.

  • TerminalFix="true"
    Enables the following behavior: if the constraint hits an obstacle before reaching the end point of its movement (initiated by the player pressing a button, or by internal code of the game) and cannot push it through, then it will stop pushing and will become fixed constraint. See also the IntialFix above.

  • Position="0.467"
    This is the end point, to which the bone moves due to this constraint (its motor). It will move from zero to Position. The value can be in either meters or degrees – this depends on the type of the regular constraint tied to this Powered Constraint. Minimum and maximum values for movement are also specified within the description of the regular constraint and particular attributes for them there depend on the type of this constraint. Moreover, if specified Position is greater than the maximum value specified for the regular constraint, the Powered Constraint will not be able to reach this Position.

    NOTE: In the description of the regular constraint, you can set the minimum and maximum values for it. And, the Powered Constraint can only move from zero to the specified Position. For player-controlled Powered Constraints: the constraint goes to the specified Position when the player presses the particular button; when they press it again, the constraint goes back to 0. For code-controlled Powered Constraints – the same processes are initiated from the code. Therefore, typically we set up 0 as the minimum value of constraint and Position as its maximum value.