FConstraintInstance

Container for a physics representation of an object.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/PhysicsEngine/ConstraintInstance.h

Include

#include "PhysicsEngine/ConstraintInstance.h"

Syntax

struct FConstraintInstance

Remarks

Container for a physics representation of an object.

Variables

Name Description

Public variable

FRotator

 

AngularRotationOffset

Specifies the angular offset between the two frames of reference.

Public variable

float

 

AverageMass

Public variable

uint32: 1

 

bScaleLinearLimits

If true, linear limits scale using the absolute min of the 3d scale of the owning component

Public variable

FName

 

ConstraintBone1

Name of first bone (body) that this constraint is connecting.

Public variable

FName

 

ConstraintBone2

Name of second bone (body) that this constraint is connecting.

Public variable

FPhysicsConstra...

 

ConstraintHandle

Internal physics constraint representation.

Public variable

int32

 

ConstraintIndex

Indicates position of this constraint within the array in SkeletalMeshComponent.

Public variable

FName

 

JointName

Name of bone that this joint is associated with.

Public variable

FPhysScene *...

 

PhysScene

Public variable

FPhysxUserData

 

PhysxUserData

Public variable

FVector

 

Pos1

Location of constraint in Body1 reference frame (usually the "child" body for skeletal meshes).

Public variable

FVector

 

Pos2

Location of constraint in Body2 reference frame (usually the "parent" body for skeletal meshes).

Public variable

FVector

 

PriAxis1

Primary (twist) axis in Body1 reference frame.

Public variable

FVector

 

PriAxis2

Primary (twist) axis in Body2 reference frame.

Public variable

FConstraintProf...

 

ProfileInstance

Constraint Data (properties easily swapped at runtime based on different constraint profiles)

Public variable

FVector

 

SecAxis1

Seconday axis in Body1 reference frame. Orthogonal to PriAxis1.

Public variable

FVector

 

SecAxis2

Seconday axis in Body2 reference frame. Orthogonal to PriAxis2.

Constructors

Name Description

Public function

FConstraintInstance()

Constructor

Functions

Name Description

Public function Static

FConstraintI...

 

Alloc()

Public function

void

 

CopyConstraintGeometryFrom

(
    const FConstraintInstance* Fro...
)

Public function

void

 

CopyConstraintParamsFrom

(
    const FConstraintInstance* Fro...
)

Public function

void

 

CopyProfilePropertiesFrom

(
    const FConstraintProfileProperties ...
)

Copies behavior properties from the given profile.

Public function

void

 

DisableParentDominates()

Public function

void

 

DisableProjection()

Turn off linear and angular projection

Public function Const

void

 

DrawConstraint

(
    FPrimitiveDrawInterface* PDI,
    float Scale,
    float LimitDrawScale,
    bool bDrawLimits,
    bool bDrawSelected,
    const FTransform& Con1Frame,
    const FTransform& Con2Frame,
    bool bDrawAsPoint
)

Public function Const

void

 

DrawConstraint

(
    int32 ViewIndex,
    FMeshElementCollector& Collector,
    float Scale,
    float LimitDrawScale,
    bool bDrawLimits,
    bool bDrawSelected,
    const FTransform& Con1Frame,
    const FTransform& Con2Frame,
    bool bDrawAsPoint
)

Public function

void

 

EnableParentDominates()

Enable/Disable parent dominates (meaning the parent body cannot be be affected at all by a child)

Public function

void

 

EnableProjection()

Turn on linear and angular projection

Public function Static

void

 

Free

(
    FConstraintInstance* Ptr
)

Hacks to easily get zeroed memory for special case when we don't use GC.

Public function Const

float

 

GetAngularSwing1Limit()

Gets the cone limit swing1 angle in degrees

Public function Const

EAngularCons...

 

GetAngularSwing1Motion()

Gets the motion type for the swing1 of the cone constraint

Public function Const

float

 

