Constraint

Constraints allow you to apply additional behavior(s) to the transformation of an object and bones. They act like modifiers adding procedural operations to the base transformation of a resource.

In example, using transformation constraints you can easily track or orbit around a point in space, clamp location and distance, follow an existing route or rail, force an object to act as a billboard as well as applying inverse kinematic to an series of bones etc... They are extremely flexible and can work in stack where the current constraint affect the result of the next.

See Also

Static Variables


Name Description
object Object owner of the active Constraint.
part_index In case the Constraint is attached to a Bone represent its index (else -1).
data Gain access to the properties and settings of the active ConstraintType.
uid Unique id to internally identify the Constraint.

Variables


Name Description
influence Normalized value representing the percentage of influence for the active Constraint.
name A unique name to identify the Constraint.
flags Bit mask used to determine if the Constraint is enabled or open in the editor.
start_point The starting position of the Constraint on the Map.
enabled Enable or disable the active Constraint.

Functions


Name Description
Evaluate Manually evaluate the Constraint.
Reset Force to reset the interpolation values of the active Constraint.

ConstraintType


Find below the list of all different type of Constraint that can be created.

  • kTrackTo: Align the active transformation to point a specific target using custom axes.
  • kTrackAxis: Align the rotational matrix of the active transformation to track a target limited to a single axis (billboard inverse).
  • kTrackLock: Track and lock the rotational axis of the active Object.
  • kTrackTarget: Align the active rotational matrix to look at a specific target.
  • kTrackObjectGroup: Modify the active rotational matrix to look at a specific object group.
  • kClampLocation: Limit the location of the active transformation.
  • kClampRotation: Limit the rotation (Euler angles) of the active transformation.
  • kClampQuaternion: Limit the quaternion of the active transformation to a specific range.
  • kClampScale: Limit the scale of the active transformation.
  • kClampDistance: Limit the distance between the active and a specific target.
  • kClampMiddle: Limit the location to be in between two targets.
  • kProportional: Scale evenly the transformation on each axis.
  • kSetLocation: Set a the origin portion of the active transformation.
  • kSetRotation: Set the rotational part of the active transformation in Euler angles.
  • kSetQuaternion: Set a specific quaternion to will then be set to the rotational part of the active transformation matrix.
  • kSetScale: Set a specific scale to the active transformation matrix.
  • kCopyLocation: Assign the target location to the constraint owner transformation.
  • kCopyRotation: Assign the target rotation to the constraint owner transformation.
  • kCopyQuaternion: Assign the target quaternion (3x3 matrix) to the constraint owner transformation.
  • kCopyScale: Assign the target scale to the constraint owner transformation.
  • kCopyTransform: Assign the target transformation to the constraint owner transformation.
  • kOffsetLocation: Give an offset to the location.
  • kOffsetRotation: Give an offset to the rotation in Euler angles.
  • kOffsetQuaternion: Give an offset to the rotation using a Quaternion.
  • kOffsetScale: Give an offset to the scale.
  • kOffsetDirection: Offset the active transformation based on the direction of an arbitrary target in space.
  • kBillboardAlign: Force the transformation to always face the active Camera.
  • kAccelerationAlign: Align the transformation based on its velocity.
  • kFollowRoute: Force the to follow an existing Route.
  • kFollowRail: Force the to be aligned to an existing Route.
  • kFollowLimits: Force the transformation to stays within the boundary of a Route.
  • kLerpLocation: Interpolate the location.
  • kLerpRotation: Interpolate the rotation.
  • kLerpScale: Interpolate the scale.
  • kLerpAcceleration: Interpolate the velocity.
  • kInverseKinematics: Apply inverse kinematic to a series of bones.

TrackingMethod


The following methods listed below are used by the kTrackObjectGroup constraint type. They define how the ObjectGroup should be tracked.

  • kGroupCenter: Track the center of the ObjectGroup.
  • kObjectBounds: Emphasize on tracking bigger objects.
  • kObjectPriority: Emphasize on tracking objects that have a higher priority.

Variable


Multiple constraint use the axis parameter or variations of it (variable with the name axis in it). These variables type is always an integer that represent the vector component at the element pointer by the index.

Value Axis
0 X axis.
1 Y axis.
2 Z axis.

Target & Target Bone


Some constraints are on a targeting system; a target and target_bone parameter is available. The target represent the uid of the Object the Constraint should use. In case the parent Object of the Constraint is a SkeletalMesh an optional target_bone parameter can be specified. This parameter represents the bone index within its associated Skeleton hierarchy.

TrackToConstraint


Name Description
target The unique id of the Object to track.
target_bone The target Bone index to track.
axis The axis index to track relative to the target object.
invert Invert the direction vector between the source and the target.
up_axis Up axis to use in order to calculate the final tracking matrix.
target_z Use the target up rotation as the up axis.

TrackAxisConstraint


Name Description
target The unique id of the Object to track.
target_bone The target Bone index to track.
axis The axis index to track relative to the target object.
invert Invert the direction vector between the source and the target.

