UCameraShake

A CameraShake is an asset that defines how to shake the camera in a particular way.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

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

Include

#include "Camera/CameraShake.h"

Syntax

class UCameraShake : public UObject

Remarks

A CameraShake is an asset that defines how to shake the camera in a particular way. CameraShakes can be authored as either oscillating shakes, animated shakes, or both.

An oscillating shake will sinusoidally vibrate various camera parameters over time. Each location and rotation axis can be oscillated independently with different parameters to create complex and random-feeling shakes. These are easier to author and tweak, but can still feel mechanical and are limited to vibration-style shakes, such as earthquakes.

Animated shakes play keyframed camera animations. These can take more effort to author, but enable more natural-feeling results and things like directional shakes. For instance, you can have an explosion to the camera's right push it primarily to the left.

Variables

Name Description

Public variable

UCameraAnim ...

 

Anim

Source camera animation to play. Can be null.

Public variable

float

 

AnimBlendInTime

Linear blend-in time.

Public variable

float

 

AnimBlendOutTime

Linear blend-out time.

Public variable

UCameraAnimInst...

 

AnimInst

The playing instance of the CameraAnim-based shake, if any.

Public variable

float

 

AnimPlayRate

Scalar defining how fast to play the anim.

Public variable

float

 

AnimScale

Scalar defining how "intense" to play the anim.

Protected variable

uint16: 1

 

bBlendingIn

True if this shake is currently blending in.

Protected variable

uint16: 1

 

bBlendingOut

True if this shake is currently blending out.

Public variable

uint32: 1

 

bRandomAnimSegment

If true, play a random snippet of the animation of length Duration.

Public variable

uint32: 1

 

bSingleInstance

If true to only allow a single instance of this shake class to play at any given time.

Protected variable

APlayerCameraMa...

 

CameraOwner

Protected variable

float

 

CurrentBlendInTime

How long this instance has been blending in.

Protected variable

float

 

CurrentBlendOutTime

How long this instance has been blending out.

Public variable

FFOscillator

 

FOVOscillation

FOV oscillation

Protected variable

float

 

FOVSinOffset

Current FOV sinusoidal offset.

Protected variable

float

 

InitialFOVSinOffset

Initial offset (could have been assigned at random).

Protected variable

FVector

 

InitialLocSinOffset

Initial offset (could have been assigned at random).

Protected variable

FVector

 

InitialRotSinOffset

Initial offset (could have been assigned at random).

Public variable

FVOscillator

 

LocOscillation

Positional oscillation

Protected variable

FVector

 

LocSinOffset

Current location sinusoidal offset.

Public variable

float

 

OscillationBlendInTime

Duration of the blend-in, where the oscillation scales from 0 to 1.

Public variable

float

 

OscillationBlendOutTime

Duration of the blend-out, where the oscillation scales from 1 to 0.

Public variable

float

 

OscillationDuration

Duration in seconds of current screen shake. Less than 0 means indefinite, 0 means no oscillation.

Public variable

float

 

OscillatorTimeRemaining

Time remaining for oscillation shakes. Less than 0.f means shake infinitely.

Protected variable

ECameraAnimPlay...

 

PlaySpace

What space to play the shake in before applying to the camera.

Public variable

float

 

RandomAnimSegmentDuration

When bRandomAnimSegment is true, this defines how long the anim should play.

Public variable

FROscillator

 

RotOscillation

Rotational oscillation

Protected variable

FVector

 

RotSinOffset

Current rotational sinusoidal offset.

Public variable

float

 

ShakeScale

Overall intensity scale for this shake instance.

Protected variable

AActor *

 

TempCameraActorForCameraAnims

Temp actor to use for playing camera anims.

Protected variable

FMatrix

 

UserPlaySpaceMatrix

Matrix defining the playspace, used when PlaySpace == CAPS_UserDefined

Constructors

Name Description

Public function

UCameraShake

(
    const FObjectInitializer& ObjectIn...
)

Functions

Name Description

Public function

void

 

BlueprintUpdateCameraShake

(
    float DeltaTime,
    float Alpha,
    const FMinimalViewInfo& POV,
    FMinimalViewInfo& ModifiedPOV
)

Called every tick to let the shake modify the point of view

Public function Virtual Const

bool

 

IsFinished()

Public function Const

bool

 

IsLooping()

Returns true if this camera shake will loop forever.

Public function Virtual

void

 

PlayShake

(
    APlayerCameraManager* Camera,
    float Scale,
    ECameraAnimPlaySpace::Type InPlaySp...,
    FRotator UserPlaySpaceRot
)

Public function Const

bool

 

ReceiveIsFinished()

Called to allow a shake to decide when it's finished playing.

Public function

void

 

ReceivePlayShake

(
    float Scale
)

Called when the shake starts playing

Public function

void

 

ReceiveStopShake

(
    bool bImmediately
)

Called when the shake is explicitly stopped.

Public function

void

 

SetCurrentTimeAndApplyShake

(
    float NewTime,
    FMinimalViewInfo& POV
)

Sets current playback time and applies the shake (both oscillation and cameraanim) to the given POV.

Public function

void

 

SetTempCameraAnimActor

(
    AActor* Actor
)

Public function Virtual

void

 

StopShake

(
    bool bImmediately
)

Stops this shake from playing.

Public function Virtual

void

 

UpdateAndApplyCameraShake

(
    float DeltaTime,
    float Alpha,
    FMinimalViewInfo& InOutPOV
)

Native API.

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