Navigation
API > API/Plugins > API/Plugins/PhysicsControl
Inheritance Hierarchy
- UObjectBase
- UObjectBaseUtility
- UObject
- UActorComponent
- USceneComponent
- UPhysicsControlComponent
References
| Module | PhysicsControl |
| Header | /Engine/Plugins/Experimental/PhysicsControl/Source/PhysicsControl/Public/PhysicsControlComponent.h |
| Include | #include "PhysicsControlComponent.h" |
Syntax
UCLASS&40;Meta&61;&40;BlueprintSpawnableComponent&41;, ClassGroup&61;Physics, Experimental&41;
class UPhysicsControlComponent : public USceneComponent
Remarks
This is the main Physics Control Component class which manages Controls and Body Modifiers associated with one or more static or skeletal meshes. You can add this as a component to an actor containing a mesh and then use it to create, configure and destroy Controls/Body Modifiers:
Controls are used to control one physics body relative to another (or the world). These controls are done through physical spring/damper drives.
Body Modifiers are used to update the most important physical properties of physics bodies such as whether they are simulated vs kinematic, or whether they experience gravity.
Note that Controls and Body Modifiers are given names (which are predictable). These names can then be stored (perhaps in arrays) to make it easy to quickly change multiple Controls/Body Modifiers.
Variables
| Type | Name | Description | |
|---|---|---|---|
| bool | bShowDebugBodyModifierList | Display all the body modifiers and their basic properties when this component is selected | |
| bool | bShowDebugControlList | Display all the controls and their basic properties when this component is selected | |
| bool | bShowDebugVisualization | Visualize the controls when this component is selected | |
| FString | DebugBodyModifierDetailFilter | Display detailed info for body modifiers containing this string (if non-empty) when this component is selected | |
| FString | DebugControlDetailFilter | Display detailed info for controls containing this string (if non-empty) when this component is selected | |
| TPimplPtr< FPhysicsControlComponentImpl > | Implementation | ||
| int32 | MaxNumControlsOrModifiersPerName | Upper limit on the number of controls or modifiers that will be created using the same name (which will get a numerical postfix). | |
| float | TeleportDistanceThreshold | If the component moves by more than this distance then it is treated as a teleport, which prevents velocities being used for a frame. | |
| float | TeleportRotationThreshold | If the component rotates by more than this angle (in degrees) then it is treated as a teleport, which prevents velocities being used for a frame. | |
| float | VelocityPredictionTime | The time used when "predicting" the target position/orientation. | |
| float | VisualizationSizeScale | Size of the gizmos etc used during visualization |
Constructors
| Type | Name | Description | |
|---|---|---|---|
UPhysicsControlComponent
(
const FObjectInitializer& ObjectInitializer |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | AddBodyModifiersToSet
(
FPhysicsControlNames& NewSet, |
Adds BodyModifiers to a Set. | |
| void | AddBodyModifierToSet
(
FPhysicsControlNames& NewSet, |
Adds a BodyModifier to a Set. | |
| void | AddControlsToSet
(
FPhysicsControlNames& NewSet, |
Adds Controls to a Set. | |
| void | AddControlToSet
(
FPhysicsControlNames& NewSet, |
Adds a Control to a Set. | |
| FName | CreateBodyModifier
(
UMeshComponent* MeshComponent, |
Creates a new body modifier for mesh components | |
| TMap< FName, FPhysicsControlNames > | CreateBodyModifiersFromLimbBones
(
FPhysicsControlNames& AllBodyModifiers, |
Creates a collection of controls controlling a skeletal mesh, grouped together in limbs | |
| TArray< FName > | CreateBodyModifiersFromSkeletalMeshBelow
(
USkeletalMeshComponent* SkeletalMeshComponent, |
Creates new body modifiers for skeletal mesh components | |
| FName | CreateControl
(
UMeshComponent* ParentMeshComponent, |
Creates a new control for mesh components | |
| void | CreateControlsAndBodyModifiersFromLimbBones
(
FPhysicsControlNames& AllWorldSpaceControls, |
Creates a collections of controls and body modifiers for a character, based on the description passed in. | |
| TMap< FName, FPhysicsControlNames > | CreateControlsFromLimbBones
(
FPhysicsControlNames& AllControls, |
Creates a collection of controls controlling a skeletal mesh, grouped together in limbs | |
| TMap< FName, FPhysicsControlNames > | CreateControlsFromLimbBonesAndConstraintProfile
(
FPhysicsControlNames& AllControls, |
Creates a collection of ParentSpace controls controlling a skeletal mesh, grouped together in limbs, initializing them with a constraint profile | |
| TArray< FName > | CreateControlsFromSkeletalMesh
(
USkeletalMeshComponent* SkeletalMeshComponent, |
Creates a collection of controls controlling a skeletal mesh | |
| TArray< FName > | CreateControlsFromSkeletalMeshAndConstraintProfile
(
USkeletalMeshComponent* SkeletalMeshComponent, |
Creates a collection of ParentSpace controls controlling a skeletal mesh, initializing them with a constraint profile | |
| TArray< FName > | CreateControlsFromSkeletalMeshAndConstraintProfileBelow
(
USkeletalMeshComponent* SkeletalMeshComponent, |
Creates a collection of ParentSpace controls controlling a skeletal mesh, initializing them with a constraint profile | |
| TArray< FName > | CreateControlsFromSkeletalMeshBelow
(
USkeletalMeshComponent* SkeletalMeshComponent, |
Creates a collection of controls controlling a skeletal mesh | |
| bool | CreateNamedBodyModifier
(
const FName Name, |
Creates a new body modifier for mesh components | |
| bool | CreateNamedControl
(
FName Name, |
Creates a new control for mesh components | |
| void | DebugDraw
(
FPrimitiveDrawInterface* PDI |
Used by the component visualizer. | |
| void | DebugDrawControl
(
FPrimitiveDrawInterface* PDI, |
Used by the component visualizer. | |
| bool | DestroyBodyModifier
(
const FName Name |
Destroys a BodyModifier | |
| void | DestroyBodyModifiers
(
const TArray< FName >& Names |
Destroys BodyModifiers | |
| void | DestroyBodyModifiersInSet
(
const FName Set |
Destroys BodyModifiers | |
| bool | DestroyControl
(
const FName Name |
Destroys a control | |
| void | DestroyControls
(
const TArray< FName >& Names |
Destroys all controls | |
| void | DestroyControlsInSet
(
const FName Set |
Destroys all controls in a set | |
| const TArray< FName > & | Returns a reference to all the body modifier names that have been created. | ||
| const TArray< FName > & | Returns a reference to all the control names that have been created. | ||
| const TArray< FName > & | GetBodyModifierNamesInSet
(
const FName Set |
Returns a reference to all the body modifier names that have been created and are in the specified set, which could be a limb, or a subsequently created set. | |
| TArray< FVector > | GetCachedBoneAngularVelocities
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the angular velocities of the requested bones that will be used as targets (in world space). | |
| FVector | GetCachedBoneAngularVelocity
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the angular velocity of the requested bone that will be used as a target (in world space). | |
| FRotator | GetCachedBoneOrientation
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the orientation of the requested bone that will be used as a target (in world space). | |
| TArray< FRotator > | GetCachedBoneOrientations
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the orientations of the requested bones that will be used as targets (in world space). | |
| FVector | GetCachedBonePosition
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the position of the requested bone that will be used as a target (in world space). | |
| TArray< FVector > | GetCachedBonePositions
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the positions of the requested bones that will be used as targets (in world space). | |
| FTransform | GetCachedBoneTransform
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the transforms of the requested bone that will be used as a target (in world space). | |
| TArray< FTransform > | GetCachedBoneTransforms
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the transforms of the requested bones that will be used as targets (in world space). | |
| TArray< FVector > | GetCachedBoneVelocities
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the linear velocities of the requested bones that will be used as targets (in world space). | |
| FVector | GetCachedBoneVelocity
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
Gets the linear velocity of the requested bone that will be used as a target (in world space). | |
| bool | GetControlAutoDisable
(
const FName Name |
||
| bool | GetControlData
(
const FName Name, |
||
| bool | GetControlEnabled
(
const FName Name |
||
| bool | GetControlMultiplier
(
const FName Name, |
||
| const TArray< FName > & | GetControlNamesInSet
(
const FName Set |
Returns a reference to all the control names that have been created and are in the specified set, which could be a limb, or a subsequently created set. | |
| bool | GetControlTarget
(
const FName Name, |
||
| TMap< FName, FPhysicsControlLimbBones > | GetLimbBonesFromSkeletalMesh
(
USkeletalMeshComponent* SkeletalMeshComponent, |
Calculates which bones belong to which limb in a skeletal mesh | |
| TArray< FName > | GetSetsContainingBodyModifier
(
const FName Control |
Returns the names of all sets containing the body modifier (may be empty - e.g. if it doesn't exist) | |
| TArray< FName > | GetSetsContainingControl
(
const FName Control |
Returns the names of all sets containing the control (may be empty - e.g. if it doesn't exist) | |
| void | ResetBodyModifiersInSetToCachedBoneTransforms
(
const FName SetName, |
Calls ResetBodyModifierToCachedTarget for each of the body modifiers in the set | |
| void | ResetBodyModifiersToCachedBoneTransforms
(
const TArray< FName >& Names, |
Calls ResetBodyModifierToCachedTarget for each of the body modifiers | |
| bool | ResetBodyModifierToCachedBoneTransform
(
const FName Name, |
This flags the body associated with the modifier to set (using teleport) its position and velocity to the cached animation target. | |
| bool | ResetControlPoint
(
const FName Name |
Resets the control point to the center of mass of the mesh | |
| bool | SetBodyModifierCollisionType
(
const FName Name, |
Sets the collision type for a body modifier | |
| bool | SetBodyModifierGravityMultiplier
(
const FName Name, |
Sets the gravity multiplier for a body modifier | |
| bool | SetBodyModifierKinematicTarget
(
const FName Name, |
Sets the kinematic target transform for a body modifier. | |
| bool | SetBodyModifierMovementType
(
const FName Name, |
Sets the movement type for a body modifier | |
| bool | SetBodyModifierPhysicsBlendWeight
(
const FName Name, |
Sets the physics blend weight for a body modifier | |
| void | SetBodyModifiersCollisionType
(
const TArray< FName >& Names, |
Sets the collision type for body modifiers | |
| void | SetBodyModifiersGravityMultiplier
(
const TArray< FName >& Names, |
Sets the gravity multiplier for body modifiers | |
| void | SetBodyModifiersInSetCollisionType
(
const FName Set, |
Sets the collision type for body modifiers | |
| void | SetBodyModifiersInSetGravityMultiplier
(
const FName Set, |
Sets the gravity multiplier for body modifiers | |
| void | SetBodyModifiersInSetMovementType
(
const FName Set, |
Sets the movement type for body modifiers | |
| void | SetBodyModifiersInSetPhysicsBlendWeight
(
const FName Set, |
Sets the physics blend weight for body modifiers | |
| void | SetBodyModifiersInSetUpdateKinematicFromSimulation
(
const FName Set, |
Sets whether body modifiers should update kinematics from the simulation results | |
| void | SetBodyModifiersInSetUseSkeletalAnimation
(
const FName Set, |
Sets whether body modifiers should use skeletal animation for their kinematic targets | |
| void | SetBodyModifiersMovementType
(
const TArray< FName >& Names, |
Sets the movement type for body modifiers | |
| void | SetBodyModifiersPhysicsBlendWeight
(
const TArray< FName >& Names, |
Sets the physics blend weight for body modifiers | |
| void | SetBodyModifiersUpdateKinematicFromSimulation
(
const TArray< FName >& Names, |
Sets whether body modifiers should update kinematics from the simulation results | |
| void | SetBodyModifiersUseSkeletalAnimation
(
const TArray< FName >& Names, |
Sets whether body modifiers should use skeletal animation for their kinematic targets | |
| bool | SetBodyModifierUpdateKinematicFromSimulation
(
const FName Name, |
Sets whether a body modifier should update kinematics from the simulation results | |
| bool | SetBodyModifierUseSkeletalAnimation
(
const FName Name, |
Sets whether a body modifier should use skeletal animation for its kinematic targets | |
| bool | SetCachedBoneData
(
const USkeletalMeshComponent* SkeletalMeshComponent, |
This allows the caller to override the target that will have been calculated and cached at the start of the Physics Control Component update. | |
| bool | SetControlAngularData
(
const FName Name, |
Modifies an existing control's angular data - i.e. the strengths etc of the control driving towards the target | |
| bool | SetControlAutoDisable
(
const FName Name, |
||
| bool | SetControlData
(
const FName Name, |
Modifies an existing control data - i.e. the strengths etc of the control driving towards the target | |
| void | SetControlDatas
(
const TArray< FName >& Names, |
Modifies existing control data - i.e. the strengths etc of the controls driving towards the targets | |
| void | SetControlDatasInSet
(
const FName Set, |
Modifies existing control data - i.e. the strengths etc of the controls driving towards the targets | |
| bool | SetControlDisableCollision
(
const FName Name, |
||
| bool | SetControlEnabled
(
const FName Name, |
Activates or deactivates a control | |
| bool | SetControlLinearData
(
const FName Name, |
Modifies an existing control's linear data - i.e. the strengths etc of the control driving towards the target | |
| bool | SetControlMultiplier
(
const FName Name, |
Modifies an existing control data using the multipliers | |
| void | SetControlMultipliers
(
const TArray< FName >& Names, |
Modifies existing control data using the multipliers | |
| void | SetControlMultipliersInSet
(
const FName Set, |
Modifies existing control data using the multipliers | |
| bool | SetControlPoint
(
const FName Name, |
Sets the point at which controls will "push" the child object. | |
| void | SetControlsAutoDisable
(
const TArray< FName >& Names, |
||
| void | SetControlsDisableCollision
(
const TArray< FName >& Names, |
||
| void | SetControlsEnabled
(
const TArray< FName >& Names, |
Activates or deactivates controls | |
| void | SetControlsInSetAutoDisable
(
const FName Set, |
||
| void | SetControlsInSetDisableCollision
(
const FName Set, |
||
| void | SetControlsInSetEnabled
(
const FName Set, |
Activates or deactivates controls | |
| void | SetControlsInSetUseSkeletalAnimation
(
const FName Set, |
Sets whether or not the controls should use skeletal animation for the targets | |
| void | SetControlsUseSkeletalAnimation
(
const TArray< FName >& Names, |
Sets whether or not the controls should use skeletal animation for the targets | |
| bool | SetControlTarget
(
const FName Name, |
Modifies an existing control target - i.e. what it is driving towards, relative to the parent object | |
| bool | SetControlTargetOrientation
(
const FName Name, |
Modifies an existing control target - i.e. what it is driving towards, relative to the parent object | |
| void | SetControlTargetOrientations
(
const TArray< FName >& Names, |
Calls SetControlTargetOrientation for each of the control names | |
| bool | SetControlTargetOrientationsFromArray
(
const TArray< FName >& Names, |
Calls SetControlTargetPosition for each element of the control names and positions. | |
| void | SetControlTargetOrientationsInSet
(
const FName SetName, |
Calls SetControlTargetOrientation for each of the controls in the set | |
| bool | SetControlTargetPoses
(
const FName Name, |
Calculates and sets an existing control target. | |
| bool | SetControlTargetPosition
(
const FName Name, |
Modifies an existing control target - i.e. what it is driving towards, relative to the parent object | |
| bool | SetControlTargetPositionAndOrientation
(
const FName Name, |
Modifies an existing control target - i.e. what it is driving towards, relative to the parent object | |
| void | SetControlTargetPositions
(
const TArray< FName >& Names, |
Calls SetControlTargetPosition for each of the control names | |
| void | SetControlTargetPositionsAndOrientations
(
const TArray< FName >& Names, |
Calls SetControlTargetPositionAndOrientation for each of the control names | |
| bool | SetControlTargetPositionsAndOrientationsFromArray
(
const TArray< FName >& Names, |
Calls SetControlTargetPositionAndOrientation for each element of the control names, positions and orientations. | |
| void | SetControlTargetPositionsAndOrientationsInSet
(
const FName SetName, |
Calls SetControlTargetPositionAndOrientation for each control in the set | |
| bool | SetControlTargetPositionsFromArray
(
const TArray< FName >& Names, |
Calls SetControlTargetPosition for each element of the control names and positions. | |
| void | SetControlTargetPositionsInSet
(
const FName SetName, |
Calls SetControlTargetPosition for each of the controls in the set | |
| void | SetControlTargets
(
const TArray< FName >& Names, |
Modifies existing control targets - i.e. what they are driving towards, relative to the parent objects | |
| void | SetControlTargetsInSet
(
const FName Set, |
Modifies existing control targets - i.e. what they are driving towards, relative to the parent objects | |
| bool | SetControlUseSkeletalAnimation
(
const FName Name, |
Sets whether or not the control should use skeletal animation for the targets | |
| void | UpdateControls
(
float DeltaTime |
Allows manual ticking so that your code can run in between updating the target caches and updating the controls and body modifiers. | |
| void | |||
| void | UpdateTargetCaches
(
float DeltaTime |
Allows manual ticking so that your code can run in between updating the target caches and updating the controls. |
Overridden from UActorComponent
| Type | Name | Description | |
|---|---|---|---|
| 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 | TickComponent
(
float DeltaTime, |
Function called every frame on this ActorComponent. |
Overridden from UObject
| Type | Name | Description | |
|---|---|---|---|
| void | BeginDestroy () |
Called before destroying the object. |