Navigation
API > API/Runtime > API/Runtime/Engine
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.
| Name | UPhysicsConstraintComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/PhysicsEngine/PhysicsConstraintComponent.h |
| Include Path | #include "PhysicsEngine/PhysicsConstraintComponent.h" |
Syntax
UCLASS (ClassGroup=Physics, Meta=(BlueprintSpawnableComponent),
HideCategories=(Activation, "Components|Activation", Physics, Mobility),
ShowCategories=("Physics|Components|PhysicsConstraint"), MinimalAPI)
class UPhysicsConstraintComponent : public USceneComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → UPhysicsConstraintComponent
Implements Interfaces
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UPhysicsConstraintComponent
(
const FObjectInitializer& ObjectInitializer |
PhysicsEngine/PhysicsConstraintComponent.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ComponentName1 | FConstrainComponentPropName | Name of first component property to constrain. | PhysicsEngine/PhysicsConstraintComponent.h |
|
| ComponentName2 | FConstrainComponentPropName | Name of second component property to constrain. | PhysicsEngine/PhysicsConstraintComponent.h |
|
| ConstraintActor1 | TObjectPtr< AActor > | Pointer to first Actor to constrain. | PhysicsEngine/PhysicsConstraintComponent.h |
|
| ConstraintActor2 | TObjectPtr< AActor > | Pointer to second Actor to constrain. | PhysicsEngine/PhysicsConstraintComponent.h |
|
| ConstraintInstance | FConstraintInstance | All constraint settings | PhysicsEngine/PhysicsConstraintComponent.h |
|
| OnConstraintBroken | FConstraintBrokenSignature | Notification when constraint is broken. | PhysicsEngine/PhysicsConstraintComponent.h |
|
| OnPlasticDeformation | FPlasticDeformationEventSignature | Notification when constraint plasticity drive target changes. | PhysicsEngine/PhysicsConstraintComponent.h |
|
| OverrideComponent1 | TWeakObjectPtr< UPrimitiveComponent > | Allows direct setting of first component to constraint. | PhysicsEngine/PhysicsConstraintComponent.h | |
| OverrideComponent2 | TWeakObjectPtr< UPrimitiveComponent > | Allows direct setting of second component to constraint. | PhysicsEngine/PhysicsConstraintComponent.h |
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bIsBrokenLocal | bool | PhysicsEngine/PhysicsConstraintComponent.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void BreakConstraint() |
Break this constraint | PhysicsEngine/PhysicsConstraintComponent.h |
|
FBox GetBodyBox
(
EConstraintFrame::Type Frame |
Get body bounding box. Works without constraint being created | PhysicsEngine/PhysicsConstraintComponent.h | |
FTransform GetBodyTransform
(
EConstraintFrame::Type Frame |
Get the body frame. Works without constraint being created | PhysicsEngine/PhysicsConstraintComponent.h | |
void GetConstrainedComponents
(
UPrimitiveComponent*& OutComponent1, |
Get connected components and potential related attachement bones | PhysicsEngine/PhysicsConstraintComponent.h |
|
FConstraintInstanceAccessor GetConstraint() |
Gets the constraint object | PhysicsEngine/PhysicsConstraintComponent.h |
|
void GetConstraintForce
(
FVector& OutLinearForce, |
Retrieve the constraint force most recently applied to maintain this constraint. Returns 0 forces if the constraint is not initialized or broken. | PhysicsEngine/PhysicsConstraintComponent.h |
|
float GetCurrentSwing1() |
Gets the current Swing1 of the constraint | PhysicsEngine/PhysicsConstraintComponent.h |
|
float GetCurrentSwing2() |
Gets the current Swing2 of the constraint | PhysicsEngine/PhysicsConstraintComponent.h |
|
float GetCurrentTwist() |
Gets the current Angular Twist of the constraint | PhysicsEngine/PhysicsConstraintComponent.h |
|
void InitComponentConstraint() |
Initialize the frames and creates constraint | PhysicsEngine/PhysicsConstraintComponent.h | |
bool IsBroken() |
Retrieve the status of constraint being broken. | PhysicsEngine/PhysicsConstraintComponent.h |
|
bool IsProjectionEnabled() |
Is projection enabled. See SetProjectionEnabled. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularBreakable
(
bool bAngularBreakable, |
Sets the Angular Breakable properties | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularDriveAccelerationMode
(
bool bAccelerationMode |
Toggles the angular drive acceleration mode. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularDriveMode
(
EAngularDriveMode::Type DriveMode |
Switches the angular drive mode between SLERP and Twist And Swing | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularDriveParams
(
float PositionStrength, |
Sets the drive params for the angular drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularOrientationDrive
(
bool bEnableSwingDrive, |
Enables/Disables angular orientation drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularOrientationTarget
(
const FRotator& InPosTarget |
Sets the target orientation for the angular drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularPlasticity
(
bool bAngularPlasticity, |
Sets the Angular Plasticity properties | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularSwing1Limit
(
EAngularConstraintMotion MotionType, |
Sets the Angular Swing1 Motion Type | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularSwing2Limit
(
EAngularConstraintMotion MotionType, |
Sets the Angular Swing2 Motion Type | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularTwistLimit
(
EAngularConstraintMotion ConstraintType, |
Sets the Angular Twist Motion Type | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularVelocityDrive
(
bool bEnableSwingDrive, |
PhysicsEngine/PhysicsConstraintComponent.h |
|
|
void SetAngularVelocityDriveSLERP
(
bool bEnableSLERP |
Enables/Disables the angular velocity slerp drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularVelocityDriveTwistAndSwing
(
bool bEnableTwistDrive, |
Enables/Disables angular velocity twist and swing drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetAngularVelocityTarget
(
const FVector& InVelTarget |
Sets the target velocity for the angular drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetConstrainedComponents
(
UPrimitiveComponent* Component1, |
Directly specify component to connect. Will update frames based on current position. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetConstraintReferenceFrame
(
EConstraintFrame::Type Frame, |
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. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetConstraintReferenceOrientation
(
EConstraintFrame::Type Frame, |
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. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetConstraintReferencePosition
(
EConstraintFrame::Type Frame, |
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. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetContactTransferScale
(
float ContactTransferScale |
Sets the contact transfer scale properties | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetDisableCollision
(
bool bDisableCollision |
If true, the collision between the two rigid bodies of the constraint will be disabled. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearBreakable
(
bool bLinearBreakable, |
Sets the Linear Breakable properties | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearDriveAccelerationMode
(
bool bAccelerationMode |
Toggles the linear drive acceleration mode. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearDriveParams
(
float PositionStrength, |
Sets the drive params for the linear drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearPlasticity
(
bool bLinearPlasticity, |
Sets the Linear Plasticity properties | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearPositionDrive
(
bool bEnableDriveX, |
Enables/Disables linear position drive | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearPositionTarget
(
const FVector& InPosTarget |
Sets the target position for the linear drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearVelocityDrive
(
bool bEnableDriveX, |
Enables/Disables linear position drive | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearVelocityTarget
(
const FVector& InVelTarget |
Sets the target velocity for the linear drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearXLimit
(
ELinearConstraintMotion ConstraintType, |
Sets the LinearX Motion Type | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearYLimit
(
ELinearConstraintMotion ConstraintType, |
Sets the LinearY Motion Type | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetLinearZLimit
(
ELinearConstraintMotion ConstraintType, |
Sets the LinearZ Motion Type | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetOrientationDriveSLERP
(
bool bEnableSLERP |
Enables/Disables the angular orientation slerp drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetOrientationDriveTwistAndSwing
(
bool bEnableTwistDrive, |
Enables/Disables angular orientation drive. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetProjectionEnabled
(
bool bProjectionEnabled |
If true, joint projection is enabled. Projection is a semi-physics post-solve correction for fixing small errors, and a teleport for fixing larger errors. See SetProjectionParams. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void SetProjectionParams
(
float ProjectionLinearAlpha, |
Set the projection settings for use when projection is enabled. | PhysicsEngine/PhysicsConstraintComponent.h |
|
void TermComponentConstraint() |
Break the constraint | PhysicsEngine/PhysicsConstraintComponent.h | |
void UpdateConstraintFrames () |
Update the reference frames held inside the constraint that indicate the joint location in the reference frame of the two connected bodies. | PhysicsEngine/PhysicsConstraintComponent.h | |
void UpdateSpriteTexture() |
PhysicsEngine/PhysicsConstraintComponent.h |
Overridden from USceneComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostEditComponentMove
(
bool bFinished |
Called when this component is moved in the editor | PhysicsEngine/PhysicsConstraintComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
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. | PhysicsEngine/PhysicsConstraintComponent.h | |
virtual void EndPlay
(
const EEndPlayReason::Type EndPlayReason |
Ends gameplay for this component. Called from AActor::EndPlay only if bHasBegunPlay is true | PhysicsEngine/PhysicsConstraintComponent.h | |
virtual void InitializeComponent () |
Initializes the component. | PhysicsEngine/PhysicsConstraintComponent.h | |
virtual void OnRegister() |
Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called. | PhysicsEngine/PhysicsConstraintComponent.h | |
virtual void OnUnregister () |
Called when a component is unregistered. | PhysicsEngine/PhysicsConstraintComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void BeginDestroy() |
PhysicsEngine/PhysicsConstraintComponent.h | ||
virtual void PostEditChangeChainProperty
(
FPropertyChangedChainEvent& PropertyChangedEvent |
PhysicsEngine/PhysicsConstraintComponent.h | ||
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
PhysicsEngine/PhysicsConstraintComponent.h | ||
virtual void PostLoad() |
PhysicsEngine/PhysicsConstraintComponent.h | ||
virtual void Serialize
(
FArchive& Ar |
PhysicsEngine/PhysicsConstraintComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FBox GetBodyBoxInternal
(
EConstraintFrame::Type Frame, |
Internal util to get body box from actor/component name/bone name information | PhysicsEngine/PhysicsConstraintComponent.h | |
FBodyInstance * GetBodyInstance
(
EConstraintFrame::Type Frame |
Get the body instance that we want to constrain to | PhysicsEngine/PhysicsConstraintComponent.h | |
FTransform GetBodyTransformInternal
(
EConstraintFrame::Type Frame, |
Internal util to get body transform from actor/component name/bone name information | PhysicsEngine/PhysicsConstraintComponent.h | |
UPrimitiveComponent * GetComponentInternal
(
EConstraintFrame::Type Frame |
Internal util to get component from actor/component name | PhysicsEngine/PhysicsConstraintComponent.h | |
float GetConstraintScale() |
Returns the scale of the constraint as it will be passed into the ConstraintInstance | PhysicsEngine/PhysicsConstraintComponent.h | |
Chaos::FPhysicsObject * GetPhysicsObject
(
EConstraintFrame::Type Frame |
Get the physics object that we want to constrain to. | PhysicsEngine/PhysicsConstraintComponent.h | |
void OnConstraintBrokenHandler
(
FConstraintInstance* BrokenConstraint |
Routes the FConstraint callback to the dynamic delegate | PhysicsEngine/PhysicsConstraintComponent.h | |
void OnPlasticDeformationHandler
(
FConstraintInstance* Constraint |
Routes the FConstraint callback to the dynamic delegate | PhysicsEngine/PhysicsConstraintComponent.h |
Deprecated Variables
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| ConstraintSetup_DEPRECATED | TObjectPtr< class UPhysicsConstraintTemplate > | PhysicsEngine/PhysicsConstraintComponent.h |
|