UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
CameraComponent.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
11#include "Engine/Scene.h"
12#include "Camera/CameraTypes.h"
13#include "CameraComponent.generated.h"
14
15class UStaticMesh;
16
18UCLASS(MinimalAPI)
19class UCameraProxyMeshComponent : public UStaticMeshComponent
20{
22
23public:
24 virtual FPrimitiveSceneProxy* CreateSceneProxy() override;
25};
26
31UCLASS(HideCategories=(Mobility, Rendering, LOD), Blueprintable, ClassGroup=Camera, meta=(BlueprintSpawnableComponent), MinimalAPI)
32class UCameraComponent : public USceneComponent
33{
35
36
43 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (UIMin = "5.0", UIMax = "170", ClampMin = "0.001", ClampMax = "360.0", Units = deg))
44 float FieldOfView;
45 UFUNCTION(BlueprintCallable, Category = Camera)
46 virtual void SetFieldOfView(float InFieldOfView) { FieldOfView = InFieldOfView; }
47
51 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (UIMin = "5.0", UIMax = "170", ClampMin = "0.001", ClampMax = "360.0", Units = deg, EditCondition = "bEnableFirstPersonFieldOfView"))
53 UFUNCTION(BlueprintCallable, Category = Camera)
55
59 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (UIMin = "0.001", UIMax = "1.0", ClampMin = "0.001", ClampMax = "1.0", EditCondition = "bEnableFirstPersonScale"))
60 float FirstPersonScale;
61 UFUNCTION(BlueprintCallable, Category = Camera)
62 virtual void SetFirstPersonScale(float InFirstPersonScale) { FirstPersonScale = InFirstPersonScale; }
63
65 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings)
66 float OrthoWidth;
67 UFUNCTION(BlueprintCallable, Category = Camera)
68 void SetOrthoWidth(float InOrthoWidth) { OrthoWidth = InOrthoWidth; }
69
71 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings)
72 bool bAutoCalculateOrthoPlanes;
73 UFUNCTION(BlueprintCallable, Category = Camera)
74 void SetAutoCalculateOrthoPlanes(bool bAutoCalculate) { bAutoCalculateOrthoPlanes = bAutoCalculate; }
75
77 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (EditCondition = "bAutoCalculateOrthoPlanes"))
78 float AutoPlaneShift;
79 UFUNCTION(BlueprintCallable, Category = Camera)
80 void SetAutoPlaneShift(float InAutoPlaneShift) { AutoPlaneShift = InAutoPlaneShift; }
81
83 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (EditCondition = "!bAutoCalculateOrthoPlanes"))
84 float OrthoNearClipPlane;
85 UFUNCTION(BlueprintCallable, Category = Camera)
86 void SetOrthoNearClipPlane(float InOrthoNearClipPlane) { OrthoNearClipPlane = InOrthoNearClipPlane; }
87
89 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (EditCondition = "!bAutoCalculateOrthoPlanes"))
90 float OrthoFarClipPlane;
91 UFUNCTION(BlueprintCallable, Category = Camera)
92 void SetOrthoFarClipPlane(float InOrthoFarClipPlane) { OrthoFarClipPlane = InOrthoFarClipPlane; }
93
95 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings)
96 bool bUpdateOrthoPlanes;
97 UFUNCTION(BlueprintCallable, Category = Camera)
98 void SetUpdateOrthoPlanes(bool bInUpdateOrthoPlanes) { bUpdateOrthoPlanes = bInUpdateOrthoPlanes; }
99
101 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (EditCondition = "bUpdateOrthoPlanes"))
102 bool bUseCameraHeightAsViewTarget;
103 UFUNCTION(BlueprintCallable, Category = Camera)
105
107 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings, meta = (ClampMin = "0.1", ClampMax = "100.0", EditCondition = "bConstrainAspectRatio"))
108 float AspectRatio;
109 UFUNCTION(BlueprintCallable, Category = Camera)
111
113 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraOptions, meta = (EditCondition = "!bConstrainAspectRatio && bOverrideAspectRatioAxisConstraint"))
115 UFUNCTION(BlueprintCallable, Category = Camera)
117
119 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
120 uint8 bConstrainAspectRatio : 1;
121 UFUNCTION(BlueprintCallable, Category = Camera)
122 void SetConstraintAspectRatio(bool bInConstrainAspectRatio) { bConstrainAspectRatio = bInConstrainAspectRatio; }
123
125 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
126 uint8 bOverrideAspectRatioAxisConstraint : 1;
127
128 // If true, account for the field of view angle when computing which level of detail to use for meshes.
129 UPROPERTY(Interp, EditAnywhere, AdvancedDisplay, BlueprintReadWrite, Category = CameraOptions)
130 uint8 bUseFieldOfViewForLOD : 1;
131 UFUNCTION(BlueprintCallable, Category = Camera)
132 void SetUseFieldOfViewForLOD(bool bInUseFieldOfViewForLOD) { bUseFieldOfViewForLOD = bInUseFieldOfViewForLOD; }
133
135 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraOptions, meta = (UIMin="0.0", ClampMin="0.0", UIMax="1.0", ClampMax="1.0"))
136 float Overscan;
137 UFUNCTION(BlueprintCallable, Category = Camera)
138 void SetOverscan(float InOverscan) { Overscan = InOverscan; }
139
145 UPROPERTY(meta = (UIMin="0.0", ClampMin="0.0", UIMax="1.0", ClampMax="1.0"))
146 FVector4f AsymmetricOverscan = FVector4f::Zero();
147 UFUNCTION()
148 void SetAsymmetricOverscan(const FVector4f& InAsymmetricOverscan) { AsymmetricOverscan = InAsymmetricOverscan; }
149
154 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
156
161 UFUNCTION(BlueprintCallable, Category = Camera)
163
169 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
170 bool bCropOverscan;
171
177 UFUNCTION(BlueprintCallable, Category = Camera)
179
180#if WITH_EDITOR
181 // Returns the filmback text used for burnins on preview viewports
182 UFUNCTION()
184#endif
185
186#if WITH_EDITORONLY_DATA
187 // The Frustum visibility flag for draw frustum component initialization
188 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Camera)
189 bool bDrawFrustumAllowed = true;
190
192 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Camera)
194#endif
195
197 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
198 uint8 bLockToHmd : 1;
199
204 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
206
208 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
210 UFUNCTION(BlueprintCallable, Category = Camera)
212
214 UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = CameraOptions)
216 UFUNCTION(BlueprintCallable, Category = Camera)
218
219protected:
222
223public:
224 // The type of camera
225 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = CameraSettings)
227 UFUNCTION(BlueprintCallable, Category = Camera)
229
230 UFUNCTION(BlueprintCallable, Category = Camera)
231 void SetPostProcessBlendWeight(float InPostProcessBlendWeight) { PostProcessBlendWeight = InPostProcessBlendWeight; }
232
233 // UActorComponent interface
234 ENGINE_API virtual void OnRegister() override;
235 ENGINE_API virtual void OnUpdateTransform(EUpdateTransformFlags UpdateTransformFlags, ETeleportType Teleport) override;
236#if WITH_EDITOR
237 ENGINE_API virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;
238 ENGINE_API virtual void OnComponentDestroyed(bool bDestroyingHierarchy) override;
239 ENGINE_API virtual void CheckForErrors() override;
240#endif
241 // End of UActorComponent interface
242
243 // USceneComponent interface
244#if WITH_EDITOR
245 ENGINE_API virtual bool GetEditorPreviewInfo(float DeltaTime, FMinimalViewInfo& ViewOut) override;
246#endif
247 // End of USceneComponent interface
248
249 // UObject interface
250#if WITH_EDITORONLY_DATA
251 ENGINE_API virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
252 static ENGINE_API void AddReferencedObjects(UObject* InThis, FReferenceCollector& Collector);
253 ENGINE_API virtual void PostLoad() override;
254 ENGINE_API virtual void Serialize(FArchive& Ar) override;
255#endif
256 // End of UObject interface
257
258protected:
260 ENGINE_API virtual void HandleXRCamera(float DeltaTime);
261
262public:
267 UFUNCTION(BlueprintCallable, Category = Camera)
268 ENGINE_API virtual void GetCameraView(float DeltaTime, FMinimalViewInfo& DesiredView);
269
271 UFUNCTION(BlueprintCallable, Category = "Rendering")
272 void AddOrUpdateBlendable(TScriptInterface<IBlendableInterface> InBlendableObject, float InWeight = 1.0f) { PostProcessSettings.AddBlendable(InBlendableObject, InWeight); }
273
275 UFUNCTION(BlueprintCallable, Category = "Rendering")
276 void RemoveBlendable(TScriptInterface<IBlendableInterface> InBlendableObject) { PostProcessSettings.RemoveBlendable(InBlendableObject); }
277
278#if WITH_EDITORONLY_DATA
280#endif
281
282protected:
283
284#if WITH_EDITORONLY_DATA
285 // The frustum component used to show visually where the camera field of view is
287
288 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = Camera)
290
291 // The camera mesh to show visually where the camera is placed
293
294 ENGINE_API virtual void ResetProxyMeshTransform();
295
298
299 /* Update draw frustum values */
301
302#endif // WITH_EDITORONLY_DATA
303
307 UFUNCTION(BlueprintSetter)
309
312
313public:
314
316 UPROPERTY(Interp, EditAnywhere, BlueprintReadWrite, Category = PostProcess, meta = (UIMin = "0.0", UIMax = "1.0"))
317 float PostProcessBlendWeight;
318
321 float AdditiveFOVOffset;
322
326
327public:
328
330 ENGINE_API void AddAdditiveOffset(FTransform const& Transform, float FOV);
335
342
348
349public:
350
352 UPROPERTY(Interp, BlueprintReadWrite, Category = PostProcess, meta=(ShowOnlyInnerProperties))
353 struct FPostProcessSettings PostProcessSettings;
354
355#if WITH_EDITORONLY_DATA
356 // Refreshes the visual components to match the component state
358
359 ENGINE_API void OverrideFrustumColor(FColor OverrideColor);
361
362public:
364 UPROPERTY()
366#endif // WITH_EDITORONLY_DATA
367};
OODEFFUNC typedef void(OODLE_CALLBACK t_fp_OodleCore_Plugin_Free)(void *ptr)
EUpdateTransformFlags
Definition ActorComponent.h:95
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
ELevelTick
Definition EngineBaseTypes.h:70
ETeleportType
Definition EngineTypes.h:2401
EAspectRatioAxisConstraint
Definition EngineTypes.h:38
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 GENERATED_UCLASS_BODY(...)
Definition ObjectMacros.h:768
#define UCLASS(...)
Definition ObjectMacros.h:776
USkinnedMeshComponent float
Definition SkinnedMeshComponent.h:60
uint8_t uint8
Definition binka_ue_file_header.h:8
uint32_t uint32
Definition binka_ue_file_header.h:6
Definition Archive.h:1208
Definition PrimitiveSceneProxy.h:296
Definition UObjectGlobals.h:2492
Definition Text.h:385
Definition BlendableInterface.h:96
Definition Array.h:670
Definition EnumAsByte.h:22
Definition ScriptInterface.h:139
Definition CameraComponent.h:20
Definition Object.h:95
Definition StaticMesh.h:593
Type
Definition CameraTypes.h:18
double AspectRatio(const FVector3d &v1, const FVector3d &v2, const FVector3d &v3)
Definition VectorUtil.h:625
Definition EngineBaseTypes.h:571
Definition Color.h:486
Definition CameraTypes.h:37
Definition Scene.h:693
Definition UnrealType.h:6865
Definition ObjectPtr.h:488