UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ScopedMovementUpdate.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
10
11struct FHitResult;
12enum class ETeleportType : uint8;
13
47
56{
57public:
60
63
69
70 enum class EOverlapState
71 {
76 };
77
80
82 bool IsDeferringUpdates() const;
83
85 bool IsGroupUpdate() const;
86
89
92
94 ENGINE_API bool IsTransformDirty() const;
95
97 bool HasPendingOverlaps() const;
98
103 bool RequiresOverlapsEventFlag() const;
104
107
110
111 //--------------------------------------------------------------------------------------------------------//
112 // These methods are intended only to be used by SceneComponent and derived classes.
113
116
118 void KeepCurrentOverlapsAfterRotation(bool bSweep);
119
121 void AppendBlockingHitAfterMove(const FHitResult& Hit);
122
125
127 void ForceOverlapUpdate();
128
131
134
136 bool GetHasMoved() const;
137
142
145
147 const FTransform& GetInitialTransform() const;
148
150 USceneComponent* GetOwner() const;
151
152protected:
155
157
158private:
160 ENGINE_API void OnInnerScopeComplete(const FScopedMovementUpdate& InnerScope);
161
162 // This class can only be created on the stack, otherwise the ordering constraints
163 // of the constructor and destructor between encapsulated scopes could be violated.
164 void* operator new (size_t) = delete;
165 void* operator new[] (size_t) = delete;
166 void operator delete (void *) = delete;
167 void operator delete[] (void*) = delete;
168
169protected:
172
175
180
181 int32 FinalOverlapCandidatesIndex; // If not INDEX_NONE, overlaps at this index and beyond in PendingOverlaps are at the final destination
182 TScopedOverlapInfoArray PendingOverlaps; // All overlaps encountered during the scope of moves.
183 TScopedBlockingHitArray BlockingHits; // All blocking hits encountered during the scope of moves.
184
188
193
194 friend class USceneComponent;
195};
196
198// FScopedMovementUpdate inlines
199
204
206{
207 return bDeferUpdates;
208}
209
211{
213}
214
219
221{
222 return PendingOverlaps.Num() > 0;
223}
224
229
234
239
244
246{
247 bHasMoved = true;
248 // CurrentOverlapState is unchanged
249}
250
257
264
266{
267 // Request an initialization. Teleport type can only go higher - i.e. if we have requested a reset, then a teleport will still reset fully
269}
270
275
277{
278 return bHasMoved;
279}
280
285
290
295
296inline USceneComponent* FScopedMovementUpdate::GetOwner() const
297{
298 return Owner;
299}
@ INDEX_NONE
Definition CoreMiscDefines.h:150
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
ETeleportType
Definition EngineTypes.h:2401
uint8_t uint8
Definition binka_ue_file_header.h:8
Definition UnrealTemplate.h:321
Definition ScopedMovementUpdate.h:56
bool IsGroupUpdate() const
Definition ScopedMovementUpdate.h:210
EOverlapState GetOverlapState() const
Definition ScopedMovementUpdate.h:286
void InvalidateCurrentOverlaps()
Definition ScopedMovementUpdate.h:251
USceneComponent * Owner
Definition ScopedMovementUpdate.h:170
FVector InitialRelativeLocation
Definition ScopedMovementUpdate.h:177
TArray< FHitResult, TInlineAllocator< 2 > > TScopedBlockingHitArray
Definition ScopedMovementUpdate.h:58
ENGINE_API TOptional< TOverlapArrayView > GetOverlapsAtEnd(class UPrimitiveComponent &PrimComponent, TInlineOverlapInfoArray &OutEndOverlaps, bool bTransformChanged) const
Definition ScopedMovementUpdate.cpp:214
ETeleportType GetTeleportType() const
Definition ScopedMovementUpdate.h:271
EOverlapState CurrentOverlapState
Definition ScopedMovementUpdate.h:173
const FTransform & GetInitialTransform() const
Definition ScopedMovementUpdate.h:291
TArray< FOverlapInfo, TInlineAllocator< 3 > > TScopedOverlapInfoArray
Definition ScopedMovementUpdate.h:59
void SetHasTeleported(ETeleportType InTeleportType)
Definition ScopedMovementUpdate.h:265
EOverlapState
Definition ScopedMovementUpdate.h:71
const TScopedBlockingHitArray & GetPendingBlockingHits() const
Definition ScopedMovementUpdate.h:235
void ForceOverlapUpdate()
Definition ScopedMovementUpdate.h:258
int32 FinalOverlapCandidatesIndex
Definition ScopedMovementUpdate.h:181
EHasMovedTransformOption
Definition ScopedMovementUpdate.h:65
bool IsDeferringUpdates() const
Definition ScopedMovementUpdate.h:205
bool HasMoved(EHasMovedTransformOption CheckTransform) const
Definition ScopedMovementUpdate.h:215
uint8 bDeferUpdates
Definition ScopedMovementUpdate.h:185
void AppendBlockingHitAfterMove(const FHitResult &Hit)
Definition ScopedMovementUpdate.h:240
ENGINE_API ~FScopedMovementUpdate()
Definition ScopedMovementUpdate.cpp:73
void KeepCurrentOverlapsAfterRotation(bool bSweep)
Definition ScopedMovementUpdate.h:245
FVector InitialRelativeScale
Definition ScopedMovementUpdate.h:179
ENGINE_API void AppendOverlapsAfterMove(const TOverlapArrayView &NewPendingOverlaps, bool bSweep, bool bIncludesOverlapsAtEnd)
Definition ScopedMovementUpdate.cpp:123
FRotator InitialRelativeRotation
Definition ScopedMovementUpdate.h:178
uint8 bHasMoved
Definition ScopedMovementUpdate.h:186
uint8 bRequireOverlapsEventFlag
Definition ScopedMovementUpdate.h:187
ETeleportType TeleportType
Definition ScopedMovementUpdate.h:174
TScopedBlockingHitArray BlockingHits
Definition ScopedMovementUpdate.h:183
bool HasPendingOverlaps() const
Definition ScopedMovementUpdate.h:220
USceneComponent * GetOwner() const
Definition ScopedMovementUpdate.h:296
bool GetHasMoved() const
Definition ScopedMovementUpdate.h:276
FScopedMovementUpdate * OuterDeferredScope
Definition ScopedMovementUpdate.h:171
ENGINE_API bool SetWorldLocationAndRotation(FVector NewLocation, const FQuat &NewQuat, bool bNoPhysics, ETeleportType Teleport)
Definition ScopedMovementUpdate.cpp:205
uint8 bIsGroupDeferedUpdate
Definition ScopedMovementUpdate.h:192
bool RequiresOverlapsEventFlag() const
Definition ScopedMovementUpdate.h:225
ENGINE_API bool IsTransformDirty() const
Definition ScopedMovementUpdate.cpp:82
friend class USceneComponent
Definition ScopedMovementUpdate.h:194
const FScopedMovementUpdate * GetOuterDeferredScope() const
Definition ScopedMovementUpdate.h:200
int32 GetFinalOverlapCandidatesIndex() const
Definition ScopedMovementUpdate.h:281
FTransform InitialTransform
Definition ScopedMovementUpdate.h:176
ENGINE_API void RevertMove()
Definition ScopedMovementUpdate.cpp:92
const TScopedOverlapInfoArray & GetPendingOverlaps() const
Definition ScopedMovementUpdate.h:230
TScopedOverlapInfoArray PendingOverlaps
Definition ScopedMovementUpdate.h:182
Definition ArrayView.h:139
Definition Array.h:670
UE_REWRITE SizeType Num() const
Definition Array.h:1144
UE_NODEBUG UE_FORCEINLINE_HINT SizeType Add(ElementType &&Item)
Definition Array.h:2696
Definition ScopedMovementUpdate.h:20
Type
Definition ScopedMovementUpdate.h:22
@ DeferredUpdates
Definition ScopedMovementUpdate.h:27
@ DeferredGroupUpdates
Definition ScopedMovementUpdate.h:44
@ ImmediateUpdates
Definition ScopedMovementUpdate.h:24
Definition HitResult.h:21
Definition Optional.h:131