APlayerCameraManager

A PlayerCameraManager is responsible for managing the camera for a particular player.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Camera/PlayerCameraManager.h

Include

#include "Camera/PlayerCameraManager.h"

Syntax

class APlayerCameraManager : public AActor

Remarks

A PlayerCameraManager is responsible for managing the camera for a particular player. It defines the final view properties used by other systems (e.g. the renderer), meaning you can think of it as your virtual eyeball in the world. It can compute the final camera properties directly, or it can arbitrate/blend between other objects or actors that influence the camera (e.g. blending from one CameraActor to another).

The PlayerCameraManagers primary external responsibility is to reliably respond to various Get*() functions, such as GetCameraViewPoint. Most everything else is implementation detail and overrideable by user projects.

By default, a PlayerCameraManager maintains a "view target", which is the primary actor the camera is associated with. It can also apply various "post" effects to the final view state, such as camera animations, shakes, post-process effects or special effects such as dirt on the lens.

Variables

Name Description

Public variable

TArray< class U...

 

ActiveAnims

Array of camera anim instances that are currently playing and in-use

Protected variable

ACameraActor &#...

 

AnimCameraActor

  1. Receives the output of individual camera animations.

Protected variable

UCameraAnimInst...

 

AnimInstPool

Internal pool of camera anim instance objects available for playing camera animations.

Protected variable

uint32: 1

 

bAlwaysApplyModifiers

By default camera modifiers are not applied to stock debug cameras (e.g. CameraStyle == "FreeCam").

Protected variable

uint32: 1

 

bAutoAnimateFade

Public variable

uint32: 1

 

bClientSimulatingViewTarget

True if clients are handling setting their own viewtarget and the server should not replicate it (e.g. during certain Matinee sequences)

Public variable

uint32: 1

 

bDebugClientSideCamera

For debugging.

Public variable

uint32: 1

 

bDefaultConstrainAspectRatio

