UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
PhysicsSpringComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3
4#pragma once
5
6#include "CoreMinimal.h"
9#include "PhysicsSpringComponent.generated.h"
10
11class UPrimitiveComponent;
12
19class UPhysicsSpringComponent : public USceneComponent
20{
22
23
24 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Physics)
25 float SpringStiffness;
26
28 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Physics)
29 float SpringDamping;
30
32 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Physics, meta = (UIMin = 0.01, ClampMin = 0.01))
33 float SpringLengthAtRest;
34
36 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Physics, meta = (UIMin = 0.01, ClampMin = 0.01))
37 float SpringRadius;
38
40 UPROPERTY(BlueprintReadWrite, Category = Physics)
42
44 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Physics, meta = (UIMin = 0.01, ClampMin = 0.01))
45 bool bIgnoreSelf;
46
48 UPROPERTY(BlueprintReadOnly, Category = Physics, transient)
49 float SpringCompression;
50
51 //~ Begin UActorComponent Interface
52 ENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
53 //~ End UActorComponent Interface
54
58 UFUNCTION(BlueprintCallable, Category = Physics)
59 ENGINE_API float GetNormalizedCompressionScalar() const;
60
62 UFUNCTION(BlueprintCallable, Category = Physics)
63 ENGINE_API FVector GetSpringRestingPoint() const;
64
66 UFUNCTION(BlueprintCallable, Category = Physics)
67 ENGINE_API FVector GetSpringCurrentEndPoint() const;
68
70 UFUNCTION(BlueprintCallable, Category = Physics)
71 ENGINE_API FVector GetSpringDirection() const;
72
73private:
74
76 UPrimitiveComponent* GetSpringCollision(const FVector& Start, const FVector& End, float& CollisionTime) const;
77
79 FVector ComputeNewSpringCompressionAndForce(const FVector& End, const float DeltaTime, float& NewSpringCompression) const;
80
82 void UpdateAttachedPosition() const;
83
85 FVector SpringPositionFromLength(float Length) const;
86
87 FVector CurrentEndPoint;
88};
89
90
91
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
Definition EnumAsByte.h:22
Definition PhysicsSpringComponent.h:20
Definition EngineBaseTypes.h:571