UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PhysicalAnimationComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
8#include "EngineDefines.h"
10#include "PhysicalAnimationComponent.generated.h"
11
13class USkeletalMeshComponent;
14
16USTRUCT(BlueprintType)
18{
20
22 : BodyName(NAME_None)
23 , bIsLocalSimulation(true)
24 , OrientationStrength(0.f)
25 , AngularVelocityStrength(0.f)
26 , PositionStrength(0.f)
27 , VelocityStrength(0.f)
28 , MaxLinearForce(0.f)
29 , MaxAngularForce(0.f)
30 {
31 }
32
34 UPROPERTY()
35 FName BodyName;
36
38 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalAnimation)
39 uint8 bIsLocalSimulation : 1;
40
42 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalAnimation)
43 float OrientationStrength;
44
46 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalAnimation)
47 float AngularVelocityStrength;
48
50 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalAnimation)
51 float PositionStrength;
52
54 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalAnimation)
55 float VelocityStrength;
56
58 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalAnimation)
59 float MaxLinearForce;
60
62 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicalAnimation)
63 float MaxAngularForce;
64};
65
66UCLASS(meta = (BlueprintSpawnableComponent), ClassGroup = Physics, Experimental, MinimalAPI)
68{
70
71public:
73 UFUNCTION(BlueprintCallable, Category = PhysicalAnimation)
74 ENGINE_API void SetSkeletalMeshComponent(USkeletalMeshComponent* InSkeletalMeshComponent);
75
77 UFUNCTION(BlueprintCallable, Category = PhysicalAnimation, meta = (UnsafeDuringActorConstruction))
78 ENGINE_API void ApplyPhysicalAnimationSettings(FName BodyName, const FPhysicalAnimationData& PhysicalAnimationData);
79
81 UFUNCTION(BlueprintCallable, Category = PhysicalAnimation, meta = (UnsafeDuringActorConstruction))
82 ENGINE_API void ApplyPhysicalAnimationSettingsBelow(FName BodyName, const FPhysicalAnimationData& PhysicalAnimationData, bool bIncludeSelf = true);
83
85 UFUNCTION(BlueprintCallable, Category = PhysicalAnimation)
86 ENGINE_API void SetStrengthMultiplyer(float InStrengthMultiplyer);
87
89 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = PhysicalAnimation, meta = (ClampMin = "0"))
90 float StrengthMultiplyer;
91
99 UFUNCTION(BlueprintCallable, Category = PhysicalAnimation, meta = (UnsafeDuringActorConstruction))
100 ENGINE_API void ApplyPhysicalAnimationProfileBelow(FName BodyName, FName ProfileName, bool bIncludeSelf = true, bool bClearNotFound = false);
101
105 UFUNCTION(BlueprintCallable, Category = PhysicalAnimation, meta = (UnsafeDuringActorConstruction))
106 ENGINE_API FTransform GetBodyTargetTransform(FName BodyName) const;
107
108 ENGINE_API virtual void InitializeComponent() override;
109 ENGINE_API virtual void BeginDestroy() override;
110 ENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
111
112#if WITH_EDITOR
113 ENGINE_API void DebugDraw(FPrimitiveDrawInterface* PDI) const;
114#endif
115
116 USkeletalMeshComponent* GetSkeletalMesh() const { return SkeletalMeshComponent; }
117
118private:
119 UPROPERTY()
120 TObjectPtr<USkeletalMeshComponent> SkeletalMeshComponent;
121
122 struct FPhysicalAnimationInstanceData
123 {
124 struct FConstraintInstance* ConstraintInstance;
125 FPhysicsActorHandle TargetActor;
126 };
127
129 TArray<FPhysicalAnimationInstanceData> RuntimeInstanceData;
131
132 FDelegateHandle OnTeleportDelegateHandle;
133
134 ENGINE_API void UpdatePhysicsEngine();
135 ENGINE_API void UpdatePhysicsEngineImp();
136 ENGINE_API void ReleasePhysicsEngine();
137 ENGINE_API void InitComponent();
138
139 ENGINE_API void OnTeleport();
140 ENGINE_API void UpdateTargetActors(ETeleportType TeleportType);
141
142 static ENGINE_API const FConstraintProfileProperties PhysicalAnimationProfile;
143
144 bool bPhysicsEngineNeedsUpdating;
145};
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ELevelTick
Definition EngineBaseTypes.h:70
ETeleportType
Definition EngineTypes.h:2401
return true
Definition ExternalRpcRegistry.cpp:601
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
#define USTRUCT(...)
Definition ObjectMacros.h:746
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition SingleParticlePhysicsProxy.h:58
Definition IDelegateInstance.h:14
Definition NameTypes.h:617
Definition PrimitiveDrawInterface.h:19
Definition Array.h:670
Definition ActorComponent.h:152
Definition PhysicalAnimationComponent.h:68
USkeletalMeshComponent * GetSkeletalMesh() const
Definition PhysicalAnimationComponent.h:116
Definition RobinHoodHashTable.h:18
@ false
Definition radaudio_common.h:23
Definition EngineBaseTypes.h:571
Definition ConstraintInstance.h:255
Definition ConstraintInstance.h:57
Definition PhysicalAnimationComponent.h:18
Definition ObjectPtr.h:488