GetAngularSwing2Limit()

Gets the cone limit swing2 angle in degrees

Public function Const

EAngularCons...

 

GetAngularSwing2Motion()

Gets the motion type for the swing2 of the cone constraint

Public function Const

float

 

GetAngularTwistLimit()

Gets the twist limit angle in degrees

Public function Const

EAngularCons...

 

GetAngularTwistMotion()

Gets the motion type for the twist of the cone constraint

Public function

void

 

GetConstraintForce

(
    FVector& OutLinearForce,
    FVector& OutAngularForce
)

Retrieve the constraint force most recently applied to maintain this constraint. Returns 0 forces if the constraint is not initialized or broken.

Public function

FVector

 

GetConstraintLocation()

Get the position of this constraint in world space.

Public function Const

float

 

GetCurrentSwing1()

The current swing1 of the constraint.

Public function Const

float

 

GetCurrentSwing2()

The current swing2 of the constraint.

Public function Const

float

 

GetCurrentTwist()

The current twist of the constraint.

Public function Const

bool

 

GetIsSoftLinearLimit()

Whether the linear limits are soft (only if at least one axis if Limited)

Public function Const

bool

 

GetIsSoftSwingLimit()

Whether the swing limits are soft (only available if swing1 and/or swing2 is Limited)

Public function Const

bool

 

GetIsSoftTwistLimit()

Whether the twist limits are soft (only available if twist is Limited)

Public function Const

float

 

GetLastKnownScale()

Public function Const

float

 

GetLinearLimit()

Gets the linear limit size

Public function Const

ELinearConst...

 

GetLinearXMotion()

Gets the motion type for the linear X-axis limit.

Public function Const

ELinearConst...

 

GetLinearYMotion()

Gets the motion type for the linear Y-axis limit.

Public function Const

ELinearConst...

 

GetLinearZMotion()

Gets the motion type for the linear Z-axis limit.

Public function Const

const FPhysi...

 

GetPhysicsConstraintRef()

Get underlying physics engine constraint

Public function Const

FTransform

 

GetRefFrame

(
    EConstraintFrame::Type Frame
)

Get component ref frame.

Public function Const

float

 

GetSoftLinearLimitDamping()

Linear damping if the constraint is set to use soft linear limits

Public function Const

float

 

GetSoftLinearLimitStiffness()

Linear stiffness if the constraint is set to use soft linear limits

Public function Const

float

 

GetSoftSwingLimitDamping()

Swing damping if the constraint is set to use soft limits

Public function Const

float

 

GetSoftSwingLimitStiffness()

Swing stiffness if the constraint is set to use soft limits

Public function Const

float

 

GetSoftTwistLimitDamping()

Twist damping if the constraint is set to use soft limits

Public function Const

float

 

GetSoftTwistLimitStiffness()

Twist stiffness if the constraint is set to use soft limits

Public function

void

 

GetUsedMaterials

(
    TArray< UMaterialInterface* > ...
)

Public function

void

 

InitConstraint

(
    FBodyInstance* Body1,
    FBodyInstance* Body2,
    float Scale,
    UObject* DebugOwner,
    FOnConstraintBroken InConstraintBro...
)

Create physics engine constraint.

Public function

void

 

InitConstraint_AssumesLocked

(
    const FPhysicsActorHandle& ActorRe...,
    const FPhysicsActorHandle& ActorRe...,
    float InScale,
    FOnConstraintBroken InConstraintBro...
)

Create physics engine constraint using physx actors.

Public function Const

bool

 

IsAngularOrientationDriveEnabled()

Whether the angular orientation drive is enabled

Public function Const

bool

 

IsAngularVelocityDriveEnabled()

Whether the angular velocity drive is enabled

Public function

bool

 

IsBroken()

Retrieve the status of constraint being broken.

Public function Const

bool

 

IsCollisionDisabled()

Whether collision is currently disabled

Public function Const

bool

 