True if black bars should be added if the destination view has a different aspect ratio (only used when a view target doesn't specify whether or not to constrain the aspect ratio; most of the time the value from a camera component is used instead)

Public variable

uint32: 1

 

bEnableColorScaleInterp

True to smoothly interpolate color scale values when they change.

Public variable

uint32: 1

 

bEnableColorScaling

True to turn on scaling of color channels in final image using ColorScale property.

Public variable

uint32: 1

 

bEnableFading

True if we should apply FadeColor/FadeAmount to the screen.

Public variable

uint32: 1

 

bFadeAudio

True to apply fading of audio alongside the video.

Public variable

uint32: 1

 

bGameCameraCutThisFrame

True if we did a camera cut this frame.

Protected variable

uint32: 1

 

bHoldFadeWhenFinished

True if camera fade hold at it's final value when finished.

Public variable

uint32: 1

 

bIsOrthographic

Flags.

Public variable

FViewTargetTran...

 

BlendParams

Current view target transition blend parameters.

Public variable

float

 

BlendTimeToGo

Time remaining in viewtarget blend.

Public variable

uint32: 1

 

bShouldSendClientSideCameraUpdate

If true, send a camera update to the server on next update.

Public variable

uint32: 1

 

bUseClientSideCameraUpdates

True if server will use camera positions replicated from the client instead of calculating them locally.

Protected variable

UCameraModifier...

 

CachedCameraShakeMod

Camera Modifiers.

Protected variable

TArray< class A...

 

CameraLensEffects

"Lens" effects (e.g. blood, dirt on camera)

Public variable

FName

 

CameraStyle

Usable to define different camera behaviors. A few simple styles are implemented by default.

Public variable

FVector

 

ColorScale

Allows control over scaling individual color channels in the final image (when bEnableColorScaling == true).

Public variable

float

 

ColorScaleInterpDuration

Total time for color scale interpolation to complete (when bEnableColorScaling and bEnableColorScaleInterp == true)

Public variable

float

 

ColorScaleInterpStartTime

Time at which interpolation started (when bEnableColorScaling and bEnableColorScaleInterp == true)

Public variable

float

 

DefaultAspectRatio

Default aspect ratio. Most of the time the value from a camera component will be used instead.

Public variable

float

 

DefaultFOV

FOV to use by default.

Public variable

TArray< TSubcla...

 

DefaultModifiers

List of modifiers to create by default for this camera

Public variable

float

 

DefaultOrthoWidth

The default desired width (in world units) of the orthographic view (ignored in Perspective mode)

Public variable

FVector

 

DesiredColorScale

Desired color scale which ColorScale will interpolate to (when bEnableColorScaling and bEnableColorScaleInterp == true)

Public variable

FVector2D

 

FadeAlpha

Current camera fade alpha range, where X = starting alpha and Y = final alpha (when bEnableFading == true)

Public variable

float

 

FadeAmount

Amount of fading to apply (when bEnableFading == true).

Public variable

FLinearColor

 

FadeColor

Color to fade to (when bEnableFading == true).

Public variable

float

 

FadeTime

Total duration of the camera fade (when bEnableFading == true)

Public variable

float

 

FadeTimeRemaining

Time remaining in camera fade (when bEnableFading == true)

Protected variable

TArray< class U...

 

FreeAnims

Array of camera anim instances that are not playing and available to be used.

Public variable

float

 

FreeCamDistance

Distance to place free camera from view target (used in certain CameraStyles)

Public variable

FVector

 

FreeCamOffset

Offset to Z free camera position (used in certain CameraStyles)

Protected variable

float

 

LockedFOV

Value to lock FOV to, in degrees. Ignored if <= 0, utilized if > 0.

Protected variable

float

 

LockedOrthoWidth

Value OrthoWidth is locked at, if > 0. Ignored if <= 0.

Protected variable

TArray< UCamera...

 

ModifierList

List of active camera modifier instances that have a chance to update the final camera POV

Public variable

FOnAudioFadeCha...

 

OnAudioFadeChangeEvent

If bound, broadcast on fade start (with fade time) instead of manually altering audio device's master volume directly

Public variable

FVector

 

OriginalColorScale

Color scale value at start of interpolation (when bEnableColorScaling and bEnableColorScaleInterp == true)

Public variable

APlayerControll...

 

PCOwner

PlayerController that owns this Camera actor

Public variable

FTViewTarget

 

PendingViewTarget

Pending view target for blending

Protected variable

TArray< struct ...

 

PostProcessBlendCache

Internal list of active post process effects. Parallel array to PostProcessBlendCacheWeights.

Protected variable

TArray< float >

 

PostProcessBlendCacheWeights

Internal list of weights for active post process effects. Parallel array to PostProcessBlendCache.

Protected variable

FTimerHandle

 

SwapPendingViewTargetWhenUsingClientSideCameraUpdatesTimerHandle

Public variable

float

 

ViewPitchMax

Maximum view pitch, in degrees.

Public variable

float

 

ViewPitchMin

Minimum view pitch, in degrees.

Public variable

float

 

ViewRollMax

Maximum view roll, in degrees.

Public variable

float

 

ViewRollMin

Minimum view roll, in degrees.

Public variable

FTViewTarget

 

ViewTarget

Current ViewTarget

Public variable

FVector

 

ViewTargetOffset

Offset to view target (used in certain CameraStyles)

Public variable

float

 

ViewYawMax

Maximum view yaw, in degrees.

Public variable

float

 

ViewYawMin

Minimum view yaw, in degrees.

Constructors

Name Description

Public function

APlayerCameraManager

(
    const FObjectInitializer& ObjectIn...
)

Destructors

Name Description

Public function Virtual

~APlayerCameraManager()

Destructor for handling property deprecation, please remove after all deprecated properties are gone

Functions

Name Description

Public function

void

 

AddCachedPPBlend

(
    FPostProcessSettings& PPSettings,
    float BlendWeight
)

Adds a postprocess effect at the given weight.

Public function Virtual

AEmitterCame...

 

AddCameraLensEffect

(
    TSubclassOf< class AEmitterCameraLe...
)

Creates a camera lens effect of the given class on this camera.

Protected function Virtual

bool

 

AddCameraModifierToList

(
    UCameraModifier* NewModifier
)

  1. Places the given modifier in the ModifierList at the appropriate priority.

Public function Virtual

UCameraModif...

 

AddNewCameraModifier

(
    TSubclassOf< UCameraModifier > Modi...
)

Creates and initializes a new camera modifier of the specified class.

Protected function

UCameraAnimI...

 

AllocCameraAnimInst()

Returns an available CameraAnimInst, or NULL if no more are available.

Protected function Virtual Const

bool

 

AllowPhotographyMode()

Whether or not we allow photography mode

Protected function

void

 

ApplyAnimToCamera

(
    ACameraActor const* AnimatedCa...,
    UCameraAnimInst const* AnimIns...,
    FMinimalViewInfo& InOutPOV
)

Protected function Virtual

void

 

ApplyAudioFade()

  1. Applies appropriate audio fading to the audio system.

Public function Virtual

void

 

ApplyCameraModifiers

(
    float DeltaTime,
    FMinimalViewInfo& InOutPOV
)

Applies the current set of camera modifiers to the given camera POV.

Public function Virtual

void

 

AssignViewTarget

(
    AActor* NewTarget,
    FTViewTarget& VT,
    FViewTargetTransitionParams Transit...
)

Protected function

FPOV

 

BlendViewTargets

(
    const FTViewTarget& A,
    const FTViewTarget& B,
    float Alpha
)

Internal helper to blend two viewtargets.

Public function

bool

 

BlueprintUpdateCamera

(
    AActor* CameraTarget,
    FVector& NewCameraLocation,
    FRotator& NewCameraRotation,
    float& NewCameraFOV
)

Blueprint hook to allow blueprints to override existing camera behavior or implement custom cameras.

Protected function Static

float

 

CalcRadialShakeScale

(
    APlayerCameraManager* Cam,
    FVector Epicenter,
    float InnerRadius,
    float OuterRadius,
    float Falloff
)

  1. Calculates shake scale for a particular camera.

Protected function

void

 

ClearCachedPPBlends()

Removes all postprocess effects.

Public function Virtual

void

 

ClearCameraLensEffects()

Removes all camera lens effects.

Public function Virtual

void

 

DisplayDebug

(
    UCanvas* Canvas,
    const FDebugDisplayInfo& DebugDisp...,
    float& YL,
    float& YPos
)

Protected function Virtual

void

 

DoUpdateCamera

(
    float DeltaTime
)

Internal function conditionally called from UpdateCamera to do the actual work of updating the camera.

Public function

void

 

FillCameraCache

(
    const FMinimalViewInfo& NewInfo
)

Caches given final POV info for efficient access from other game code.

Public function Virtual

AEmitterCame...

 

FindCameraLensEffect

(
    TSubclassOf< class AEmitterCameraLe...
)

Camera Lens EffectsReturns first instance of a lens effect of the given class.

Public function Virtual

UCameraModif...

 

FindCameraModifierByClass

(
    TSubclassOf< UCameraModifier > Modi...
)

Returns camera modifier for this camera of the given class, if it exists.

Public function Const

UCameraAnimI...

 

FindInstanceOfCameraAnim

(
    UCameraAnim const* Anim
)

Returns first existing instance of the specified camera anim, or NULL if none exists.

Public function Const

void

 

GetCachedPostProcessBlends

(
    TArray< struct FPostProcessSettings...,
    TArray< float > const*& OutBle...
)

Returns active post process info.

Public function Virtual Const

FMinimalView...

 

GetCameraCachePOV()

Gets value of CameraCachePrivate.POV

Public function Const

float

 

GetCameraCacheTime()

Get value of CameraCachePrivate.Time

Public function Virtual Const

FVector

 

GetCameraLocation()

Returns camera's current location.

Public function Virtual Const

FRotator

 

GetCameraRotation()

Returns camera's current rotation.

Public function Virtual Const

void

 

GetCameraViewPoint

(
    FVector& OutCamLoc,
    FRotator& OutCamRot
)

Master function to retrieve Camera's actual view point.

Public function Virtual Const

float

 

GetFOVAngle()

Returns the camera's current full FOV angle, in degrees.

Public function Virtual Const

FMinimalView...

 

GetLastFrameCameraCachePOV()

Gets value of LastFrameCameraCachePrivate.POV

Public function Const

float

 

GetLastFrameCameraCacheTime()

Get value of LastFrameCameraCachePrivate.Time

Public function Const

float

 

GetLockedFOV()

Public function Virtual Const

float

 

GetOrthoWidth()

Returns the current orthographic width for the camera.

Public function Virtual Const

APlayerContr...

 

GetOwningPlayerController()

Returns the PlayerController that owns this camera.

Public function Const

USceneCompon...

 

GetTransformComponent()

Returns TransformComponent subobject

Public function Const

AActor *

 

GetViewTarget()

Returns the current ViewTarget.

Public function Const

APawn *

 

GetViewTargetPawn()

Returns the ViewTarget if it is an APawn, or nullptr otherwise

Public function Virtual

void

 

InitializeFor

(
    APlayerController* PC
)

Initialize this PlayerCameraManager for the given associated PlayerController.

Protected function Const

void

 

InitTempCameraActor

(
    ACameraActor* CamActor,
    UCameraAnimInst const* AnimIns...
)

Gets specified temporary CameraActor ready to update the specified Anim.

Public function Virtual Const

bool

 

IsOrthographic()

Returns true if this camera is using an orthographic perspective.

Public function Virtual

void

 

LimitViewPitch

(
    FRotator& ViewRotation,
    float InViewPitchMin,
    float InViewPitchMax
)

Limit the player's view pitch.

Public function Virtual

void

 

LimitViewRoll

(
    FRotator& ViewRotation,
    float InViewRollMin,
    float InViewRollMax
)

Limit the player's view roll.

Public function Virtual

void

 

LimitViewYaw

(
    FRotator& ViewRotation,
    float InViewYawMin,
    float InViewYawMax
)

Limit the player's view yaw.

Public function Const

APlayerCamer...

 

OnBlendComplete()

Public function

void

 

OnPhotographyMultiPartCaptureEnd()

Event triggered upon the end of a multi-part photograph capture, when manual free-roaming photographic camera control is about to be returned to the user.

Public function

void

 

OnPhotographyMultiPartCaptureStart()

Event triggered upon the start of a multi-part photograph capture (i.e. a stereoscopic or 360-degree shot).

Public function

void

 

OnPhotographySessionEnd()

Event triggered upon leaving Photography mode (after unpausing, if r.Photography.AutoPause is 1).

Public function

void

 

OnPhotographySessionStart()

Event triggered upon entering Photography mode (before pausing, if r.Photography.AutoPause is 1).

Public function

void

 

PhotographyCameraModify

(
    const FVector NewCameraLocation,
    const FVector PreviousCameraLocatio...,
    const FVector OriginalCameraLocatio...,
    FVector& ResultCameraLocation
)

Implementable blueprint hook to allow a PlayerCameraManager subclass to constrain or otherwise modify the camera during free-camera photography.

Public function Virtual

UCameraAnimI...

 

PlayCameraAnim

(
    UCameraAnim* Anim,
    float Rate,
    float Scale,
    float BlendInTime,
    float BlendOutTime,
    bool bLoop,
    bool bRandomStartTime,
    float Duration,
    ECameraShakePlaySpace PlaySpace,
    FRotator UserPlaySpaceRot
)

CameraAnim support. Play the indicated CameraAnim on this camera.

Public function Static

void

 

PlayWorldCameraShake

(
    UWorld* InWorld,
    TSubclassOf< UCameraShakeBase > Sha...,
    FVector Epicenter,
    float InnerRadius,
    float OuterRadius,
    float Falloff,
    bool bOrientShakeTowardsEpicenter
)

Static.

Public function Virtual

void

 

ProcessViewRotation

(
    float DeltaTime,
    FRotator& OutViewRotation,
    FRotator& OutDeltaRot
)

Called to give PlayerCameraManager a chance to adjust view rotation updates before they are applied.

Protected function

void

 

ReleaseCameraAnimInst

(
    UCameraAnimInst* Inst
)

Frees an allocated CameraAnimInst for future use.

Public function Virtual

void

 

RemoveCameraLensEffect

Removes the given lens effect from the camera.

Public function Virtual

bool

 

RemoveCameraModifier

(
    UCameraModifier* ModifierToRem...
)

Removes the given camera modifier from this camera (if it's on the camera in the first place) and discards it.

Public function Virtual

void

 

SetCameraCachePOV

(
    const FMinimalViewInfo& InPOV
)

Sets value of CameraCachePrivate.POV

Protected function

void

 

SetCameraCacheTime

(
    float InTime
)

Get value of CameraCachePrivate.Time

Public function Virtual

void

 

SetDesiredColorScale

(
    FVector NewColorScale,
    float InterpTime
)

Sets the new desired color scale, enables color scaling, and enables color scale interpolation.

Public function Virtual

void

 

SetFOV

(
    float NewFOV
)

Locks the FOV to the given value. Unlock with UnlockFOV.

Public function

void

 

SetGameCameraCutThisFrame()

Sets the bGameCameraCutThisFrame flag to true (indicating we did a camera cut this frame; useful for game code to call, e.g., when performing a teleport that should be seamless)

Public function Virtual

void

 

SetLastFrameCameraCachePOV

(
    const FMinimalViewInfo& InPOV
)

Sets value of LastFrameCameraCachePrivate.POV

Protected function

void

 

SetLastFrameCameraCacheTime

(
    float InTime
)

Get value of LastFrameCameraCachePrivate.Time

Public function Virtual

void

 

SetManualCameraFade

(
    float InFadeAmount,
    FLinearColor Color,
    bool bInFadeAudio
)

Turns on camera fading at the given opacity.

Public function Virtual

void

 

SetOrthoWidth

(
    float OrthoWidth
)

Sets and locks the current orthographic width for the camera.

Public function Virtual

void

 

SetViewTarget

(
    AActor* NewViewTarget,
    FViewTargetTransitionParams Transit...
)

Sets a new ViewTarget.

Public function Virtual

void

 

StartCameraFade

(
    float FromAlpha,
    float ToAlpha,
    float Duration,
    FLinearColor Color,
    bool bShouldFadeAudio,
    bool bHoldWhenFinished
)

CameraAnim fades. Does a camera fade to/from a solid color. Animates automatically. Camera fades

Public function Virtual

UCameraShake...

 

StartCameraShake

(
    TSubclassOf< UCameraShakeBase > Sha...,
    float Scale,
    ECameraShakePlaySpace PlaySpace,
    FRotator UserPlaySpaceRot
)

Camera Shakes. Plays a camera shake on this camera. Camera Shakes

Public function Virtual

UCameraShake...

 

StartCameraShakeFromSource

(
    TSubclassOf< UCameraShakeBase > Sha...,
    UCameraShakeSourceComponent* S...,
    float Scale,
    ECameraShakePlaySpace PlaySpace,
    FRotator UserPlaySpaceRot
)

Plays a camera shake on this camera.

Public function Virtual

void

 

StopAllCameraAnims

(
    bool bImmediate
)

Stop playing all CameraAnims on this CameraManager.

Public function Virtual

void

 

StopAllCameraShakes

(
    bool bImmediately
)

Stops all active camera shakes on this camera.

Public function Virtual

void

 

StopAllCameraShakesFromSource

(
    UCameraShakeSourceComponent* S...,
    bool bImmediately
)

Stops playing all shakes originating from the given source.

Public function Virtual

void

 

StopAllInstancesOfCameraAnim

(
    UCameraAnim* Anim,
    bool bImmediate
)

Stop playing all instances of the indicated CameraAnim.

Public function Virtual

void

 

StopAllInstancesOfCameraShake

(
    TSubclassOf< UCameraShakeBase > Sha...,
    bool bImmediately
)

Stops playing all shakes of the given class.

Public function Virtual

void

 

StopAllInstancesOfCameraShakeFromSource

(
    TSubclassOf< UCameraShakeBase > Sha...,
    UCameraShakeSourceComponent* S...,
    bool bImmediately
)

Stops playing all shakes of the given class originating from the given source.

Protected function Virtual

void

 

StopAudioFade()

Public function Virtual

void

 

StopCameraAnimInst

(
    UCameraAnimInst* AnimInst,
    bool bImmediate
)

Stops the given CameraAnimInst from playing.

Public function Virtual

void

 

StopCameraFade()

Stops camera fading.

Public function Virtual

void

 

StopCameraShake

(
    UCameraShakeBase* ShakeInstanc...,
    bool bImmediately
)

Immediately stops the given shake instance and invalidates it.

Protected function

void

 

SwapPendingViewTargetWhenUsingClientSideCameraUpdates()

ClientSide camera updates prevents DoUpdateCamera from swapping PendingViewTarget in when the blend is complete, just use a timer to swap.

Public function Virtual

void

 

UnlockFOV()

Unlocks the FOV.

Public function Virtual

void

 

UnlockOrthoWidth()

Unlocks OrthoWidth value

Public function Virtual

void

 

UpdateCamera

(
    float DeltaTime
)

Performs per-tick camera update.

Protected function Virtual

void

 

UpdateCameraLensEffects

(
    const FTViewTarget& OutVT
)

Update any attached camera lens effects

Public function Virtual

void

 

UpdateCameraPhotographyOnly()

Performs a photography camera tick even when the camera wouldn't normally be ticking.

Protected function Virtual

bool

 

UpdatePhotographyCamera

(
    FMinimalViewInfo& NewPOV
)

Overridable.

Public function Virtual

void

 

UpdatePhotographyPostProcessing

(
    FPostProcessSettings& InOutPostPro...
)

Allows the photography system to override postprocessing

Protected function Virtual

void

 

UpdateViewTarget

(
    FTViewTarget& OutVT,
    float DeltaTime
)

Calculates an updated POV for the given viewtarget.

Protected function Virtual

void

 

UpdateViewTargetInternal

(
    FTViewTarget& OutVT,
    float DeltaTime
)

Does the actual work to UpdateViewTarget.

Overridden from AActor

Name Description

Public function Virtual

void

 

ApplyWorldOffset

(
    const FVector& InOffset,
    bool bWorldShift
)

Called by owning level to shift an actor location and all relevant data structures by specified delta

Public function Virtual

void

 

EndPlay

(
    const EEndPlayReason::Type EndPlayR...
)

Overridable function called whenever this actor is being removed from a level

Public function Virtual

void

 

PostInitializeComponents()

Allow actors to initialize themselves on the C++ side after all of their components have been initialized, only called during gameplay

Public function Virtual Const

bool

 

ShouldTickIfViewportsOnly()

If true, actor is ticked even if TickType==LEVELTICK_ViewportsOnly

Classes

Name

Description

Public class

FOnBlendComplete

Fires when ViewTarget is set to PendingViewTarget

Constants

Name

Description

MAX_ACTIVE_CAMERA_ANIMS

CameraAnim support.

Deprecated Variables

Name Description

Public variable

FCameraCacheEnt...

 

CameraCache

This property is now deprecated, please use GetCameraCachePOV and SetCameraCachePOV functions instead.

Public variable

FCameraCacheEnt...

 

LastFrameCameraCache

This property is now deprecated, please use GetLastFrameCameraCachePOV and SetLastFrameCameraCachePOV functions instead.

See Also

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss