UPhysicsConstraintComponent

Inheritance Hierarchy

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

FBox

 

GetBodyBox

(
    EConstraintFrame::Type Frame
)

Get body bounding box. Works without constraint being created

Protected function

FBox

 

GetBodyBoxInternal

(
    EConstraintFrame::Type Frame,
    FName InBoneName
)

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

Protected function

FBodyInstanc ...

 

GetBodyInstance

(
    EConstraintFrame::Type Frame
)

Get the body instance that we want to constrain to

Public function

FTransform

 

GetBodyTransform

(
    EConstraintFrame::Type Frame
)

WITH_EDITOR.

Protected function

FTransform

 

GetBodyTransformInternal

(
    EConstraintFrame::Type Frame,
    FName InBoneName
)

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

Protected function

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

float

 

GetConstraintScale()

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

Public function

float

 

GetCurrentSwing1()

Gets the current Swing1 of the constraint

Public function

float

 

GetCurrentSwing2()

Gets the current Swing2 of the constraint

Public function

float

 

GetCurrentTwist()

Gets the current Angular Twist of the constraint

Public function

void

 

InitComponentConstraint()

Initialize the frames and creates constraint

Protected function

void

 

OnConstraintBrokenHandler

(
    FConstraintInstance * BrokenCon...
)

Routes the FConstraint callback to the dynamic delegate

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

 

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
)

WITH_EDITOR.

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()

WITH_EDITOR.

Public function

void

 

UpdateSpriteTexture()

Overridden from USceneComponent

Name Description

Public function Virtual

void

 

PostEditComponentMove

(
    bool bFinished
)

End ActorComponent interface.

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

CheckForErrors()

End UObject interface.

Public function Virtual

void

 

InitializeComponent()

Initializes the component.

Public function Virtual

void

 

OnRegister()

WITH_EDITOR.

Public function Virtual

void

 

OnUnregister()

WITH_EDITOR.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Begin UObject Interface.

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, and immediately after any undo/redo.

References

Module

Engine

Header

Runtime/Engine/Classes/PhysicsEngine/PhysicsConstraintComponent.h