IsLinearPositionDriveEnabled()

Whether the linear position drive is enabled

Public function Const

bool

 

IsLinearVelocityDriveEnabled()

Whether the linear velocity drive is enabled

Public function Const

bool

 

IsParentDominatesEnabled()

Whether parent domination is enabled (meaning the parent body cannot be be affected at all by a child)

Public function Const

bool

 

IsProjectionEnabled()

Whether projection is enabled for this constraint

Public function Const

bool

 

IsTerminated()

Whether the physics engine constraint has been terminated

Public function Const

bool

 

IsValidConstraintInstance()

See if this constraint is valid.

Public function

void

 

PostSerialize

(
    const FArchive& Ar
)

Public function

bool

 

Serialize

(
    FArchive& Ar
)

Public function

void

 

SetAngularBreakable

(
    bool bInAngularBreakable,
    float InAngularBreakThreshold
)

Sets the Angular Breakable properties

Public function

void

 

SetAngularDOFLimitScale

(
    float InSwing1LimitScale,
    float InSwing2LimitScale,
    float InTwistLimitScale
)

Scale Angular Limit Constraints (as defined in RB_ConstraintSetup).

Public function

void

 

SetAngularDriveMode

(
    EAngularDriveMode::Type DriveMode
)

Set the angular drive mode

Public function

void

 

SetAngularDriveParams

(
    float InSpring,
    float InDamping,
    float InForceLimit
)

Set the angular drive's strength parameters

Function for setting angular motor parameters.

Public function

void

 

SetAngularOrientationTarget

(
    const FQuat& InPosTarget
)

Set the angular drive's orientation target

Function for setting target angular position.

Public function

void

 

SetAngularSwing1Limit

(
    EAngularConstraintMotion MotionType,
    float InSwing1LimitAngle
)

Sets the Angular Swing1 Motion Type

Public function

void

 

SetAngularSwing1Motion

(
    EAngularConstraintMotion MotionType
)

Sets the cone limit's swing1 motion type

Public function

void

 

SetAngularSwing2Limit

(
    EAngularConstraintMotion MotionType,
    float InSwing2LimitAngle
)

Sets the Angular Swing2 Motion Type

Public function

void

 

SetAngularSwing2Motion

(
    EAngularConstraintMotion MotionType
)

Sets the cone limit's swing2 motion type

Public function

void

 

SetAngularTwistLimit

(
    EAngularConstraintMotion MotionType,
    float InTwistLimitAngle
)

Sets the Angular Twist Motion Type

Public function

void

 

SetAngularTwistMotion

(
    EAngularConstraintMotion MotionType
)

Sets the twist limit's motion type

Public function

void

 

SetAngularVelocityDriveSLERP

(
    bool bInEnableSLERP
)

Set whether the SLERP angular velocity drive is enabled.

Public function

void

 

SetAngularVelocityDriveTwistAndSwing

(
    bool bInEnableTwistDrive,
    bool bInEnableSwingDrive
)

Set which twist and swing angular velocity drives are enabled.

Public function

void

 

SetAngularVelocityTarget

(
    const FVector& InVelTarget
)

Set the angular drive's angular velocity target

Function for setting target angular velocity.

Public function

void

 

SetConstraintBrokenDelegate

(
    FOnConstraintBroken InConstraintBro...
)

Set teh constraint broken delegate.

Public function

void

 

SetDisableCollision

(
    bool InDisableCollision
)

Set whether jointed actors can collide with each other

Public function

void

 

SetLinearBreakable

(
    bool bInLinearBreakable,
    float InLinearBreakThreshold
)

Sets the Linear Breakable properties

Public function

void

 

SetLinearDriveParams

(
    float InPositionStrength,
    float InVelocityStrength,
    float InForceLimit
)

Set the linear drive's strength parameters

Function for setting linear motor parameters.

Public function

void

 

SetLinearLimitSize

(
    float NewLimitSize
)

