UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
InterpToMovementComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#if UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_4
6#include "CoreMinimal.h"
7#include "Engine/HitResult.h"
8#endif // UE_ENABLE_INCLUDE_ORDER_DEPRECATED_IN_5_4
11#include "InterpToMovementComponent.generated.h"
12
13struct FHitResult;
14
18UENUM(BlueprintType)
30
31USTRUCT(BlueprintType)
33{
35public:
36 // The position of the point
37 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Location, meta=(MakeEditWidget=true))
38 FVector PositionControlPoint;
39
40 // Is the location relative to the root components initial location
41 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Location)
42 bool bPositionIsRelative;
43
45 {
46 PositionControlPoint = FVector::ZeroVector;
47 bPositionIsRelative = true;
48 }
50 {
51 PositionControlPoint = InPosition;
52 bPositionIsRelative = bIsRelative;
53 }
54
55 float StartTime;
58};
59
65UCLASS(ClassGroup=Movement, meta=(BlueprintSpawnableComponent),HideCategories=Velocity, MinimalAPI)
67{
69
75
76 /* How long to take to move from the first point to the last (or vice versa) */
77 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Control,meta=(UIMin=0.1f, ClampMin=0.1f))
78 float Duration;
79
81 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Behaviour)
82 uint32 bPauseOnImpact:1;
83
85 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Behaviour)
86 bool bSweep = true;
87
89 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Behaviour)
91
92 /* Movement behaviour of the component */
93 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Behaviour)
94 EInterpToBehaviourType BehaviourType;
95
96 /* Do we want this comp to perform CheckStillInWorld checks? */
97 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Behaviour)
98 bool bCheckIfStillInWorld = true;
99
106 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Simulation)
107 uint32 bForceSubStepping:1;
108
110 UPROPERTY(BlueprintAssignable)
111 FOnInterpToReverseDelegate OnInterpToReverse;
112
114 UPROPERTY(BlueprintAssignable)
115 FOnInterpToStopDelegate OnInterpToStop;
116
118 UPROPERTY(BlueprintAssignable)
119 FOnInterpToWaitBeginDelegate OnWaitBeginDelegate;
120
122 UPROPERTY(BlueprintAssignable)
123 FOnInterpToWaitEndDelegate OnWaitEndDelegate;
124
126 UPROPERTY(BlueprintAssignable)
127 FOnInterpToResetDelegate OnResetDelegate;
128
129 //Begin UActorComponent Interface
130 ENGINE_API virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction) override;
131 ENGINE_API virtual void BeginPlay() override;
132 ENGINE_API virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift) override;
133 //End UActorComponent Interface
134
135 //Begin UMovementComponent Interface
136 ENGINE_API virtual void StopMovementImmediately() override;
137 //End UMovementComponent Interface
138
143 ENGINE_API virtual bool CheckStillInWorld();
144
146 UFUNCTION(BlueprintCallable, Category="Game|Components|InterpToMovement")
147 ENGINE_API void StopSimulating(const FHitResult& HitResult);
148
149 bool HasStoppedSimulation() { return UpdatedComponent == NULL; }
150
161 ENGINE_API float GetSimulationTimeStep(float RemainingTime, int32 Iterations) const;
162
169 ENGINE_API virtual bool ShouldUseSubStepping() const;
170
178 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(ClampMin="0.0166", ClampMax="0.50", UIMin="0.0166", UIMax="0.50"), Category=Simulation)
179 float MaxSimulationTimeStep;
180
184 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Simulation)
185 float SpeedMultiplier;
186
194 UPROPERTY(EditAnywhere, BlueprintReadWrite, meta=(ClampMin="1", ClampMax="25", UIMin="1", UIMax="25"), Category=Simulation)
195 int32 MaxSimulationIterations;
196
197 /* List of control points to visit. */
198 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Control)
200
201 /* Add a control point that represents a position. */
202 UFUNCTION(BlueprintCallable, Category = "Control")
203 ENGINE_API virtual void AddControlPointPosition(FVector Pos, bool bPositionIsRelative = true);
204
205 /* Reset to start. Sets time to zero and direction to 1. */
206 UFUNCTION(BlueprintCallable, Category = "Control")
207 ENGINE_API void RestartMovement(float InitialDirection = 1.0f);
208
209 /* Initialise the control points array. Call after adding control points if they are add after begin play . */
210 UFUNCTION(BlueprintCallable, Category = "Control")
211 ENGINE_API void FinaliseControlPoints();
212
213 /* Clear the control points array and set to stopped. */
214 UFUNCTION(BlueprintCallable, Category = "Control")
215 ENGINE_API void ResetControlPoints();
216
217#if WITH_EDITOR
218 //~ Begin UObject Interface.
219 ENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
220 //~ End UObject Interface.
221#endif // WITH_EDITOR
222
223protected:
224
226 ENGINE_API bool HandleHitWall(const FHitResult& Hit, float TimeTick, const FVector& MoveDelta);
227
229 ENGINE_API virtual void HandleImpact(const FHitResult& Hit, float TimeSlice=0.f, const FVector& MoveDelta = FVector::ZeroVector) override;
230
231 /* Reverse direction we are moving */
232 ENGINE_API void ReverseDirection(const FHitResult& Hit, float Time, bool InBroadcastEvent);
233
235 ENGINE_API virtual FVector ComputeMoveDelta(float Time) const;
236
237 /* Current position on spline */
239
240 /* User to */
242
243 /* Current direction along spline timeline */
245
246 /* Have we hit something and are waiting for it to move to carry on moving */
248
249 /* Have we stopped (because we hit something, or reached the end of the cycle */
251
252 /* Are there any actor control points in use*/
254
256 static ENGINE_API const float MIN_TICK_TIME;
257
258 /* Update the control points. Adjusts the positions of there are any actor control points as well as updating the spline type */
259 ENGINE_API virtual void UpdateControlPoints(bool InForceUpdate);
260
261 /* Calculate the new current time */
262 ENGINE_API float CalculateNewTime( float TimeNow, float Delta, FHitResult& HitResult, bool InBroadcastEvent, bool& OutStopped, float& OutTimeRemainder );
263
264private:
265 float TotalDistance;
266
267 FVector StartLocation;
268 bool bPointsFinalized;
269};
270
271
272
#define NULL
Definition oodle2base.h:134
FPlatformTypes::int32 int32
A 32-bit signed integer.
Definition Platform.h:1125
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
#define DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(DelegateName, Param1Type, Param1Name, Param2Type, Param2Name)
Definition DelegateCombinations.h:62
ELevelTick
Definition EngineBaseTypes.h:70
ETeleportType
Definition EngineTypes.h:2401
EInterpToBehaviourType
Definition InterpToMovementComponent.h:20
#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
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
#define GENERATED_USTRUCT_BODY(...)
Definition ObjectMacros.h:767
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Array.h:670
Definition InterpToMovementComponent.h:67
static ENGINE_API const float MIN_TICK_TIME
Definition InterpToMovementComponent.h:256
bool bContainsActorControlPoints
Definition InterpToMovementComponent.h:253
float TimeMultiplier
Definition InterpToMovementComponent.h:241
bool bIsWaiting
Definition InterpToMovementComponent.h:247
bool bStopped
Definition InterpToMovementComponent.h:250
float CurrentDirection
Definition InterpToMovementComponent.h:244
float CurrentTime
Definition InterpToMovementComponent.h:238
Definition MovementComponent.h:71
Definition EngineBaseTypes.h:571
Definition HitResult.h:21
FVector_NetQuantize Location
Definition HitResult.h:45
Definition InterpToMovementComponent.h:33
FInterpControlPoint(FVector InPosition, bool bIsRelative)
Definition InterpToMovementComponent.h:49
float DistanceToNext
Definition InterpToMovementComponent.h:56
float StartTime
Definition InterpToMovementComponent.h:55
float Percentage
Definition InterpToMovementComponent.h:57
Definition UnrealType.h:6865
static CORE_API const TVector< double > ZeroVector
Definition Vector.h:79