UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
BoxComponent.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 "ShowFlags.h"
10#include "BoxComponent.generated.h"
11
13
17UCLASS(ClassGroup="Collision", hidecategories=(Object,LOD,Lighting,TextureStreaming), editinlinenew, meta=(DisplayName="Box Collision", BlueprintSpawnableComponent), MinimalAPI)
18class UBoxComponent : public UShapeComponent
19{
21
24 UPROPERTY(EditAnywhere, BlueprintReadOnly, export, Category=Shape)
25 FVector BoxExtent;
26
27#if WITH_EDITOR
29 FEngineShowFlags ShowFlags;
30#endif // WITH_EDITOR
31
32public:
38 UFUNCTION(BlueprintCallable, Category="Components|Box")
40
41 // @return the box extent, scaled by the component scale.
42 UFUNCTION(BlueprintCallable, Category="Components|Box")
44
45 // @return the box extent, ignoring component scale.
46 UFUNCTION(BlueprintCallable, Category="Components|Box")
48
49 //~ Begin UPrimitiveComponent Interface.
52 ENGINE_API virtual struct FCollisionShape GetCollisionShape(float Inflation = 0.0f) const override;
53 //~ End UPrimitiveComponent Interface.
54
55 //~ Begin USceneComponent Interface
56 ENGINE_API virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const override;
57 //~ End USceneComponent Interface
58
59 //~ Begin UShapeComponent Interface
61 //~ End UShapeComponent Interface
62
63 // Sets the box extents without triggering a render or physics update.
64 inline void InitBoxExtent(const FVector& InBoxExtent) { BoxExtent = InBoxExtent; }
65
66#if WITH_EDITOR
67 FEngineShowFlags GetShowFlags() const { return ShowFlags; }
69#endif // WITH_EDITOR
70};
71
72
73// ----------------- INLINES ---------------
74
75inline FVector UBoxComponent::GetScaledBoxExtent() const
76{
77 return BoxExtent * GetComponentTransform().GetScale3D();
78}
79
80inline FVector UBoxComponent::GetUnscaledBoxExtent() const
81{
82 return BoxExtent;
83}
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
return true
Definition ExternalRpcRegistry.cpp:601
#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
@ UpdateBodySetup
Definition BoxComponent.cpp:94
Definition PrimitiveSceneProxy.h:296
FIntermediate3DTransform GetComponentTransform(const UObject *Object)
Definition MovieSceneTracksCustomAccessors.cpp:18
Definition CollisionShape.h:21
Definition ShowFlags.h:56
Definition BoxSphereBounds.h:25