Navigation
API > API/Runtime > API/Runtime/Engine > API/Runtime/Engine/PhysicsEngine
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UActorComponent
- USceneComponent
- UPhysicsConstraintComponent
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
| Type | Name | Description | |
|---|---|---|---|
| FConstrainComponentPropName | ComponentName1 | Name of first component property to constrain. | |
| FConstrainComponentPropName | ComponentName2 | Name of second component property to constrain. | |
| TObjectPtr< AActor > | ConstraintActor1 | Pointer to first Actor to constrain. | |
| TObjectPtr< AActor > | ConstraintActor2 | Pointer to second Actor to constrain. | |
| FConstraintInstance | ConstraintInstance | All constraint settings | |
| FConstraintBrokenSignature | OnConstraintBroken | Notification when constraint is broken. | |
| FPlasticDeformationEventSignature | OnPlasticDeformation | Notification when constraint plasticity drive target changes. | |
| TWeakObjectPtr< UPrimitiveComponent > | OverrideComponent1 | Allows direct setting of first component to constraint. | |
| TWeakObjectPtr< UPrimitiveComponent > | OverrideComponent2 | Allows direct setting of second component to constraint. |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UPhysicsConstraintComponent
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Break this constraint | ||
| FBox | GetBodyBox
(
EConstraintFrame::Type Frame |
Get body bounding box. Works without constraint being created | |
| FBox | GetBodyBoxInternal
(
EConstraintFrame::Type Frame, |
Internal util to get body box from actor/component name/bone name information | |
| FBodyInstance * | GetBodyInstance
(
EConstraintFrame::Type Frame |
Get the body instance that we want to constrain to | |
| FTransform | GetBodyTransform
(
EConstraintFrame::Type Frame |
Get the body frame. Works without constraint being created | |
| FTransform | GetBodyTransformInternal
(
EConstraintFrame::Type Frame, |
Internal util to get body transform from actor/component name/bone name information | |
| UPrimitiveComponent * | GetComponentInternal
(
EConstraintFrame::Type Frame |
Internal util to get component from actor/component name | |
| void | GetConstrainedComponents
(
UPrimitiveComponent*& OutComponent1, |
Get connected components and potential related attachement bones | |
| FConstraintInstanceAccessor | Gets the constraint object | ||
| 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. | |
| float | Returns the scale of the constraint as it will be passed into the ConstraintInstance | ||
| float | Gets the current Swing1 of the constraint | ||
| float | Gets the current Swing2 of the constraint | ||
| float | Gets the current Angular Twist of the constraint | ||
| Chaos::FPhysicsObject * | GetPhysicsObject
(
EConstraintFrame::Type Frame |
Get the physics object that we want to constrain to. | |
| void | Initialize the frames and creates constraint | ||
| bool | IsBroken () |
Retrieve the status of constraint being broken. | |
| void | OnConstraintBrokenHandler
(
FConstraintInstance* BrokenConstraint |
Routes the FConstraint callback to the dynamic delegate | |
| void | OnPlasticDeformationHandler
(
FConstraintInstance* Constraint |
Routes the FConstraint callback to the dynamic delegate | |
| void | SetAngularBreakable
(
bool bAngularBreakable, |
Sets the Angular Breakable properties | |
| void | SetAngularDriveMode
(
EAngularDriveMode::Type DriveMode |
Switches the angular drive mode between SLERP and Twist And Swing | |
| void | SetAngularDriveParams
(
float PositionStrength, |
Sets the drive params for the angular drive. | |
| void | SetAngularOrientationDrive
(
bool bEnableSwingDrive, |
Enables/Disables angular orientation drive. | |
| void | SetAngularOrientationTarget
(
const FRotator& InPosTarget |
Sets the target orientation for the angular drive. | |
| void | SetAngularPlasticity
(
bool bAngularPlasticity, |
Sets the Angular Plasticity properties | |
| void | SetAngularSwing1Limit
(
EAngularConstraintMotion MotionType, |
Sets the Angular Swing1 Motion Type | |
| void | SetAngularSwing2Limit
(
EAngularConstraintMotion MotionType, |
Sets the Angular Swing2 Motion Type | |
| void | SetAngularTwistLimit
(
EAngularConstraintMotion ConstraintType, |
Sets the Angular Twist Motion Type | |
| void | SetAngularVelocityDrive
(
bool bEnableSwingDrive, |
||
| void | SetAngularVelocityDriveSLERP
(
bool bEnableSLERP |
Enables/Disables the angular velocity slerp drive. | |
| void | SetAngularVelocityDriveTwistAndSwing
(
bool bEnableTwistDrive, |
Enables/Disables angular velocity twist and swing drive. | |
| void | SetAngularVelocityTarget
(
const FVector& InVelTarget |
Sets the target velocity for the angular drive. | |
| void | SetConstrainedComponents
(
UPrimitiveComponent* Component1, |
Directly specify component to connect. Will update frames based on current position. | |
| 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. | |
| 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. | |
| 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. | |
| void | SetContactTransferScale
(
float ContactTransferScale |
Sets the contact transfer scale properties | |
| void | SetDisableCollision
(
bool bDisableCollision |
If true, the collision between the two rigid bodies of the constraint will be disabled. | |
| void | SetLinearBreakable
(
bool bLinearBreakable, |
Sets the Linear Breakable properties | |
| void | SetLinearDriveParams
(
float PositionStrength, |
Sets the drive params for the linear drive. | |
| void | SetLinearPlasticity
(
bool bLinearPlasticity, |
Sets the Linear Plasticity properties | |
| void | SetLinearPositionDrive
(
bool bEnableDriveX, |
Enables/Disables linear position drive | |
| void | SetLinearPositionTarget
(
const FVector& InPosTarget |
Sets the target position for the linear drive. | |
| void | SetLinearVelocityDrive
(
bool bEnableDriveX, |
Enables/Disables linear position drive | |
| void | SetLinearVelocityTarget
(
const FVector& InVelTarget |
Sets the target velocity for the linear drive. | |
| void | SetLinearXLimit
(
ELinearConstraintMotion ConstraintType, |
Sets the LinearX Motion Type | |
| void | SetLinearYLimit
(
ELinearConstraintMotion ConstraintType, |
Sets the LinearY Motion Type | |
| void | SetLinearZLimit
(
ELinearConstraintMotion ConstraintType, |
Sets the LinearZ Motion Type | |
| void | SetOrientationDriveSLERP
(
bool bEnableSLERP |
Enables/Disables the angular orientation slerp drive. | |
| void | SetOrientationDriveTwistAndSwing
(
bool bEnableTwistDrive, |
Enables/Disables angular orientation drive. | |
| void | Break the constraint | ||
| void | Update the reference frames held inside the constraint that indicate the joint location in the reference frame of the two connected bodies. | ||
| void |
Overridden from USceneComponent
| Type | Name | Description | |
|---|---|---|---|
| void | PostEditComponentMove
(
bool bFinished |
Called when this component is moved in the editor |
Overridden from UActorComponent
| Type | Name | Description | |
|---|---|---|---|
| void | 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. | ||
| void | EndPlay
(
const EEndPlayReason::Type EndPlayReason |
Ends gameplay for this component. | |
| void | Initializes the component. | ||
| void | OnRegister () |
Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called. | |
| void | OnUnregister () |
Called when a component is unregistered. |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginDestroy () |
Called before destroying the object. | |
| void | PostEditChangeChainProperty
(
FPropertyChangedChainEvent& PropertyChangedEvent |
This alternate version of PostEditChange is called when properties inside structs are modified. | |
| void | PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Called when a property on this object has been modified externally | |
| void | PostLoad () |
Do any object-specific cleanup required immediately after loading an object. | |
| void | Handles reading, writing, and reference collecting using FArchive. |
Deprecated Variables
| Type | Name | Description | |
|---|---|---|---|
| TObjectPtr< class UPhysicsConstraintTemplate > | ConstraintSetup_DEPRECATED |