UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
SceneComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "EngineDefines.h"
12
13#include "SceneComponent.generated.h"
14
15class AActor;
16class APhysicsVolume;
17class USceneComponent;
19struct FHitResult;
20struct FLevelCollection;
21
22struct FOverlapInfo;
24namespace ERHIFeatureLevel { enum Type : int; }
25
30UENUM()
32{
33 DM_Low UMETA(DisplayName="Low"),
34 DM_Medium UMETA(DisplayName="Medium"),
35 DM_High UMETA(DisplayName="High"),
36 DM_Epic UMETA(DisplayName="Epic"),
38};
39
41UENUM()
53
70// Declare bitwise operators to allow EMoveComponentFlags to be combined but still retain type safety
72
74#define SCENECOMPONENT_QUAT_TOLERANCE (1.e-8f)
76#define SCENECOMPONENT_ROTATOR_TOLERANCE (1.e-4f)
77
80DECLARE_EVENT_ThreeParams(USceneComponent, FTransformUpdated, USceneComponent* /*UpdatedComponent*/, EUpdateTransformFlags /*UpdateTransformFlags*/, ETeleportType /*Teleport*/);
81
87UCLASS(ClassGroup=(Utility, Common), BlueprintType, hideCategories=(Trigger, PhysicsVolume), meta=(BlueprintSpawnableComponent, IgnoreCategoryKeywordsInSubclasses, ShortTooltip="A Scene Component is a component that has a scene transform and can be attached to other scene components."), MinimalAPI)
88class USceneComponent : public UActorComponent
89{
91
92public:
95
98
100 const FLevelCollection* CachedLevelCollection;
101
102private:
106
108 UPROPERTY(ReplicatedUsing = OnRep_AttachParent)
109 TObjectPtr<USceneComponent> AttachParent;
110
112 UPROPERTY(ReplicatedUsing = OnRep_AttachSocketName)
113 FName AttachSocketName;
114
116
118 UPROPERTY(ReplicatedUsing = OnRep_AttachChildren, Transient)
119 TArray<TObjectPtr<USceneComponent>> AttachChildren;
120
123 TArray<TObjectPtr<USceneComponent>> ClientAttachedChildren;
124
125 USceneComponent* NetOldAttachParent;
126
127public:
129 FBoxSphereBounds Bounds;
130
131private:
133 UPROPERTY(EditAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_Transform, Category = Transform, meta=(AllowPrivateAccess="true", LinearDeltaSensitivity = "1", Delta = "1.0"))
135
137 UPROPERTY(EditAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_Transform, Category=Transform, meta=(AllowPrivateAccess="true", LinearDeltaSensitivity = "1", Delta = "1.0"))
139
144 UPROPERTY(EditAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_Transform, Category=Transform, meta=(AllowPrivateAccess="true", LinearDeltaSensitivity = "1", Delta = "0.0025"))
146
147public:
152 UPROPERTY()
154
155private:
159
163
165 UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadWrite, ReplicatedUsing=OnRep_Transform, Category=Transform, meta=(AllowPrivateAccess="true"))
166 uint8 bAbsoluteLocation:1;
167
169 UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadWrite, ReplicatedUsing=OnRep_Transform, Category=Transform, meta=(AllowPrivateAccess="true"))
171
173 UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadWrite, ReplicatedUsing=OnRep_Transform, Category=Transform, meta=(AllowPrivateAccess="true"))
175
177 UPROPERTY(EditAnywhere, BlueprintReadOnly, ReplicatedUsing=OnRep_Visibility, Category = Rendering, meta=(AllowPrivateAccess="true"))
178 uint8 bVisible:1;
179
183
186
189
192
193#if WITH_EDITORONLY_DATA
196 uint8 bHiddenEdTemporary : 1;
197#endif // WITH_EDITORONLY_DATA
198
201
204
207
210
215 UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintGetter=GetShouldUpdatePhysicsVolume, BlueprintSetter=SetShouldUpdatePhysicsVolume, Category=Physics)
217
218public:
220 UPROPERTY(Interp, EditAnywhere, BlueprintReadOnly, Category=Rendering, meta=(SequencerTrackClass = "/Script/MovieSceneTracks.MovieSceneVisibilityTrack"))
221 uint8 bHiddenInGame:1;
222
224 UPROPERTY()
226
230 UPROPERTY(EditAnywhere, BlueprintReadWrite, AdvancedDisplay, Category=Rendering)
232
234 UPROPERTY()
236
238 UPROPERTY()
240
242 UPROPERTY()
244
246 ENGINE_API FBoxSphereBounds GetLocalBounds() const;
247
250
252 bool ShouldSkipUpdateOverlaps() const
253 {
255 }
256
258 UFUNCTION(BlueprintGetter)
259 bool GetShouldUpdatePhysicsVolume() const;
260
262 UFUNCTION(BlueprintSetter)
264
266 UPROPERTY()
268
272
275
281
282private:
285
286public:
289
290#if WITH_EDITORONLY_DATA
292 UPROPERTY()
294#endif
295
297 UPROPERTY(Category = Mobility, EditAnywhere, BlueprintReadOnly, Replicated)
299
305 UPROPERTY(EditAnywhere, AdvancedDisplay, BlueprintReadOnly, Category = LOD)
307
309 UPROPERTY(BlueprintAssignable, Category=PhysicsVolume, meta=(DisplayName="Physics Volume Changed"))
311
314
315#if WITH_EDITORONLY_DATA
316protected:
322#endif
323
324public:
326 FTransformUpdated TransformUpdated;
327
330
336 void ProcessDeferredMovementGroup(const struct FDeferredComponentMoveData& MoveData);
337
341 UFUNCTION()
343
344private:
347
350
352 void AttachToParent();
353
356
359
361 FTransform ComponentToWorld;
362
363public:
366
369
370
371#if WITH_STATE_STREAM_ACTOR
372protected:
373 FTransformHandle TransformHandle;
374
375public:
377#endif
378
379private:
380 UFUNCTION()
382
383 UFUNCTION()
385
386 UFUNCTION()
388
389 UFUNCTION()
391
392 UFUNCTION()
393 ENGINE_API void OnRep_Visibility(bool OldValue);
394
395public:
402
415
427 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set Relative Location", ScriptName="SetRelativeLocation"))
430
440 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set Relative Rotation", ScriptName="SetRelativeRotation", AdvancedDisplay="bSweep,SweepHitResult,bTeleport"))
441 ENGINE_API void K2_SetRelativeRotation(FRotator NewRotation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);
443 void SetRelativeRotation(const FQuat& NewRotation, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None);
444
454 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set Relative Transform", ScriptName="SetRelativeTransform"))
455 ENGINE_API void K2_SetRelativeTransform(const FTransform& NewTransform, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);
456 ENGINE_API void SetRelativeTransform(const FTransform& NewTransform, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None);
457
459 UFUNCTION(BlueprintCallable, Category="Transformation")
460 ENGINE_API FTransform GetRelativeTransform() const;
461
463 UFUNCTION(BlueprintCallable, Category="Transformation")
465
467 UFUNCTION(BlueprintCallable, Category="Transformation")
469
481 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add Relative Location", ScriptName="AddRelativeLocation"))
484
494 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add Relative Rotation", ScriptName="AddRelativeRotation", AdvancedDisplay="bSweep,SweepHitResult,bTeleport"))
495 ENGINE_API void K2_AddRelativeRotation(FRotator DeltaRotation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);
498
510 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add Local Offset", ScriptName="AddLocalOffset", Keywords="location position"))
513
523 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add Local Rotation", ScriptName="AddLocalRotation", AdvancedDisplay="bSweep,SweepHitResult,bTeleport"))
524 ENGINE_API void K2_AddLocalRotation(FRotator DeltaRotation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);
526 ENGINE_API void AddLocalRotation(const FQuat& DeltaRotation, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None);
527
539 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add Local Transform", ScriptName="AddLocalTransform"))
542
554 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set World Location", ScriptName="SetWorldLocation"))
557
558 /*
559 * Put this component at the specified rotation in world space. Updates relative rotation to achieve the final world rotation.
560 * @param NewRotation New rotation in world space for the component.
561 * @param SweepHitResult Hit result from any impact if sweep is true.
562 * @param bSweep Whether we sweep to the destination (currently not supported for rotation).
563 * @param bTeleport Whether we teleport the physics state (if physics collision is enabled for this object).
564 * If true, physics velocity for this object is unchanged (so ragdoll parts are not affected by change in location).
565 * If false, physics velocity is updated based on the change in position (affecting ragdoll parts).
566 * If CCD is on and not teleporting, this will affect objects along the entire sweep volume.
567 */
568 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set World Rotation", ScriptName="SetWorldRotation", AdvancedDisplay="bSweep,SweepHitResult,bTeleport"))
569 ENGINE_API void K2_SetWorldRotation(FRotator NewRotation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);
572
577 UFUNCTION(BlueprintCallable, Category="Transformation")
579
591 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set World Transform", ScriptName="SetWorldTransform"))
592 ENGINE_API void K2_SetWorldTransform(const FTransform& NewTransform, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);
593 ENGINE_API void SetWorldTransform(const FTransform& NewTransform, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None);
594
606 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add World Offset", ScriptName="AddWorldOffset", Keywords="location position"))
609
620 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add World Rotation", ScriptName="AddWorldRotation", AdvancedDisplay="bSweep,SweepHitResult,bTeleport"))
621 ENGINE_API void K2_AddWorldRotation(FRotator DeltaRotation, bool bSweep, FHitResult& SweepHitResult, bool bTeleport);
623 ENGINE_API void AddWorldRotation(const FQuat& DeltaRotation, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None);
624
636 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add World Transform", ScriptName="AddWorldTransform"))
639
651 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Add World Transform Keep Scale", ScriptName="AddWorldTransformKeepScale"))
654
656 UFUNCTION(BlueprintCallable, meta=(DisplayName = "Get World Location", ScriptName = "GetWorldLocation", Keywords = "position"), Category="Transformation")
658
660 UFUNCTION(BlueprintCallable, meta=(DisplayName = "Get World Rotation", ScriptName = "GetWorldRotation"), Category="Transformation")
662
664 UFUNCTION(BlueprintCallable, meta=(DisplayName = "Get World Scale", ScriptName = "GetWorldScale"), Category="Transformation")
666
668 UFUNCTION(BlueprintCallable, meta=(DisplayName = "Get World Transform", ScriptName = "GetWorldTransform"), Category="Transformation")
670
672 UFUNCTION(BlueprintCallable, Category="Transformation")
673 ENGINE_API FVector GetForwardVector() const;
674
676 UFUNCTION(BlueprintCallable, Category="Transformation")
677 ENGINE_API FVector GetUpVector() const;
678
680 UFUNCTION(BlueprintCallable, Category="Transformation")
681 ENGINE_API FVector GetRightVector() const;
682
684 UFUNCTION(BlueprintCallable, Category="Physics")
686
688 UFUNCTION(BlueprintCallable, Category="Physics")
690
692 const TArray<TObjectPtr<USceneComponent>>& GetAttachChildren() const;
693
695 UFUNCTION(BlueprintCallable, Category="Transformation")
696 USceneComponent* GetAttachParent() const;
697
699 UFUNCTION(BlueprintCallable, Category="Transformation")
701
703 UFUNCTION(BlueprintCallable, Category="Components")
704 ENGINE_API void GetParentComponents(TArray<USceneComponent*>& Parents) const;
705
707 UFUNCTION(BlueprintCallable, Category="Components")
709
711 UFUNCTION(BlueprintCallable, Category="Components")
712 ENGINE_API USceneComponent* GetChildComponent(int32 ChildIndex) const;
713
719 UFUNCTION(BlueprintCallable, Category="Components")
720 ENGINE_API void GetChildrenComponents(bool bIncludeAllDescendants, TArray<USceneComponent*>& Children) const;
721
729 ENGINE_API void SetupAttachment(USceneComponent* InParent, FName InSocketName = NAME_None);
730
733
735 UE_DEPRECATED(4.17, "This function is deprecated, please use AttachToComponent() instead.")
736 UFUNCTION(BlueprintCallable, Category = "Transformation", meta = (DeprecationMessage = "OVERRIDE BAD MESSAGE", DisplayName = "AttachTo (Deprecated)", AttachType = "KeepRelativeOffset"))
737 ENGINE_API bool K2_AttachTo(USceneComponent* InParent, FName InSocketName = NAME_None, EAttachLocation::Type AttachType = EAttachLocation::KeepRelativeOffset, bool bWeldSimulatedBodies = true);
738
747 ENGINE_API virtual bool AttachToComponent(USceneComponent* InParent, const FAttachmentTransformRules& AttachmentRules, FName InSocketName = NAME_None );
748
759 UFUNCTION(BlueprintCallable, Category = "Transformation", meta = (DisplayName = "Attach Component To Component", ScriptName = "AttachToComponent", bWeldSimulatedBodies=true))
760 ENGINE_API bool K2_AttachToComponent(USceneComponent* Parent, FName SocketName, EAttachmentRule LocationRule, EAttachmentRule RotationRule, EAttachmentRule ScaleRule, bool bWeldSimulatedBodies);
761
763 UE_DEPRECATED(4.12, "This function is deprecated, please use DetachFromComponent() instead.")
764 UFUNCTION(BlueprintCallable, Category = "Transformation", meta = (DisplayName = "DetachFromParent (Deprecated)"))
765 ENGINE_API virtual void DetachFromParent(bool bMaintainWorldPosition = false, bool bCallModify = true);
766
774 UFUNCTION(BlueprintCallable, meta = (DisplayName = "Detach From Component", ScriptName = "DetachFromComponent"), Category = "Transformation")
776
782
787 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(Keywords="Bone"))
789
795 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(Keywords="Bone"))
796 ENGINE_API virtual FTransform GetSocketTransform(FName InSocketName, ERelativeTransformSpace TransformSpace = RTS_World) const;
797
803 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(Keywords="Bone"))
804 ENGINE_API virtual FVector GetSocketLocation(FName InSocketName) const;
805
811 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(Keywords="Bone"))
813
819 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(Keywords="Bone", DeprecatedFunction, DeprecationMessage="Use GetSocketRotation instead, Quat is not fully supported in blueprints."))
821
826 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(Keywords="Bone"))
827 ENGINE_API virtual bool DoesSocketExist(FName InSocketName) const;
828
832 ENGINE_API virtual bool HasAnySockets() const;
833
837 ENGINE_API virtual void QuerySupportedSockets(TArray<FComponentSocketDescription>& OutSockets) const;
838
843 UFUNCTION(BlueprintCallable, Category="Transformation")
844 ENGINE_API virtual FVector GetComponentVelocity() const;
845
847 UFUNCTION(BlueprintCallable, Category="Rendering")
848 ENGINE_API virtual bool IsVisible() const;
849
850#if WITH_EDITOR
865#endif // WITH_EDITOR
866
867protected:
871 ENGINE_API virtual void OnVisibilityChanged();
872
876 ENGINE_API virtual void OnHiddenInGameChanged();
877
878private:
882 enum class EVisibilityPropagation : uint8
883 {
886
888 DirtyOnly,
889
892 };
893
898
903
906
907public:
911 UFUNCTION(BlueprintCallable, Category="Rendering")
912 void SetVisibility(bool bNewVisibility, bool bPropagateToChildren=false)
913 {
914 SetVisibility(bNewVisibility, bPropagateToChildren ? EVisibilityPropagation::Propagate : EVisibilityPropagation::DirtyOnly);
915 }
916
920 UFUNCTION(BlueprintCallable, Category="Rendering")
922 {
923 SetVisibility(!GetVisibleFlag(), bPropagateToChildren);
924 }
925
927 UFUNCTION(BlueprintCallable, Category="Development")
929 {
930 SetHiddenInGame(NewHidden, bPropagateToChildren ? EVisibilityPropagation::Propagate : EVisibilityPropagation::DirtyOnly);
931 }
932
933#if WITH_EDITOR
934 UE_DEPRECATED(5.7, "IsTemporarilyHiddenInEditor is now deprecated.")
936 {
937 return bHiddenEdTemporary;
938 }
944#endif // WITH_EDITOR
945
946 //~ Begin ActorComponent Interface
947 ENGINE_API virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
948 ENGINE_API virtual void OnPreRegister() override;
949 ENGINE_API virtual void OnRegister() override;
950 ENGINE_API virtual void OnUnregister() override;
951 ENGINE_API virtual void EndPlay(EEndPlayReason::Type Reason) override;
952 virtual bool ShouldCreateRenderState() const override { return true; }
954 {
956 }
957 ENGINE_API virtual void DestroyComponent(bool bPromoteChildren = false) override;
958 ENGINE_API virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
959 ENGINE_API virtual void ApplyWorldOffset(const FVector& InOffset, bool bWorldShift) override;
960 ENGINE_API virtual TStructOnScope<FActorComponentInstanceData> GetComponentInstanceData() const override;
961#if WITH_EDITOR
962 ENGINE_API virtual FBox GetStreamingBounds() const override;
963#endif // WITH_EDITOR
964
965 //~ End ActorComponent Interface
966
967 //~ Begin UObject Interface
968 ENGINE_API virtual void BeginDestroy() override;
969 ENGINE_API virtual bool IsPostLoadThreadSafe() const override;
970 ENGINE_API virtual void PreNetReceive() override;
971 ENGINE_API virtual void PostNetReceive() override;
972 ENGINE_API virtual void PostRepNotifies() override;
973 ENGINE_API virtual void Serialize(FArchive& Ar) override;
974#if WITH_EDITORONLY_DATA
975 static ENGINE_API void AddReferencedObjects(UObject* InThis, FReferenceCollector& Collector);
976#endif
977
978#if WITH_EDITOR
979 ENGINE_API virtual EDataValidationResult IsDataValid(FDataValidationContext& Context) const override;
980 ENGINE_API virtual bool NeedsLoadForTargetPlatform(const ITargetPlatform* TargetPlatform) const;
981 ENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
982 ENGINE_API virtual void PostEditChangeChainProperty(FPropertyChangedChainEvent& PropertyChangedEvent) override;
983 ENGINE_API virtual bool CanEditChange(const FProperty* Property) const override;
984#endif
985 //~ End UObject Interface
986
987protected:
993
996
999
1001 ENGINE_API virtual bool UpdateOverlapsImpl(const TOverlapArrayView* PendingOverlaps = nullptr, bool bDoNotifies = true, const TOverlapArrayView* OverlapsAtEndLocation = nullptr);
1002
1003private:
1006
1007public:
1008
1010 ENGINE_API bool UpdateOverlaps(const TOverlapArrayView* PendingOverlaps = nullptr, bool bDoNotifies = true, const TOverlapArrayView* OverlapsAtEndLocation = nullptr);
1011
1032 bool MoveComponent( const FVector& Delta, const FQuat& NewRotation, bool bSweep, FHitResult* Hit=NULL, EMoveComponentFlags MoveFlags = MOVECOMP_NoFlags, ETeleportType Teleport = ETeleportType::None);
1033 ENGINE_API bool MoveComponent( const FVector& Delta, const FRotator& NewRotation, bool bSweep, FHitResult* Hit=NULL, EMoveComponentFlags MoveFlags = MOVECOMP_NoFlags, ETeleportType Teleport = ETeleportType::None);
1034
1035protected:
1037 ENGINE_API virtual bool MoveComponentImpl(const FVector& Delta, const FQuat& NewRotation, bool bSweep, FHitResult* Hit = NULL, EMoveComponentFlags MoveFlags = MOVECOMP_NoFlags, ETeleportType Teleport = ETeleportType::None);
1038
1040
1042
1043public:
1046
1048 bool IsDeferringMovementUpdates() const;
1049
1051 bool HasGroupedMovementUpdates() const;
1052
1054 virtual void OnAttachmentChanged() {}
1055
1057 inline FVector GetComponentLocation() const
1058 {
1059 return GetComponentTransform().GetLocation();
1060 }
1061
1063 inline FRotator GetComponentRotation() const
1064 {
1065 return WorldRotationCache.NormalizedQuatToRotator(GetComponentTransform().GetRotation());
1066 }
1067
1069 inline FQuat GetComponentQuat() const
1070 {
1072 }
1073
1075 inline FVector GetComponentScale() const
1076 {
1077 return GetComponentTransform().GetScale3D();
1078 }
1079
1081 inline void SetComponentToWorld(const FTransform& NewComponentToWorld)
1082 {
1084 ComponentToWorld = NewComponentToWorld;
1085 }
1086
1091 inline const FTransform& GetComponentToWorld() const
1092 {
1093 return ComponentToWorld;
1094 }
1095
1097 inline const FTransform& GetComponentTransform() const
1098 {
1099 return ComponentToWorld;
1100 }
1101
1104
1106 ENGINE_API virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const;
1107
1109 virtual FBoxSphereBounds CalcLocalBounds() const
1110 {
1111 return GetLocalBounds();
1112 }
1113
1118 ENGINE_API virtual void CalcBoundingCylinder(float& CylinderRadius, float& CylinderHalfHeight) const;
1119
1121 ENGINE_API virtual void UpdateBounds();
1122
1124 virtual bool ShouldCollideWhenPlacing() const
1125 {
1126 return false;
1127 }
1128
1135
1143
1147 UFUNCTION(BlueprintCallable, Category=PhysicsVolume, meta=(UnsafeDuringActorConstruction="true"))
1148 ENGINE_API APhysicsVolume* GetPhysicsVolume() const;
1149
1151 ENGINE_API virtual const FCollisionResponseContainer& GetCollisionResponseToChannels() const;
1152
1155
1157 ENGINE_API bool ShouldRender() const;
1158
1160 ENGINE_API bool CanEverRender() const;
1161
1168
1169#if WITH_EDITOR
1171 ENGINE_API virtual void PostEditComponentMove(bool bFinished);
1172
1175
1178#endif // WITH_EDITOR
1179
1180protected:
1181
1185 inline FTransform CalcNewComponentToWorld(const FTransform& NewRelativeTransform, const USceneComponent* Parent = nullptr, FName SocketName = NAME_None) const
1186 {
1187 SocketName = Parent ? SocketName : GetAttachSocketName();
1189 if (Parent)
1190 {
1192 if (!bGeneral)
1193 {
1194 return NewRelativeTransform * Parent->GetSocketTransform(SocketName);
1195 }
1196
1198 }
1199 else
1200 {
1201 return NewRelativeTransform;
1202 }
1203 }
1204
1207
1208public:
1221 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set Relative Location And Rotation", ScriptName="SetRelativeLocationAndRotation"))
1225
1227 UFUNCTION(BlueprintCallable, Category="Transformation")
1229
1242 UFUNCTION(BlueprintCallable, Category="Transformation", meta=(DisplayName="Set World Location And Rotation", ScriptName="SetWorldLocationAndRotation"))
1244 ENGINE_API void SetWorldLocationAndRotation(FVector NewLocation, FRotator NewRotation, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None);
1245
1247 ENGINE_API void SetWorldLocationAndRotation(FVector NewLocation, const FQuat& NewRotation, bool bSweep=false, FHitResult* OutSweepHitResult=nullptr, ETeleportType Teleport = ETeleportType::None);
1248
1251
1253 ENGINE_API virtual bool IsWorldGeometry() const;
1254
1256 ENGINE_API virtual ECollisionEnabled::Type GetCollisionEnabled() const;
1257
1259 inline bool IsCollisionEnabled() const
1260 {
1261 return GetCollisionEnabled() != ECollisionEnabled::NoCollision;
1262 }
1263
1265 inline bool IsQueryCollisionEnabled() const
1266 {
1267 return CollisionEnabledHasQuery(GetCollisionEnabled());
1268 }
1269
1271 inline bool IsPhysicsCollisionEnabled() const
1272 {
1273 return CollisionEnabledHasPhysics(GetCollisionEnabled());
1274 }
1275
1277 ENGINE_API virtual ECollisionResponse GetCollisionResponseToChannel(ECollisionChannel Channel) const;
1278
1280 ENGINE_API virtual ECollisionChannel GetCollisionObjectType() const;
1281
1283 ENGINE_API ECollisionResponse GetCollisionResponseToComponent(USceneComponent* OtherComponent) const;
1284
1286 UFUNCTION(BlueprintCallable, Category="Transformation")
1287 ENGINE_API virtual void SetMobility(EComponentMobility::Type NewMobility);
1288
1290 ENGINE_API USceneComponent* GetAttachmentRoot() const;
1291
1294
1296 ENGINE_API FVector GetActorPositionForRenderer() const;
1297
1299 ENGINE_API AActor* GetAttachParentActor() const;
1300
1302 ENGINE_API bool IsAttachedTo(const USceneComponent* TestComp) const;
1303
1312 ENGINE_API void GetSocketWorldLocationAndRotation(FName InSocketName, FVector& OutLocation, FRotator& OutRotation) const;
1313 ENGINE_API void GetSocketWorldLocationAndRotation(FName InSocketName, FVector& OutLocation, FQuat& OutRotation) const;
1314
1319 virtual bool CanAttachAsChild(const USceneComponent* ChildComponent, FName SocketName) const { return true; }
1320
1322 ENGINE_API virtual FBoxSphereBounds GetPlacementExtent() const;
1323
1324private:
1325 friend class AActor;
1326
1328
1329protected:
1334 virtual void OnChildAttached(USceneComponent* ChildComponent) {}
1335
1340 virtual void OnChildDetached(USceneComponent* ChildComponent) {}
1341
1344
1347
1354 inline bool AreDynamicDataChangesAllowed(bool bIgnoreStationary = true) const
1355 {
1356 return (IsOwnerRunningUserConstructionScript()) || !(IsRegistered() && (Mobility == EComponentMobility::Static || (!bIgnoreStationary && Mobility == EComponentMobility::Stationary)));
1357 }
1358
1359public:
1361 virtual const bool CanHaveStaticMobility() const { return true; }
1362
1364 virtual void PropagateLightingScenarioChange() {}
1365
1367 virtual bool IsPrecomputedLightingValid() const
1368 {
1369 return false;
1370 }
1371
1372private:
1373 friend class FScopedMovementUpdate;
1375 friend struct FDirectAttachChildrenAccessor;
1376
1377 //~ Begin Methods for Replicated Members.
1378private:
1379
1384 ENGINE_API void SetAttachParent(USceneComponent* NewAttachParent);
1385
1391
1397
1398public:
1399
1405 virtual void OnReceiveReplicatedState(const FVector X, const FQuat R, const FVector V, const FVector W) {};
1406
1414 {
1415 return GET_MEMBER_NAME_CHECKED(USceneComponent, RelativeLocation);
1416 }
1417
1426 FVector GetRelativeLocation() const
1427 {
1428 return RelativeLocation;
1429 }
1430
1442
1449
1457 {
1458 return GET_MEMBER_NAME_CHECKED(USceneComponent, RelativeRotation);
1459 }
1460
1469 FRotator GetRelativeRotation() const
1470 {
1471 return RelativeRotation;
1472 }
1473
1485
1492
1500 {
1501 return GET_MEMBER_NAME_CHECKED(USceneComponent, RelativeScale3D);
1502 }
1503
1513 {
1514 return RelativeScale3D;
1515 }
1516
1528
1535
1542 {
1546 }
1547
1555 {
1556 return GET_MEMBER_NAME_CHECKED(USceneComponent, bAbsoluteLocation);
1557 }
1558
1565 bool IsUsingAbsoluteLocation() const
1566 {
1567 return bAbsoluteLocation;
1568 }
1569
1572
1580 {
1581 return GET_MEMBER_NAME_CHECKED(USceneComponent, bAbsoluteRotation);
1582 }
1583
1590 bool IsUsingAbsoluteRotation() const
1591 {
1592 return bAbsoluteRotation;
1593 }
1594
1597
1603 static const FName GetAbsoluteScalePropertyName()
1604 {
1605 return GET_MEMBER_NAME_CHECKED(USceneComponent, bAbsoluteScale);
1606 }
1607
1614 bool IsUsingAbsoluteScale() const
1615 {
1616 return bAbsoluteScale;
1617 }
1618
1621
1627 static const FName GetVisiblePropertyName()
1628 {
1629 return GET_MEMBER_NAME_CHECKED(USceneComponent, bVisible);
1630 }
1631
1640 bool GetVisibleFlag() const
1641 {
1642 return bVisible;
1643 }
1644
1650 ENGINE_API void SetVisibleFlag(const bool bInVisible);
1651
1652 //~ End Methods for Replicated Members.
1653
1657 EComponentMobility::Type GetMobility() const
1658 {
1659 return Mobility;
1660 }
1661};
1662
1668{
1669private:
1670 static TArray<TObjectPtr<USceneComponent>>& Get(USceneComponent* Component)
1671 {
1672 return Component->AttachChildren;
1673 }
1674
1681};
1682
1683
1685// USceneComponent inlines
1686
1687inline const TArray<TObjectPtr<USceneComponent>>& USceneComponent::GetAttachChildren() const
1688{
1689 return AttachChildren;
1690}
1691
1692inline USceneComponent* USceneComponent::GetAttachParent() const
1693{
1694 return AttachParent;
1695}
1696
1697inline FName USceneComponent::GetAttachSocketName() const
1698{
1699 return AttachSocketName;
1700}
1701
1702inline void USceneComponent::ConditionalUpdateComponentToWorld()
1703{
1705 {
1706 UpdateComponentToWorld();
1707 }
1708}
1709
1710inline bool USceneComponent::MoveComponent(const FVector& Delta, const FQuat& NewRotation, bool bSweep, FHitResult* Hit, EMoveComponentFlags MoveFlags, ETeleportType Teleport)
1711{
1712 return MoveComponentImpl(Delta, NewRotation, bSweep, Hit, MoveFlags, Teleport);
1713}
1714
1715inline void USceneComponent::SetRelativeLocation(FVector NewLocation, bool bSweep, FHitResult* OutSweepHitResult, ETeleportType Teleport)
1716{
1717 SetRelativeLocationAndRotation(NewLocation, RelativeRotationCache.RotatorToQuat(GetRelativeRotation()), bSweep, OutSweepHitResult, Teleport);
1718}
1719
1720inline void USceneComponent::SetRelativeRotation(const FQuat& NewRotation, bool bSweep, FHitResult* OutSweepHitResult, ETeleportType Teleport)
1721{
1722 SetRelativeLocationAndRotation(GetRelativeLocation(), NewRotation, bSweep, OutSweepHitResult, Teleport);
1723}
1724
1725inline void USceneComponent::AddRelativeLocation(FVector DeltaLocation, bool bSweep, FHitResult* OutSweepHitResult, ETeleportType Teleport)
1726{
1727 SetRelativeLocationAndRotation(GetRelativeLocation() + DeltaLocation, RelativeRotationCache.RotatorToQuat(GetRelativeRotation()), bSweep, OutSweepHitResult, Teleport);
1728}
1729
1730inline void USceneComponent::AddRelativeRotation(FRotator DeltaRotation, bool bSweep, FHitResult* OutSweepHitResult, ETeleportType Teleport)
1731{
1732 SetRelativeRotation(GetRelativeRotation() + DeltaRotation, bSweep, OutSweepHitResult, Teleport);
1733}
1734
1736
1741USTRUCT()
1743{
1745
1747 ENGINE_API FSceneComponentInstanceData(const USceneComponent* SourceComponent);
1748
1750
1751 ENGINE_API virtual bool ContainsData() const override;
1752
1754 ENGINE_API virtual void FindAndReplaceInstances(const TMap<UObject*, UObject*>& OldToNewInstanceMap) override;
1755 ENGINE_API virtual void AddReferencedObjects(FReferenceCollector& Collector) override;
1756
1757 UPROPERTY()
1758 TMap<TObjectPtr<USceneComponent>, FTransform> AttachedInstanceComponents;
1759};
1760
1761
1763
1768{
1769public:
1770
1777
1778private:
1779
1780 USceneComponent* Owner;
1781 uint32 bSavedAbsoluteLocation:1;
1782 uint32 bSavedAbsoluteRotation:1;
1783 uint32 bSavedAbsoluteScale:1;
1784 uint32 bSavedNonAbsoluteComponent:1; // Whether any of the saved location/rotation/scale flags were false (or equivalently: not all were true).
1785
1786 // This class can only be created on the stack, otherwise the ordering constraints
1787 // of the constructor and destructor between encapsulated scopes could be violated.
1788 void* operator new (size_t) = delete;
1789 void* operator new[] (size_t) = delete;
1790 void operator delete (void *) = delete;
1791 void operator delete[] (void*) = delete;
1792};
1793
1794inline FScopedMovementUpdate* USceneComponent::GetCurrentScopedMovement() const
1795{
1796 if (ScopedMovementStack.Num() > 0)
1797 {
1798 return ScopedMovementStack.Last();
1799 }
1800 return nullptr;
1801}
1802
1803inline bool USceneComponent::IsDeferringMovementUpdates() const
1804{
1805 if (ScopedMovementStack.Num() > 0)
1806 {
1808 return true;
1809 }
1810 return false;
1811}
1812
1813inline bool USceneComponent::HasGroupedMovementUpdates() const
1814{
1815 if (ScopedMovementStack.Num() > 0)
1816 {
1818 return true;
1819 }
1820 return false;
1821}
1822
1823inline bool USceneComponent::GetShouldUpdatePhysicsVolume() const
1824{
1826}
OODEFFUNC typedef const int const char * function
Definition oodle2.h:710
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
#define NULL
Definition oodle2base.h:134
EUpdateTransformFlags
Definition ActorComponent.h:95
#define checkSlow(expr)
Definition AssertionMacros.h:332
#define GET_MEMBER_NAME_CHECKED(ClassName, MemberName)
Definition AssertionMacros.h:493
virtual bool IsPostLoadThreadSafe() const override
ECacheApplyPhase
Definition ComponentInstanceDataCache.h:18
#define UE_DEPRECATED(Version, Message)
Definition CoreMiscDefines.h:302
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_EVENT_ThreeParams(OwningType, EventName, Param1Type, Param2Type, Param3Type)
Definition DelegateCombinations.h:69
ETeleportType
Definition EngineTypes.h:2401
EAttachmentRule
Definition EngineTypes.h:62
EDetachmentRule
Definition EngineTypes.h:112
bool CollisionEnabledHasQuery(ECollisionEnabled::Type CollisionEnabled)
Definition EngineTypes.h:1619
bool CollisionEnabledHasPhysics(ECollisionEnabled::Type CollisionEnabled)
Definition EngineTypes.h:1613
ECollisionChannel
Definition EngineTypes.h:1088
ECollisionResponse
Definition EngineTypes.h:1240
#define ENUM_CLASS_FLAGS(Enum)
Definition EnumClassFlags.h:6
return true
Definition ExternalRpcRegistry.cpp:601
#define X(Name, Desc)
Definition FormatStringSan.h:47
const bool
Definition NetworkReplayStreaming.h:178
#define UPROPERTY(...)
UObject definition macros.
Definition ObjectMacros.h:744
#define GENERATED_BODY(...)
Definition ObjectMacros.h:765
#define UFUNCTION(...)
Definition ObjectMacros.h:745
#define UCLASS(...)
Definition ObjectMacros.h:776
#define UENUM(...)
Definition ObjectMacros.h:749
#define USTRUCT(...)
Definition ObjectMacros.h:746
bool IsRegistered(FRDGBuilder &GraphBuilder, const TRefCountPtr< IPooledRenderTarget > &RenderTarget)
Definition RenderGraphUtils.h:111
EMoveComponentFlags
Definition SceneComponent.h:56
@ MOVECOMP_SkipPhysicsMove
Definition SceneComponent.h:62
@ MOVECOMP_CheckBlockingRootActorInIgnoreList
Definition SceneComponent.h:68
@ MOVECOMP_IgnoreBases
Definition SceneComponent.h:60
@ MOVECOMP_DisableBlockingOverlapDispatch
Definition SceneComponent.h:66
@ MOVECOMP_NeverIgnoreBlockingOverlaps
Definition SceneComponent.h:64
@ MOVECOMP_NoFlags
Definition SceneComponent.h:58
EDetailMode
Definition SceneComponent.h:32
@ DM_MAX
Definition SceneComponent.h:37
@ UMETA
Definition SceneComponent.h:33
TArrayView< const FOverlapInfo > TOverlapArrayView
Definition SceneComponent.h:23
ERelativeTransformSpace
Definition SceneComponent.h:43
@ RTS_World
Definition SceneComponent.h:45
@ RTS_ParentBoneSpace
Definition SceneComponent.h:51
@ RTS_Actor
Definition SceneComponent.h:47
@ RTS_Component
Definition SceneComponent.h:49
#define DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_TwoParams(SparseDelegateClass, OwningClass, DelegateName, Param1Type, Param1Name, Param2Type, Param2Name)
Definition SparseDelegate.h:447
#define DECLARE_DYNAMIC_MULTICAST_SPARSE_DELEGATE_OneParam(SparseDelegateClass, OwningClass, DelegateName, Param1Type, Param1Name)
Definition SparseDelegate.h:446
EDataValidationResult
Definition UObjectGlobals.h:4225
uint32 Offset
Definition VulkanMemory.cpp:4033
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Actor.h:257
Definition PhysicsVolume.h:17
Definition Archive.h:1208
Definition DataValidation.h:40
Definition NameTypes.h:617
Definition UnrealTemplate.h:321
Definition UObjectGlobals.h:1292
Definition UnrealType.h:3087
Definition UnrealType.h:174
Definition UObjectGlobals.h:2492
Definition ScopedMovementUpdate.h:56
Definition SceneComponent.h:1768
Definition Text.h:385
Definition ArrayView.h:139
Definition Array.h:670
Definition EnumAsByte.h:22
Definition UnrealString.h.inl:34
Definition StructOnScope.h:142
Definition ActorComponent.h:152
Definition Object.h:95
Definition Texture2D.h:26
Definition EngineTypes.h:164
Definition EngineTypes.h:1571
Definition EngineTypes.h:3787
Type
Definition EngineTypes.h:3789
@ Stationary
Definition EngineTypes.h:3804
@ Static
Definition EngineTypes.h:3795
Type
Definition EngineTypes.h:3431
Definition SceneComponent.h:24
Type
Definition RHIFeatureLevel.h:20
ENGINE_API FBox CalcBounds(const FVector &P0, const FVector &P1, const FVector &P2, const FVector &P3)
Definition BezierUtilities.cpp:26
FIntermediate3DTransform GetComponentTransform(const UObject *Object)
Definition MovieSceneTracksCustomAccessors.cpp:18
@ false
Definition radaudio_common.h:23
Definition ComponentInstanceDataCache.h:149
Definition EngineTypes.h:75
Definition EngineTypes.h:1339
Definition EngineTypes.h:3855
Definition World.h:878
Definition EngineTypes.h:122
Definition SceneComponent.h:1668
friend class UChildActorComponent
Definition SceneComponent.h:1675
friend class FBlueprintCompileReinstancer
Definition SceneComponent.h:1679
friend class FClassThumbnailScene
Definition SceneComponent.h:1677
friend struct FResetSceneComponentAfterCopy
Definition SceneComponent.h:1680
friend class FBlueprintThumbnailScene
Definition SceneComponent.h:1676
friend class FComponentEditorUtils
Definition SceneComponent.h:1678
Definition HitResult.h:21
Definition World.h:634
Definition OverlapInfo.h:14
Definition UnrealType.h:7001
Definition UnrealType.h:6865
Definition EngineTypes.h:1955
Definition SceneComponent.h:1743
Definition TransformStateStreamHandle.h:15
Definition ObjectPtr.h:488
Definition WeakObjectPtrTemplates.h:25
Definition BoxSphereBounds.h:25
FRotator GetRotation() const
Definition MovieSceneTracksPropertyTypes.h:204