APlayerCameraManager

Inheritance Hierarchy

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

Internal. 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.

Public variable

FCameraCacheEnt ...

 

CameraCache

Cached camera properties.

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 (used when a view target override the aspect ratio and bConstrainAspectRatio is set; 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)

Public variable

FCameraCacheEnt ...

 

LastFrameCameraCache

Cached camera properties, one frame old.

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 < class U ...

 

ModifierList

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

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

MAX_ACTIVE_CAMERA_ANIMS constant Internal list of active post process effects.

Protected variable

TArray < float >

 

PostProcessBlendCacheWeights

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

Public variable

USceneComponent ...

 

TransformComponent

Dummy component we can use to attach things to the camera.

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...
)

APlayerCameraManager .

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.

Returns the new emitter actor.

Protected function Virtual

bool

 

AddCameraModifierToList

(
    UCameraModifier * NewModifier
)

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

Public function Virtual

UCameraModif ...

 

AddNewCameraModifier

(
    TSubclassOf < class UCameraModifier ...
)

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

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()

Internal. 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
)

Internal.

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 Effects

Returns first instance of a lens effect of the given class.

Public function Virtual

UCameraModif ...

 

FindCameraModifierByClass

(
    TSubclassOf < class UCameraModifier ...
)

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

Public function

UCameraAnimI ...

 

FindInstanceOfCameraAnim

(
    UCameraAnim const* Anim
)

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

Public function

void

 

GetCachedPostProcessBlends

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

Returns active post process info.

Public function

FVector

 

GetCameraLocation()

Returns camera's current location.

Public function

FRotator

 

GetCameraRotation()

Returns camera's current rotation.

Public function

void

 

GetCameraViewPoint

(
    FVector & OutCamLoc,
    FRotator & OutCamRot
)

Master function to retrieve Camera's actual view point.

Public function Virtual

float

 

GetFOVAngle()

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

Public function

float

 

GetLockedFOV()

Public function Virtual

float

 

GetOrthoWidth()

Returns the current orthographic width for the camera.

Public function Virtual

APlayerContr ...

 

GetOwningPlayerController()

Returns the PlayerController that owns this camera.

Public function

USceneCompon ...

 

GetTransformComponent()

Returns TransformComponent subobject Returns TransformComponent subobject

Public function

AActor *

 

GetViewTarget()

The current ViewTarget.

Public function

APawn *

 

GetViewTargetPawn()

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

void

 

InitTempCameraActor

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

Gets specified temporary CameraActor ready to update the specified Anim.

Public function Virtual

bool

 

IsOrthographic()

Returns true if this camera is using an orthographic perspective.

Protected function Virtual

void

 

LimitViewPitch

(
    FRotator & ViewRotation,
    float InViewPitchMin,
    float InViewPitchMax
)

Limit the player's view pitch.

Protected function Virtual

void

 

LimitViewRoll

(
    FRotator & ViewRotation,
    float InViewRollMin,
    float InViewRollMax
)

Limit the player's view roll.

Protected function Virtual

void

 

LimitViewYaw

(
    FRotator & ViewRotation,
    float InViewYawMin,
    float InViewYawMax
)

Limit the player's view yaw.

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,
    ECameraAnimPlaySpace::Type PlaySpac...,
    FRotator UserPlaySpaceRot
)

CameraAnim support.

Public function Virtual

UCameraShake ...

 

PlayCameraShake

(
    TSubclassOf < class UCameraShake > S...,
    float Scale,
    enum ECameraAnimPlaySpace::Type Pla...,
    FRotator UserPlaySpaceRot
)

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

Public function Static

void

 

PlayWorldCameraShake

(
    UWorld * InWorld,
    TSubclassOf < UCameraShake > Shake,
    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

 

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 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

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

 

StopAllInstancesOfCameraAnim

(
    UCameraAnim * Anim,
    bool bImmediate
)

Stop playing all instances of the indicated CameraAnim.

Public function Virtual

void

 

StopAllInstancesOfCameraShake

(
    TSubclassOf < class UCameraShake > S...,
    bool bImmediately
)

Stops playing CameraShake of the given class.

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

(
    UCameraShake * ShakeInstance,
    bool bImmediately
)

Immediately stops the given shake instance and invalidates it.

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

void

 

UpdateCameraPhotographyOnly()

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

Protected function Virtual

bool

 

UpdatePhotographyCamera

(
    FMinimalViewInfo & NewPOV
)

! Overridable

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
)

Relations.

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.

Public function Virtual

bool

 

ShouldTickIfViewportsOnly()

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

Constants

Name

Description

MAX_ACTIVE_CAMERA_ANIMS

CameraAnim support.

See Also

References

Module

Engine

Header

Runtime/Engine/Classes/Camera/PlayerCameraManager.h