Navigation
API > API/Runtime > API/Runtime/Engine
Represents a camera viewpoint and settings, such as projection type, field of view, and post-process overrides. The default behavior for an actor used as the camera view target is to look for an attached camera component and use its location, rotation, and settings.
| Name | UCameraComponent |
| Type | class |
| Header File | /Engine/Source/Runtime/Engine/Classes/Camera/CameraComponent.h |
| Include Path | #include "Camera/CameraComponent.h" |
Syntax
UCLASS (HideCategories=(Mobility, Rendering, LOD), Blueprintable, ClassGroup=Camera,
Meta=(BlueprintSpawnableComponent), MinimalAPI)
class UCameraComponent : public USceneComponent
Inheritance Hierarchy
- UObjectBase → UObjectBaseUtility → UObject → UActorComponent → USceneComponent → UCameraComponent
Implements Interfaces
Derived Classes
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
UCameraComponent
(
const FObjectInitializer& ObjectInitializer |
Camera/CameraComponent.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| AspectRatio | float | Aspect Ratio (Width/Height) | Camera/CameraComponent.h |
|
| AspectRatioAxisConstraint | TEnumAsByte< EAspectRatioAxisConstraint > | Override for the default aspect ratio axis constraint defined on the local player | Camera/CameraComponent.h |
|
| AsymmetricOverscan | FVector4f | Experimental: Amount to increase each side of the view frustum by, from 0.0 for no increase to 1.0 for 100% increase. | Camera/CameraComponent.h |
|
| AutoPlaneShift | float | Manually adjusts the planes of this camera, maintaining the distance between them. | Camera/CameraComponent.h |
|
| bAutoCalculateOrthoPlanes | bool | Automatically determine a min/max Near/Far clip plane position depending on OrthoWidth value | Camera/CameraComponent.h |
|
| bCameraMeshHiddenInGame | uint8 | If the camera mesh is visible in game. Only relevant when running editor builds. | Camera/CameraComponent.h |
|
| bConstrainAspectRatio | uint8 | If bConstrainAspectRatio is true, black bars will be added if the destination view has a different aspect ratio than this camera requested. | Camera/CameraComponent.h |
|
| bCropOverscan | bool | Indicates that the overscanned pixels should be cropped at the end of the rendering pipeline, allowing the overscanned pixels to be used in post process effects that need extra pixels beyond the view frustum (e.g. lens distortion) without having to render those pixels to the screen. | Camera/CameraComponent.h |
|
| bDrawFrustumAllowed | bool | The Frustum visibility flag for draw frustum component initialization. | Camera/CameraComponent.h |
|
| bEnableFirstPersonFieldOfView | uint8 | True if the first person field of view should be used for primitives tagged as "IsFirstPerson". | Camera/CameraComponent.h |
|
| bEnableFirstPersonScale | uint8 | True if the first person scale should be used for primitives tagged as "IsFirstPerson". | Camera/CameraComponent.h |
|
| bLockToHmd | uint8 | True if the camera's orientation and position should be locked to the HMD | Camera/CameraComponent.h |
|
| bOverrideAspectRatioAxisConstraint | uint8 | Whether to override the default aspect ratio axis constraint defined on the local player | Camera/CameraComponent.h |
|
| bScaleResolutionWithOverscan | bool | Indicates that the resolution should be scaled by the overscan amount so that the original view frustum remains the same resolution. | Camera/CameraComponent.h |
|
| bUpdateOrthoPlanes | bool | Adjusts the near/far planes and the view origin of the current camera automatically to avoid clipping and light artefacting | Camera/CameraComponent.h |
|
| bUseCameraHeightAsViewTarget | bool | If UpdateOrthoPlanes is enabled, this setting will use the cameras current height to compensate the distance to the general view (as a pseudo distance to view target when one isn't present) | Camera/CameraComponent.h |
|
| bUseFieldOfViewForLOD | uint8 | If true, account for the field of view angle when computing which level of detail to use for meshes. | Camera/CameraComponent.h |
|
| bUsePawnControlRotation | uint8 | If this camera component is placed on a pawn, should it use the view/control rotation of the pawn where possible? | Camera/CameraComponent.h |
|
| FieldOfView | float | The horizontal field of view (in degrees) in perspective mode (ignored in Orthographic mode) | Camera/CameraComponent.h |
|
| FirstPersonFieldOfView | float | The horizontal field of view (in degrees) used for primitives tagged as "IsFirstPerson". | Camera/CameraComponent.h |
|
| FirstPersonScale | float | The scale to apply to primitives tagged as "IsFirstPerson". | Camera/CameraComponent.h |
|
| OrthoFarClipPlane | float | The far plane distance of the orthographic view (in world units) | Camera/CameraComponent.h |
|
| OrthoNearClipPlane | float | The near plane distance of the orthographic view (in world units) | Camera/CameraComponent.h |
|
| OrthoWidth | float | The desired width (in world units) of the orthographic view (ignored in Perspective mode) | Camera/CameraComponent.h |
|
| Overscan | float | Amount to increase the view frustum by, from 0.0 for no increase to 1.0 for 100% increase | Camera/CameraComponent.h |
|
| PostProcessBlendWeight | float | Indicates if PostProcessSettings should be used when using this Camera to view through. | Camera/CameraComponent.h |
|
| PostProcessSettings | FPostProcessSettings | Post process settings to use for this camera. | Camera/CameraComponent.h |
|
| ProjectionMode | TEnumAsByte< ECameraProjectionMode::Type > | The type of camera. | Camera/CameraComponent.h |
|
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void AddAdditiveOffset
(
FTransform const& Transform, |
Applies the given additive offset, preserving any existing offset | Camera/CameraComponent.h | |
void AddExtraPostProcessBlend
(
FPostProcessSettings const& PPSettings, |
Stores a given PP and weight to be later applied when the final PP is computed. | Camera/CameraComponent.h | |
void AddOrUpdateBlendable
(
TScriptInterface< IBlendableInterface > InBlendableObject, |
Adds an Blendable (implements IBlendableInterface) to the array of Blendables (if it doesn't exist) and update the weight | Camera/CameraComponent.h |
|
void ClearAdditiveOffset() |
Removes any additive offset. | Camera/CameraComponent.h | |
void ClearExtraPostProcessBlends() |
Removes any extra PP blends. | Camera/CameraComponent.h | |
void GetAdditiveOffset
(
FTransform& OutAdditiveOffset, |
Get the additive offset | Camera/CameraComponent.h | |
virtual void GetCameraView
(
float DeltaTime, |
Returns camera's Point of View. | Camera/CameraComponent.h |
|
void GetExtraPostProcessBlends
(
TArray< FPostProcessSettings >& OutSettings, |
Returns any extra PP blends that were stored. | Camera/CameraComponent.h | |
virtual FText GetFilmbackText() |
Returns the filmback text used for burnins on preview viewports. | Camera/CameraComponent.h | |
virtual void NotifyCameraCut() |
Can be called from external code to notify that this camera was cut to, so it can update things like interpolation if necessary. | Camera/CameraComponent.h | |
void OverrideFrustumColor
(
FColor OverrideColor |
Camera/CameraComponent.h | ||
virtual void RefreshVisualRepresentation() |
Refreshes the visual components to match the component state. | Camera/CameraComponent.h | |
void RemoveBlendable
(
TScriptInterface< IBlendableInterface > InBlendableObject |
Removes a blendable. | Camera/CameraComponent.h |
|
void RestoreFrustumColor() |
Camera/CameraComponent.h | ||
void SetAspectRatio
(
float InAspectRatio |
Camera/CameraComponent.h |
|
|
void SetAspectRatioAxisConstraint
(
EAspectRatioAxisConstraint InAspectRatioAxisConstraint |
Camera/CameraComponent.h |
|
|
void SetAsymmetricOverscan
(
const FVector4f& InAsymmetricOverscan |
Camera/CameraComponent.h | ||
void SetAutoCalculateOrthoPlanes
(
bool bAutoCalculate |
Camera/CameraComponent.h |
|
|
void SetAutoPlaneShift
(
float InAutoPlaneShift |
Camera/CameraComponent.h |
|
|
virtual void SetCameraMesh
(
UStaticMesh* Mesh |
Camera/CameraComponent.h | ||
void SetConstraintAspectRatio
(
bool bInConstrainAspectRatio |
Camera/CameraComponent.h |
|
|
void SetCropOverscan
(
bool bInCropOverscan |
Sets whether to crop the overscanned pixels at the end of the rendering pipeline, allowing the overscanned pixels to be used in post process effects that need extra pixels beyond the view frustum (e.g. lens distortion) without having to render those pixels to the screen. | Camera/CameraComponent.h |
|
void SetEnableFirstPersonFieldOfView
(
bool bInEnableFirstPersonFieldOfView |
Camera/CameraComponent.h |
|
|
void SetEnableFirstPersonScale
(
bool bInEnableFirstPersonScale |
Camera/CameraComponent.h |
|
|
virtual void SetFieldOfView
(
float InFieldOfView |
Camera/CameraComponent.h |
|
|
virtual void SetFirstPersonFieldOfView
(
float InFirstPersonFieldOfView |
Camera/CameraComponent.h |
|
|
virtual void SetFirstPersonScale
(
float InFirstPersonScale |
Camera/CameraComponent.h |
|
|
void SetOrthoFarClipPlane
(
float InOrthoFarClipPlane |
Camera/CameraComponent.h |
|
|
void SetOrthoNearClipPlane
(
float InOrthoNearClipPlane |
Camera/CameraComponent.h |
|
|
void SetOrthoWidth
(
float InOrthoWidth |
Camera/CameraComponent.h |
|
|
void SetOverscan
(
float InOverscan |
Camera/CameraComponent.h |
|
|
void SetPostProcessBlendWeight
(
float InPostProcessBlendWeight |
Camera/CameraComponent.h |
|
|
void SetProjectionMode
(
ECameraProjectionMode::Type InProjectionMode |
Camera/CameraComponent.h |
|
|
void SetScaleResolutionWithOverscan
(
bool bInScaleResolutionWithOverscan |
Sets whether to scale the resolution by the amount of overscan so that the original view frustum remains the same resolution. | Camera/CameraComponent.h |
|
void SetUpdateOrthoPlanes
(
bool bInUpdateOrthoPlanes |
Camera/CameraComponent.h |
|
|
void SetUseCameraHeightAsViewTarget
(
bool bInUseCameraHeightAsViewTarget |
Camera/CameraComponent.h |
|
|
void SetUseFieldOfViewForLOD
(
bool bInUseFieldOfViewForLOD |
Camera/CameraComponent.h |
|
Overridden from USceneComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void OnUpdateTransform
(
EUpdateTransformFlags UpdateTransformFlags, |
Native callback when this component is moved | Camera/CameraComponent.h |
Overridden from UActorComponent
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void CheckForErrors () |
Function that gets called from within Map_Check to allow this actor component to check itself for any potential errors and register them with map check dialog. | Camera/CameraComponent.h | |
virtual bool GetEditorPreviewInfo
(
float DeltaTime, |
Supplies the editor with a view specific to this component (think a view from a camera components POV, a render, etc.). | Camera/CameraComponent.h | |
virtual void OnComponentDestroyed
(
bool bDestroyingHierarchy |
Called when a component is destroyed | Camera/CameraComponent.h | |
virtual void OnRegister() |
Called when a component is registered, after Scene is set, but before CreateRenderState_Concurrent or OnCreatePhysicsState are called. | Camera/CameraComponent.h | |
virtual void TickComponent
(
float DeltaTime, |
Function called every frame on this ActorComponent. | Camera/CameraComponent.h |
Overridden from UObject
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void PostEditChangeProperty
(
FPropertyChangedEvent& PropertyChangedEvent |
Camera/CameraComponent.h | ||
virtual void PostLoad() |
Camera/CameraComponent.h | ||
virtual void Serialize
(
FArchive& Ar |
Camera/CameraComponent.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
virtual void HandleXRCamera
(
float DeltaTime |
Camera/CameraComponent.h | ||
bool IsXRHeadTrackedCamera() |
Camera/CameraComponent.h | ||
void OnCameraMeshHiddenChanged() |
Internal function for updating the camera mesh visibility in PIE | Camera/CameraComponent.h |
|
virtual void ResetProxyMeshTransform() |
Camera/CameraComponent.h | ||
void UpdateDrawFrustum() |
Update draw frustum values | Camera/CameraComponent.h | |
void UpdateProxyMeshTransform() |
Ensure the proxy mesh is in the correct place | Camera/CameraComponent.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void AddReferencedObjects
(
UObject* InThis, |
Camera/CameraComponent.h |
Deprecated Variables
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bUseControllerViewRotation_DEPRECATED | uint32 | DEPRECATED: use bUsePawnControlRotation instead | Camera/CameraComponent.h |