UPhysicsConstraintComponent

This is effectively a joint that allows you to connect 2 rigid bodies together.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

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

Include

#include "PhysicsEngine/PhysicsConstraintComponent.h"

Syntax

class UPhysicsConstraintComponent : public USceneComponent

Remarks

This is effectively a joint that allows you to connect 2 rigid bodies together. You can create different types of joints using the various parameters of this component.

Variables

Name Description

Public variable

FConstrainCompo...

 

ComponentName1

Name of first component property to constrain.

Public variable

FConstrainCompo...

 

ComponentName2

Name of second component property to constrain.

Public variable

AActor *

 

ConstraintActor1

Pointer to first Actor to constrain.

Public variable

AActor *

 

ConstraintActor2

Pointer to second Actor to constrain.

Public variable

FConstraintInst...

 

ConstraintInstance

All constraint settings

Public variable

FConstraintBrok...

 

OnConstraintBroken

Notification when constraint is broken.

Public variable

TWeakObjectPtr<...

 

OverrideComponent1

Allows direct setting of first component to constraint.

Public variable

TWeakObjectPtr<...

 

OverrideComponent2

Allows direct setting of second component to constraint.

Constructors

Name Description

Public function

UPhysicsConstraintComponent

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

BreakConstraint()

Break this constraint

Public function Const

FBox

 

GetBodyBox

(
    EConstraintFrame::Type Frame
)

Get body bounding box. Works without constraint being created

Protected function Const

FBox

 

GetBodyBoxInternal

(
    EConstraintFrame::Type Frame,
    FName InBoneName
)

Internal util to get body box from actor/component name/bone name information

Protected function Const

FBodyInstanc...

 

GetBodyInstance

(
    EConstraintFrame::Type Frame
)

Get the body instance that we want to constrain to

Public function Const

FTransform

 

GetBodyTransform

(
    EConstraintFrame::Type Frame
)

Get the body frame. Works without constraint being created

Protected function Const

FTransform

 

GetBodyTransformInternal

(
    EConstraintFrame::Type Frame,
    FName InBoneName
)

Internal util to get body transform from actor/component name/bone name information

Protected function Const

UPrimitiveCo...

 

GetComponentInternal

(
    EConstraintFrame::Type Frame
)

Internal util to get component from actor/component name

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.

Protected function Const

float

 

GetConstraintScale()

Returns the scale of the constraint as it will be passed into the ConstraintInstance

Public function Const

float

 

GetCurrentSwing1()

Gets the current Swing1 of the constraint

Public function Const

float

 

GetCurrentSwing2()

Gets the current Swing2 of the constraint

Public function Const

float

 

GetCurrentTwist()

Gets the current Angular Twist of the constraint

Public function

void

 

InitComponentConstraint()

Initialize the frames and creates constraint

Public function

bool

 

IsBroken()

Retrieve the status of constraint being broken.

Protected function

void

 

OnConstraintBrokenHandler

(
    FConstraintInstance* BrokenCon...
)

Routes the FConstraint callback to the dynamic delegate

Public function

void

 

SetAngularBreakable

(
    bool bAngularBreakable,
    float AngularBreakThreshold
)

Sets the Angular Breakable properties

Public function

void

 

SetAngularDriveMode

(
    EAngularDriveMode::Type DriveMode
)

Switches the angular drive mode between SLERP and Twist And Swing

Public function

void

 

SetAngularDriveParams

(
    float PositionStrength,
    float VelocityStrength,
    float InForceLimit
)

Sets the drive params for the angular drive.

Public function

void

 

SetAngularOrientationDrive

(
    bool bEnableSwingDrive,
    bool bEnableTwistDrive
)

Enables/Disables angular orientation drive.

Public function

void

 

SetAngularOrientationTarget

(
    const FRotator& InPosTarget
)

Sets the target orientation for the angular drive.

Public function

void

 

SetAngularSwing1Limit

(
    EAngularConstraintMotion MotionType,
    float Swing1LimitAngle
)

Sets the Angular Swing1 Motion Type

Public function

void

 

SetAngularSwing2Limit

(
    EAngularConstraintMotion MotionType,
    float Swing2LimitAngle
)