TrackLockConstraint


Name Description
target The unique id of the Object to track.
target_bone The target Bone index to track.
axis The axis index to track relative to the target object.
invert Invert the direction vector between the source and the target.
lock_axis The rotational axis to lock.

TrackTargetConstraint


Name Description
target The unique id of the Object to track.
target_bone The target Bone index to track.

TrackObjectGroupConstraint


Name Description
group Id of an existing ObjectGroup to track.
tracking The TrackingMethod to adopt while tracking the ObjectGroup.

ClampConstraint


Name Description
local_space Determine if the clamping should be effectuated in local space (else world space).
min_lock_x Toggle on/off minimum clamping on the X axis.
min_lock_y Toggle on/off minimum clamping on the Y axis.
min_lock_z Toggle on/off minimum clamping on the Z axis.
min Set the minimum location for each axis.
max_lock_x Toggle on/off maximum clamping on the X axis.
max_lock_y Toggle on/off maximum clamping on the Y axis.
max_lock_z Toggle on/off maximum clamping on the Z axis.
max Set the maximum location for each axis.

ClampRotationConstraint


Name Description
local_space Determine if the rotational clamping should be effectuated in local space (else world space).
min_lock_x Toggle on/off minimum clamping on the X axis.
min_lock_y Toggle on/off minimum clamping on the Y axis.
min_lock_z Toggle on/off minimum clamping on the Z axis.
min Set the minimum rotation for each axis; specified in degree ranging from -180 to 180.
max_lock_x Toggle on/off maximum clamping on the X axis.
max_lock_y Toggle on/off maximum clamping on the Y axis.
max_lock_z Toggle on/off maximum clamping on the Z axis.
max Set the maximum rotation for each axis; specified in degree ranging from -180 to 180.

ClampQuaternionConstraint


Name Description
local_space Determine if the clamping should be effectuated in local space (else world space).
min_lock_x Toggle on/off minimum clamping on the X axis.
min_lock_y Toggle on/off minimum clamping on the Y axis.
min_lock_z Toggle on/off minimum clamping on the Z axis.
min_lock_w Toggle on/off minimum clamping on the W axis.
min The minimum rotation for each axis specified as a normalized quaternion.
max_lock_x Toggle on/off maximum clamping on the X axis.
max_lock_y Toggle on/off maximum clamping on the Y axis.
max_lock_z Toggle on/off maximum clamping on the Z axis.
max_lock_w Toggle on/off maximum clamping on the W axis.
max Maximum rotation for each axis specified as a normalized quaternion.

ClampDistanceConstraint


Name Description
target Unique id of the Object to keep distance with.
target_bone Specify the Bone index to stay in distance with.
min_distance Set the minimum distance to keep from the target.
max_distance Specify the maximum distance to keep from the target.

ClampMiddleConstraint


Name Description
targetA Unique Object id of the first target.
target_boneA Index of the first Bone target (if any).
targetB Unique Object id of the second target.
target_boneB Index of the second Bone target (if any).
equilibrium Normalized value from -1 to 1 pushing the equilibrium point either on the left or the right.

ProportionalConstraint


Name Description
local_space Determine if the clamping should be effectuated in local space (else world space).
lowest Use the lowest scale instead of the biggest (default).

CopyConstraint


Name Description
target The unique id of the Object to track.
target_bone The target Bone index to track.
local_space Force the transformation to be assigned in local space instead of world space (default).

SetConstraint


Name Description
local_space Apply the transformation vector in local space.
axis_x Determine whether or not to affect the X axis.
axis_y Determine whether or not to affect the Y axis.
axis_z Determine whether or not to affect the Z axis.
vector The vector to use to replace the appropriate transformation part (either location, rotation or scale).

SetQuaternionConstraint


Name Description
local_space Apply the offset in local space.
normalize Normalize the quaternion offset.
axis_x Determine whether or not to affect the X rotational axis.
axis_y Determine whether or not to affect the Y rotational axis.
axis_z Determine whether or not to affect the Z rotational axis.
axis_w Determine whether or not to affect the W rotational axis.
quaternion The rotational part of the transformation to replace using a quaternion.

OffsetConstraint


Name Description
local_space Apply the offset in local space.
offset Amount of offset for each axis.

OffsetQuaternionConstraint


Name Description
local_space Apply the offset in local space.
normalize Normalize the quaternion offset.
offset The amount of rotational offset specified as a quaternion.

OffsetDirectionConstraint


Name Description
target The unique id of the Object to keep distance from.
target_bone The target Bone index to offset the distance from (if any).
local_space Determine if the transformation is applied in local space or world space.
distance The directional offset distance.

BillboardAlignConstraint


Name Description
target The target Object id.
target_bone The target Bone index.
spherical Force the billboard to be spherically aligned; else it will be cylindrical.

AccelerationAlignConstraint


Name Description
rotation_x Enable/disable rotational alignment on the X axis.
rotation_z Enable/disable rotational alignment on the Z axis.

