UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PhysicsHandleComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5
6#include "CoreMinimal.h"
10#include "PhysicsHandleComponent.generated.h"
11
15UCLASS(collapsecategories, ClassGroup=Physics, hidecategories=Object, meta=(BlueprintSpawnableComponent), MinimalAPI)
17{
19
20
21 UPROPERTY()
23
25 FName GrabbedBoneName;
26
28 uint32 bRotationConstrained:1;
29
30 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=PhysicsHandle)
31 uint32 bSoftAngularConstraint : 1;
32
33 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = PhysicsHandle)
34 uint32 bSoftLinearConstraint : 1;
35
36 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = PhysicsHandle)
37 uint32 bInterpolateTarget : 1;
38
40 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=PhysicsHandle, meta = (EditCondition = "bSoftLinearConstraint"))
41 float LinearDamping;
42
44 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=PhysicsHandle, meta = (EditCondition = "bSoftLinearConstraint"))
45 float LinearStiffness;
46
48 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=PhysicsHandle, meta = (EditCondition = "bSoftAngularConstraint"))
49 float AngularDamping;
50
52 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=PhysicsHandle, meta = (EditCondition = "bSoftAngularConstraint"))
53 float AngularStiffness;
54
56 FTransform TargetTransform;
58 FTransform CurrentTransform;
59
61 UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=PhysicsHandle, meta = (EditCondition = "bInterpolateTarget"))
62 float InterpolationSpeed;
63
64
65protected:
66
69
75 FVector ConstraintLocalPosition; // Position of constraint in the grabbed body local space (updated when grabbing)
77
78 //~ Begin UActorComponent Interface.
79 ENGINE_API virtual void OnUnregister() override;
80 ENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
81 //~ End UActorComponent Interface.
82
83public:
84
86 UE_DEPRECATED(4.14, "Please use GrabComponentAtLocation or GrabComponentAtLocationWithRotation")
87 UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsHandle", meta = (DeprecatedFunction, DeprecationMessage = "Please use GrabComponentAtLocation or GrabComponentAtLocationWithRotation"))
88 ENGINE_API virtual void GrabComponent(class UPrimitiveComponent* Component, FName InBoneName, FVector GrabLocation, bool bConstrainRotation);
89
91 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
92 ENGINE_API void GrabComponentAtLocation(class UPrimitiveComponent* Component, FName InBoneName, FVector GrabLocation);
93
95 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
96 ENGINE_API void GrabComponentAtLocationWithRotation(class UPrimitiveComponent* Component, FName InBoneName, FVector Location, FRotator Rotation);
97
99 UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsHandle")
100 ENGINE_API virtual void ReleaseComponent();
101
103 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
104 ENGINE_API class UPrimitiveComponent* GetGrabbedComponent() const;
105
107 UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsHandle")
108 ENGINE_API void SetTargetLocation(FVector NewLocation);
109
111 UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsHandle")
112 ENGINE_API void SetTargetRotation(FRotator NewRotation);
113
115 UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsHandle")
116 ENGINE_API void SetTargetLocationAndRotation(FVector NewLocation, FRotator NewRotation);
117
119 UFUNCTION(BlueprintCallable, Category="Physics|Components|PhysicsHandle")
120 ENGINE_API void GetTargetLocationAndRotation(FVector& TargetLocation, FRotator& TargetRotation) const;
121
123 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
124 ENGINE_API void SetLinearDamping(float NewLinearDamping);
125
127 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
128 ENGINE_API void SetLinearStiffness(float NewLinearStiffness);
129
131 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
132 ENGINE_API void SetAngularDamping(float NewAngularDamping);
133
135 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
136 ENGINE_API void SetAngularStiffness(float NewAngularStiffness);
137
139 UFUNCTION(BlueprintCallable, Category = "Physics|Components|PhysicsHandle")
140 ENGINE_API void SetInterpolationSpeed(float NewInterpolationSpeed);
141
144 ENGINE_API virtual void UpdateHandleTransform(const FTransform& NewTransform);
145
147 ENGINE_API virtual void UpdateDriveSettings();
148
149 ENGINE_API virtual void GrabComponentImp(class UPrimitiveComponent* Component, FName InBoneName, const FVector& Location, const FRotator& Rotation, bool bRotationConstrained);
150
151};
152
153
154
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ELevelTick
Definition EngineBaseTypes.h:70
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition SingleParticlePhysicsProxy.h:58
Definition NameTypes.h:617
Definition ChaosEngineInterface.h:247
Definition PhysicsUserData_Chaos.h:14
Definition ActorComponent.h:152
Definition PhysicsHandleComponent.h:17
FConstraintInstance ConstraintInstance
Definition PhysicsHandleComponent.h:71
FVector ConstraintLocalPosition
Definition PhysicsHandleComponent.h:75
FRotator ConstraintLocalRotation
Definition PhysicsHandleComponent.h:76
FPhysicsConstraintHandle ConstraintHandle
Definition PhysicsHandleComponent.h:74
FPhysicsActorHandle GrabbedHandle
Definition PhysicsHandleComponent.h:72
FPhysicsActorHandle KinematicHandle
Definition PhysicsHandleComponent.h:73
FPhysicsUserData PhysicsUserData
Definition PhysicsHandleComponent.h:70
bool bPendingConstraint
Definition PhysicsHandleComponent.h:68
FTransform PreviousTransform
Definition PhysicsHandleComponent.h:67
Definition EngineBaseTypes.h:571
Definition ConstraintInstance.h:255
Definition ObjectPtr.h:488