Camera
constCamera:object
Defined in: client/api.d.ts:2072
Local cinematic camera control for client resources.
Type Declaration
Section titled “Type Declaration”active
Section titled “active”
readonlyactive:boolean
Whether the custom camera owns the current view target.
readonlylens:CameraLens
Current custom-camera lens settings.
paused
Section titled “paused”
readonlypaused:boolean
Whether camera motion is paused.
playing
Section titled “playing”
readonlyplaying:boolean
Whether a tween, path, or orbit is running.
readonlypose:CameraPose
Current custom-camera pose.
readonlystate:CameraState
Complete immutable state snapshot.
activate()
Section titled “activate()”activate(
view,transition?):boolean
Activates a fixed custom camera.
Parameters
Section titled “Parameters”transition?
Section titled “transition?”Returns
Section titled “Returns”boolean
addLensEffect()
Section titled “addLensEffect()”addLensEffect(
classPath):boolean
Adds a camera lens-effect class.
Parameters
Section titled “Parameters”classPath
Section titled “classPath”string
Returns
Section titled “Returns”boolean
addModifier()
Section titled “addModifier()”addModifier(
classPath):boolean
Adds a camera-modifier class.
Parameters
Section titled “Parameters”classPath
Section titled “classPath”string
Returns
Section titled “Returns”boolean
animateTo()
Section titled “animateTo()”animateTo(
view,options?):boolean
Animates the active camera to a view.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”boolean
capture()
Section titled “capture()”capture():
CameraView|null
Captures the live game camera as a reusable view, or null while no camera manager exists.
Returns
Section titled “Returns”CameraView | null
clearLensEffects()
Section titled “clearLensEffects()”clearLensEffects():
boolean
Clears all camera lens effects.
Returns
Section titled “Returns”boolean
clearLookAt()
Section titled “clearLookAt()”clearLookAt():
void
Stops look-at control without stopping other motion.
Returns
Section titled “Returns”void
fade()
Section titled “fade()”fade(
options):boolean
Starts a camera fade.
Parameters
Section titled “Parameters”options
Section titled “options”Returns
Section titled “Returns”boolean
getBroomCrosshair()
Section titled “getBroomCrosshair()”getBroomCrosshair():
boolean
Whether setBroomCrosshair is on; false by default.
Returns
Section titled “Returns”boolean
getBroomFreeLook()
Section titled “getBroomFreeLook()”getBroomFreeLook():
boolean
Whether setBroomFreeLook is on; false by default.
Returns
Section titled “Returns”boolean
getDistanceScale()
Section titled “getDistanceScale()”getDistanceScale():
number
The factor setDistanceScale last kept; 1 by default.
Returns
Section titled “Returns”number
getFirstPerson()
Section titled “getFirstPerson()”getFirstPerson():
boolean
Whether setFirstPerson is on; false by default.
Returns
Section titled “Returns”boolean
getFovOffset()
Section titled “getFovOffset()”getFovOffset():
number
The offset setFovOffset last kept; 0 by default.
Returns
Section titled “Returns”number
getLookInput()
Section titled “getLookInput()”getLookInput():
CameraLookInput
Mouse look since the previous call, in degrees, then clears it. Gathered only while the custom camera is active and neither the cursor nor a game menu owns the mouse; zero otherwise. The game’s own camera stops reading the mouse while a custom camera owns the view, so read this to steer it.
Returns
Section titled “Returns”getPostProcess()
Section titled “getPostProcess()”getPostProcess(
key):CameraPostProcessState|null
A layer as it stands, or null.
Parameters
Section titled “Parameters”string
Stable key, at most 128 characters.
Returns
Section titled “Returns”CameraPostProcessState | null
getViewDistanceScale()
Section titled “getViewDistanceScale()”getViewDistanceScale():
number
The factor setViewDistanceScale last kept; 1 by default.
Returns
Section titled “Returns”number
lookAt()
Section titled “lookAt()”lookAt(
target,track?):boolean
Aims the active camera at a world position.
Parameters
Section titled “Parameters”target
Section titled “target”track?
Section titled “track?”boolean
Returns
Section titled “Returns”boolean
orbit()
Section titled “orbit()”orbit(
target,options?):boolean
Starts an automated orbit around a world position.
Parameters
Section titled “Parameters”target
Section titled “target”options?
Section titled “options?”Returns
Section titled “Returns”boolean
pause()
Section titled “pause()”pause():
void
Pauses camera motion.
Returns
Section titled “Returns”void
playAnimation()
Section titled “playAnimation()”playAnimation(
assetPath,options?):boolean
Plays a cooked CameraAnim asset.
Parameters
Section titled “Parameters”assetPath
Section titled “assetPath”string
options?
Section titled “options?”Returns
Section titled “Returns”boolean
playPath()
Section titled “playPath()”playPath(
keyframes,options?):boolean
Plays a keyframed camera path.
Parameters
Section titled “Parameters”keyframes
Section titled “keyframes”options?
Section titled “options?”Returns
Section titled “Returns”boolean
playShake()
Section titled “playShake()”playShake(
classPath,options?):boolean
Starts a cooked CameraShake class.
Parameters
Section titled “Parameters”classPath
Section titled “classPath”string
options?
Section titled “options?”Returns
Section titled “Returns”boolean
postProcessKeys()
Section titled “postProcessKeys()”postProcessKeys():
string[]
Keys of this resource’s layers.
Returns
Section titled “Returns”string[]
postProcessPresets()
Section titled “postProcessPresets()”postProcessPresets():
string[]
The photo-mode filters a layer’s preset can name.
Returns
Section titled “Returns”string[]
postProcessSettings()
Section titled “postProcessSettings()”postProcessSettings():
string[]
Every setting a layer can set, by its Unreal name.
Returns
Section titled “Returns”string[]
removeAllPostProcess()
Section titled “removeAllPostProcess()”removeAllPostProcess():
number
Removes every layer this resource set, at once.
Returns
Section titled “Returns”number
How many there were.
removePostProcess()
Section titled “removePostProcess()”removePostProcess(
key,fade?):boolean
Removes a layer.
Parameters
Section titled “Parameters”string
Stable key, at most 128 characters.
number
Seconds to blend out first. Default 0.
Returns
Section titled “Returns”boolean
false when no layer has the key
restore()
Section titled “restore()”restore(
transition?):void
Returns control to the player camera.
Parameters
Section titled “Parameters”transition?
Section titled “transition?”Returns
Section titled “Returns”void
resume()
Section titled “resume()”resume():
void
Resumes camera motion.
Returns
Section titled “Returns”void
screenToRay()
Section titled “screenToRay()”screenToRay(
x,y): {dir:Vector3;origin:Vector3; } |null
The world ray through a point of the view, given as worldToScreen’s fractions: an origin just in front of the camera and a unit direction. Null without a view.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”{ dir: Vector3; origin: Vector3; } | null
setBroomCrosshair()
Section titled “setBroomCrosshair()”setBroomCrosshair(
shown):boolean
Draws a crosshair at the centre of the view while the local player rides a broom, where a spell cast along the view goes; the game shows no reticle in flight. While it shows, the camera steps right over the rider’s shoulder, as the on-foot camera sits, so the rider is not under it. It hides with the game’s HUD, behind a game menu and while a custom camera owns the view. Off by default. Returns the setting kept.
Parameters
Section titled “Parameters”boolean
Returns
Section titled “Returns”boolean
setBroomFreeLook()
Section titled “setBroomFreeLook()”setBroomFreeLook(
enabled):boolean
Frees the game camera’s pitch while the local player rides a broom: the mouse and right stick look up and down, and the camera stays there instead of following the broom’s own pitch, so a spell cast along the view can be aimed above or below. The broom still climbs and dives on its own keys; on a gamepad those are the right stick’s, so climbing tilts the view too. Off by default; turning it off or dismounting hands the pitch back. Returns the setting kept.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”boolean
setDistanceScale()
Section titled “setDistanceScale()”setDistanceScale(
scale):number
Moves the game’s own third-person camera back (above 1) or in (below 1) from the local player, as a factor on its usual distance, held to 0.5-4; returns the factor kept. Walls still pull it in, and aiming, combat and mounts keep their own distance. An animal form multiplies in its own factor for its size. 1 restores it.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”number
setFirstPerson()
Section titled “setFirstPerson()”setFirstPerson(
enabled):boolean
Shows the game’s own camera from the local player’s eyes. The view sits on the eyes and turns about them as a head does, eased so the run cycle does not shake it, and pitches 85 degrees up and down. It is still the game’s camera, so look, aim mode and a broom ride work as before. The player’s own head and hair are hidden for them alone and still cast their shadow; a hood or hat loses the part on the head. A custom camera shows them again. The game has no first-person animations, so the body still turns toward where it walks. Off by default. Returns the setting kept.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”boolean
setFovOffset()
Section titled “setFovOffset()”setFovOffset(
degrees):number
Widens (above 0) or narrows (below 0) the game’s own camera by this many degrees, on top of the player’s Field of View option, held to -30..60; returns the offset kept. The player’s saved option is not changed, and the game’s own zooms (aiming, sprinting) still play around it. 0 restores it. A custom camera has its own lens: see setLens.
Parameters
Section titled “Parameters”degrees
Section titled “degrees”number
Returns
Section titled “Returns”number
setLens()
Section titled “setLens()”setLens(
lens):boolean
Updates selected lens fields on the active camera.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
setPose()
Section titled “setPose()”setPose(
pose):boolean
Moves the active custom camera immediately.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
setPostProcess()
Section titled “setPostProcess()”setPostProcess(
key,layer):boolean
Creates or replaces a post-process layer on this client’s view. It shows from the next frame and comes back by itself after a level change. Keys belong to the calling resource, and its layers go when it stops. Throws a TypeError on an unknown setting or a value its type can’t take, and an Error at 64 layers.
Parameters
Section titled “Parameters”string
Stable key, at most 128 characters.
Returns
Section titled “Returns”boolean
true
setViewDistanceScale()
Section titled “setViewDistanceScale()”setViewDistanceScale(
scale):number
Scales how far the world draws for the local player, as a factor on their own View Distance quality, held to 0.25-4; returns the factor kept. It moves the distance at which objects swap detail level or stop drawing; it loads no more of the world. 1 restores it.
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”number
stop()
Section titled “stop()”stop():
void
Stops camera motion while keeping the current view.
Returns
Section titled “Returns”void
stopAnimations()
Section titled “stopAnimations()”stopAnimations(
immediate?):boolean
Stops all CameraAnim instances.
Parameters
Section titled “Parameters”immediate?
Section titled “immediate?”boolean
Returns
Section titled “Returns”boolean
stopFade()
Section titled “stopFade()”stopFade():
boolean
Stops the active camera fade.
Returns
Section titled “Returns”boolean
stopShakes()
Section titled “stopShakes()”stopShakes(
immediate?):boolean
Stops all camera shakes.
Parameters
Section titled “Parameters”immediate?
Section titled “immediate?”boolean
Returns
Section titled “Returns”boolean
updatePostProcess()
Section titled “updatePostProcess()”updatePostProcess(
key,changes):boolean
Changes some of a layer’s fields; settings merge one by one, and null drops one. Throws like setPostProcess.
Parameters
Section titled “Parameters”string
Stable key, at most 128 characters.
changes
Section titled “changes”Returns
Section titled “Returns”boolean
false when no layer has the key
worldToScreen()
Section titled “worldToScreen()”worldToScreen(
point): {x:number;y:number; } |null
Where a world point lands in the view the player sees, as fractions of it from the top-left (0..1): scale by a page’s innerWidth and innerHeight to pin an element there. Null when the point is behind the camera or outside the view. Read it every frame for a moving point.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”{ x: number; y: number; } | null