FollowRouteConstraint


Name Description
target The unique id of the Route Object to follow.
interpolation Set the interpolation value along the Route curve.

FollowRailConstraint


Name Description
target The unique id of the Route Object to use as a rail.

FollowLimitsConstraint


Name Description
target Unique id of the Route that prevent the parent Object to stays within the Curve limit.
weight The weight factor the Route of Curve apply on the parent Object transformation.

LerpConstraint


Name Description
interpolation The interpolation factor to apply to the parent Object transformation.

LerpRotationConstraint


Name Description
interpolation The interpolation factor to apply to the parent Object rotational part of the transformation.

InverseKinematicsConstraint


Name Description
target Id of the SkeletalMesh Object to used to apply the inverse kinematic.
target_bone The Bone index representing the starting point of the kinematic chain.
chain_length The number of upper level parent bone in the kinematic chain.
continuous Force the kinematic solver to continuously resolve the chain.
generic_solver Force the system to use a generic solver. If disabled, an optimized version based on the length of the chain will be used.
max_iterations Maximum amount of iterations the solver should evaluate before exiting.
position_weight Weight factor to smooth the positions.
rotation_weight Factor to used to smooth the chain rotation(s).
weight_nlerp Enable limbs interpolation to simulate more realistic movements.
joint_rotations Enable/disable solving joints rotations.
stretch_node Force nodes position to be "stretched" to reach the goal position.
rotate_node Force the node attached to the effector to be rotated.
align_node Force the node to be aligned with the effector rotation.

ConstraintData


Structure allowing you to access and manipulate the different properties and settings of the active Constraint.

Static Variables


Name Description
type The ConstraintType of the active Constraint.
track_to Access the TrackToConstraint properties of a kTrackTo Constraint.
track_axis Access the TrackAxisConstraint properties of a kTrackAxis Constraint.
track_lock Access the TrackLockConstraint properties of a kTrackLock Constraint.
track_target Access the TrackTargetConstraint properties of a kTrackTarget Constraint.
track_objectgroup Access the TrackObjectGroupConstraint properties of a kTrackObjectGroup Constraint.
clamp_location Access the ClampConstraint properties of a kClampLocation Constraint.
clamp_rotation Access the ClampRotationConstraint properties of a kClampRotation Constraint.
clamp_quaternion Access the ClampQuaternionConstraint properties of a kClampQuaternion Constraint.
clamp_scale Access the ClampConstraint properties of a kClampScale Constraint.
clamp_distance Access the ClampDistanceConstraint properties of a kClampDistance Constraint.
clamp_middle Access the ClampMiddleConstraint properties of a kClampMiddle Constraint.
proportional Access the ProportionalConstraint properties of a kProportional Constraint.
copy_location Access the CopyConstraint properties of a kCopyLocation Constraint.
copy_rotation Access the CopyConstraint properties of a kCopyRotation Constraint.
copy_quaternion Access the CopyConstraint properties of a kCopyQuaternion Constraint.
copy_scale Access the CopyConstraint properties of a kCopyScale Constraint.
copy_transform Access the CopyConstraint properties of a kCopyTransform Constraint.
set_location Access the SetConstraint properties of a kSetLocation Constraint.
set_rotation Access the SetConstraint properties of a kSetRotation Constraint.
set_quaternion Access the SetQuaternionConstraint properties of a kSetQuaternion Constraint.
set_scale Access the SetConstraint properties of a kSetScale Constraint.
offset_location Access the OffsetConstraint properties of a kOffsetLocation Constraint.
offset_rotation Access the OffsetConstraint properties of a kOffsetRotation Constraint.
offset_quaternion Access the OffsetQuaternionConstraint properties of a kOffsetQuaternion Constraint.
offset_scale Access the OffsetConstraint properties of a kOffsetScale Constraint.
billboard_align Access the BillboardAlignConstraint properties of a kBillboardAlign Constraint.
acceleration_align Access the AccelerationAlignConstraint properties of a kAccelerationAlign Constraint.
follow_route Access the FollowRouteConstraint properties of a kFollowRoute Constraint.
follow_rail Access the FollowRailConstraint properties of a kFollowRail Constraint.
follow_limits Access the FollowLimitsConstraint properties of a kFollowLimits Constraint.
lerp_location Access the LerpConstraint properties of a kLerpLocation Constraint.
lerp_rotation Access the LerpRotationConstraint properties of a kLerpRotation Constraint.
lerp_scale Access the LerpConstraint properties of a kLerpScale Constraint.
lerp_acceleration Access the LerpConstraint properties of a kLerpAcceleration Constraint.
inverse_kinematics Access the InverseKinematicsConstraint properties of a kInverseKinematics Constraint.
Attention
If you are trying to access a Constraint properties different from the ConstraintType the active Constraint was created with the value of the member variable will be nil.




NRG - API 2022.4.384543 - Fri Nov 4 2022
Copyright © 2022 nrgcore.com. All Rights Reserved. Terms of Service - Privacy Policy - EULA