Allows you to dynamically change the size of the linear limit 'sphere'.

Public function

void

 

SetLinearPositionDrive

(
    bool bEnableXDrive,
    bool bEnableYDrive,
    bool bEnableZDrive
)

Set which linear position drives are enabled

Public function

void

 

SetLinearPositionTarget

(
    const FVector& InPosTarget
)

Set the linear drive's target position position

Function for setting linear position target.

Public function

void

 

SetLinearVelocityDrive

(
    bool bEnableXDrive,
    bool bEnableYDrive,
    bool bEnableZDrive
)

Set which linear velocity drives are enabled

Public function

void

 

SetLinearVelocityTarget

(
    const FVector& InVelTarget
)

Set the linear drive's target velocity

Function for setting linear velocity target.

Public function

void

 

SetLinearXLimit

(
    ELinearConstraintMotion ConstraintT...,
    float InLinearLimitSize
)

Sets the LinearX Motion Type and the limit distance (Note distance is the same for all 3 axes)

Public function

void

 

SetLinearXMotion

(
    ELinearConstraintMotion ConstraintT...
)

Sets the Linear XMotion type

Public function

void

 

SetLinearYLimit

(
    ELinearConstraintMotion ConstraintT...,
    float InLinearLimitSize
)

Sets the LinearY Motion Type and the limit distance (Note distance is the same for all 3 axes)

Public function

void

 

SetLinearYMotion

(
    ELinearConstraintMotion ConstraintT...
)

Sets the Linear YMotion type

Public function

void

 

SetLinearZLimit

(
    ELinearConstraintMotion ConstraintT...,
    float InLinearLimitSize
)

Sets the LinearZ Motion Type and the limit distance (Note distance is the same for all 3 axes)

Public function

void

 

SetLinearZMotion

(
    ELinearConstraintMotion ConstraintT...
)

Sets the Linear ZMotion type

Public function

void

 

SetOrientationDriveSLERP

(
    bool bInEnableSLERP
)

Set whether the SLERP angular position drive is enabled.

Public function

void

 

SetOrientationDriveTwistAndSwing

(
    bool bInEnableTwistDrive,
    bool bInEnableSwingDrive
)

Set which twist and swing orientation drives are enabled.

Public function

void

 

SetRefFrame

(
    EConstraintFrame::Type Frame,
    const FTransform& RefFrame
)

Pass in reference frame in. If the constraint is currently active, this will set its active local pose. Otherwise the change will take affect in InitConstraint.

Public function

void

 

SetRefOrientation

(
    EConstraintFrame::Type Frame,
    const FVector& PriAxis,
    const FVector& SecAxis
)

Pass in reference orientation in (maintains reference position). If the constraint is currently active, this will set its active local pose. Otherwise the change will take affect in InitConstraint.

Public function

void

 

SetRefPosition

(
    EConstraintFrame::Type Frame,
    const FVector& RefPosition
)

Pass in reference position in (maintains reference orientation). If the constraint is currently active, this will set its active local pose. Otherwise the change will take affect in InitConstraint.

Public function

void

 

TermConstraint()

Terminate physics engine constraint

Public function

void

 

UpdateAngularLimit()

Refreshes the physics engine joint's angular limits.

Public function

void

 

UpdateLinearLimit()

Refreshes the physics engine joint's linear limits.

Deprecated Variables

Name Description

Public variable

float

 

AngularBreakThreshold_DEPRECATED

Public variable

float

 

AngularDriveDamping_DEPRECATED

Public variable

float

 

AngularDriveForceLimit_DEPRECATED

Public variable

TEnumAsByte< EA...

 

AngularDriveMode_DEPRECATED

Public variable

float

 

AngularDriveSpring_DEPRECATED

Public variable

FRotator

 

AngularOrientationTarget_DEPRECATED

Public variable

FQuat

 

AngularPositionTarget_DEPRECATED

Public variable