Sets the Angular Swing2 Motion Type

Public function

void

 

SetAngularTwistLimit

(
    EAngularConstraintMotion Constraint...,
    float TwistLimitAngle
)

Sets the Angular Twist Motion Type

Public function

void

 

SetAngularVelocityDrive

(
    bool bEnableSwingDrive,
    bool bEnableTwistDrive
)

Public function

void

 

SetAngularVelocityDriveSLERP

(
    bool bEnableSLERP
)

Enables/Disables the angular velocity slerp drive.

Public function

void

 

SetAngularVelocityDriveTwistAndSwing

(
    bool bEnableTwistDrive,
    bool bEnableSwingDrive
)

Enables/Disables angular velocity twist and swing drive.

Public function

void

 

SetAngularVelocityTarget

(
    const FVector& InVelTarget
)

Sets the target velocity for the angular drive.

Public function

void

 

SetConstrainedComponents

(
    UPrimitiveComponent* Component...,
    FName BoneName1,
    UPrimitiveComponent* Component...,
    FName BoneName2
)

Directly specify component to connect. Will update frames based on current position.

Public function

void

 

SetConstraintReferenceFrame

(
    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

 

SetConstraintReferenceOrientation

(
    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

 

SetConstraintReferencePosition

(
    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

 

SetDisableCollision

(
    bool bDisableCollision
)

If true, the collision between the two rigid bodies of the constraint will be disabled.

Public function

void

 

SetLinearBreakable

(
    bool bLinearBreakable,
    float LinearBreakThreshold
)

Sets the Linear Breakable properties

Public function

void

 

SetLinearDriveParams

(
    float PositionStrength,
    float VelocityStrength,
    float InForceLimit
)

Sets the drive params for the linear drive.

Public function

void

 

SetLinearPositionDrive

(
    bool bEnableDriveX,
    bool bEnableDriveY,
    bool bEnableDriveZ
)

Enables/Disables linear position drive

Public function

void

 

SetLinearPositionTarget

(
    const FVector& InPosTarget
)

Sets the target position for the linear drive.

Public function

void

 

SetLinearVelocityDrive

(
    bool bEnableDriveX,
    bool bEnableDriveY,
    bool bEnableDriveZ
)

Enables/Disables linear position drive

Public function

void

 

SetLinearVelocityTarget

(
    const FVector& InVelTarget
)

Sets the target velocity for the linear drive.

Public function

void

 

SetLinearXLimit

(
    ELinearConstraintMotion ConstraintT...,
    float LimitSize
)

Sets the LinearX Motion Type

Public function

void

 

SetLinearYLimit

(
    ELinearConstraintMotion ConstraintT...,
    float LimitSize
)

Sets the LinearY Motion Type

Public function

void

 

SetLinearZLimit

(
    ELinearConstraintMotion ConstraintT...,
    float LimitSize
)

Sets the LinearZ Motion Type

Public function

void

 

SetOrientationDriveSLERP

(
    bool bEnableSLERP
)

Enables/Disables the angular orientation slerp drive.

Public function

void

 

SetOrientationDriveTwistAndSwing

(
    bool bEnableTwistDrive,
    bool bEnableSwingDrive
)

Enables/Disables angular orientation drive.

Public function

void

 

TermComponentConstraint()

Break the constraint

Public function

void

 

UpdateConstraintFrames()

Update the reference frames held inside the constraint that indicate the joint location in the reference frame of the two connected bodies.

Public function

void

 

UpdateSpriteTexture()

Overridden from USceneComponent

Name Description

Public function Virtual

void

 

PostEditComponentMove

(
    bool bFinished
)

Called when this component is moved in the editor

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

CheckForErrors()

Function that gets called from within Map_Check to allow this actor component to check itself for any potential errors and register them with map check dialog.

Public function Virtual

void

 

InitializeComponent()

Initializes the component.

Public function Virtual

void

 

OnRegister()

Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called.

Public function Virtual

void

 

OnUnregister()

Called when a component is unregistered.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual

void

 

PostEditChangeChainProperty

(
    FPropertyChangedChainEvent& Proper...
)

This alternate version of PostEditChange is called when properties inside structs are modified.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Deprecated Variables

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