Camera

Handles the game's camera. Accessed through game.Render.camera

Constructor

new Camera(Render)

Creates a new camera object used by Render

Parameters:
NameTypeDescription
RenderRender

Render object the camera for

Members

(readonly) position :vec

Position of the camera

Type:

(readonly) fov :number

Field of view

Type:
  • number

Methods

setPosition(position)

Sets the camera position

Parameters:
NameTypeDescription
positionvec

New position

setFov(fov)

Sets the camera's field of view

Parameters:
NameTypeDescription
fovnumber

New field of view

(async) shake(intensityopt, durationopt, intensityCurveopt, directionopt)

Parameters:
NameTypeAttributesDefaultDescription
intensitynumber<optional>
30

How much the camera shakes

durationnumber<optional>
1

How long the camera shakes, in seconds

intensityCurvefunction<optional>
Animation.ease.out.cubic

Animation curve, see Animation for ease functions

directionvec<optional>

Direction the camera shakes. Shakes in all directions if left undefined