TEnumAsByte< en...

 

AngularSwing1Motion_DEPRECATED

Public variable

TEnumAsByte< en...

 

AngularSwing2Motion_DEPRECATED

Public variable

TEnumAsByte< en...

 

AngularTwistMotion_DEPRECATED

Public variable

FVector

 

AngularVelocityTarget_DEPRECATED

Public variable

uint32: 1

 

bAngularBreakable_DEPRECATED

Public variable

uint32: 1

 

bAngularOrientationDrive_DEPRECATED

Public variable

uint32: 1

 

bAngularSlerpDrive_DEPRECATED

Public variable

uint32: 1

 

bAngularVelocityDrive_DEPRECATED

Public variable

uint32: 1

 

bDisableCollision_DEPRECATED

DEPRECATED Most of these properties have moved inside the ProfileInstance member (FConstraintProfileProperties struct)

Public variable

uint32: 1

 

bEnableProjection_DEPRECATED

Public variable

uint32: 1

 

bLinearBreakable_DEPRECATED

Public variable

uint32: 1

 

bLinearLimitSoft_DEPRECATED

Public variable

uint32: 1

 

bLinearPositionDrive_DEPRECATED

Public variable

uint32: 1

 

bLinearVelocityDrive_DEPRECATED

Public variable

uint32: 1

 

bSwingLimitSoft_DEPRECATED

Public variable

uint32: 1

 

bSwingPositionDrive_DEPRECATED

Public variable

uint32: 1

 

bSwingVelocityDrive_DEPRECATED

Public variable

uint32: 1

 

bTwistLimitSoft_DEPRECATED

Public variable

uint32: 1

 

bTwistPositionDrive_DEPRECATED

Public variable

uint32: 1

 

bTwistVelocityDrive_DEPRECATED

Public variable

float

 

LinearBreakThreshold_DEPRECATED

Public variable

float

 

LinearDriveDamping_DEPRECATED

Public variable

float

 

LinearDriveForceLimit_DEPRECATED

Public variable

float

 

LinearDriveSpring_DEPRECATED

Public variable

float

 

LinearLimitDamping_DEPRECATED

Public variable

float

 

LinearLimitSize_DEPRECATED

Public variable

float

 

LinearLimitStiffness_DEPRECATED

Public variable

FVector

 

LinearPositionTarget_DEPRECATED

Public variable

FVector

 

LinearVelocityTarget_DEPRECATED

Public variable

TEnumAsByte< en...

 

LinearXMotion_DEPRECATED

Public variable

TEnumAsByte< en...

 

LinearYMotion_DEPRECATED

Public variable

TEnumAsByte< en...

 

LinearZMotion_DEPRECATED

Public variable

float

 

ProjectionAngularTolerance_DEPRECATED

Public variable

float

 

ProjectionLinearTolerance_DEPRECATED

Public variable

float

 

Swing1LimitAngle_DEPRECATED

Public variable

float

 

Swing2LimitAngle_DEPRECATED

Public variable

float

 

SwingLimitDamping_DEPRECATED

Public variable

float

 

SwingLimitStiffness_DEPRECATED

Public variable

float

 

TwistLimitAngle_DEPRECATED

Public variable

float

 

TwistLimitDamping_DEPRECATED

Public variable

float

 

TwistLimitStiffness_DEPRECATED

Deprecated Functions

Name Description

Public function

void

 

SetAngularPositionDrive

(
    bool bInEnableSwingDrive,
    bool bInEnableTwistDrive
)

Please call SetOrientationDriveTwistAndSwing. Note the order of bools is reversed (Make sure to pass Twist and then Swing)

Public function

void

 

SetAngularVelocityDrive

(
    bool bInEnableSwingDrive,
    bool bInEnableTwistDrive
)

Please call SetAngularVelocityDriveTwistAndSwing. Note the order of bools is reversed (Make sure to pass Twist and then Swing)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss