OrthographicCamera

Package: Libraries.Game.Graphics · Inherits from: Libraries.Language.Object, Libraries.Game.Graphics.Camera

Actions

GetZoom()

The GetZoom action returns the current level of zoom used by the camera. The default value is 1.

Returns

number

Initialize(number viewportWidth, number viewportHeight)

Initializes the camera by giving a width and height for the camera to show in virtual space.

Parameters

  • viewportWidth number
  • viewportHeight number

Move(number x, number y)

This action will move the camera by the given amount on each axis.

Parameters

  • x number
  • y number

Move(Libraries.Compute.Vector2 vector)

This action will move the camera by the amount of the given 2D vector.

Parameters

Rotate(number degrees)

This action will rotate the camera by the given number of degrees around the camera's direction vector. If the camera has been SetToOrthographic(), then this vector should be perpendicular to the 2D plane of the screen space.

Parameters

  • degrees number

Scale(number scale)

This action will scale the size of the camera lens while maintaining the position of the bottom left corner of the viewing area.

Parameters

  • scale number: The amount to scale the camera lens.

ScaleTo(number width, number height)

This action will scale the size of the camera lens while maintaining the position of the bottom left corner of the viewing area.

Parameters

  • width number: The width the lens should be after scaling.
  • height number: The height the lens should be after scaling.

SetPosition(number x, number y)

This action will set the camera's position in 2D space. If used in a 3D environment, it will set the camera's x and y position without affecting its z position.

Parameters

  • x number
  • y number

SetPosition(Libraries.Compute.Vector2 vector)

This action will set the camera's position in 2D space. If used in a 3D environment, it will set the camera's x and y position without affecting its z position.

Parameters

SetToOrthographic(number viewportWidth, number viewportHeight)

This action will set the camera to an orthographic projection using a viewport of the given width and height.

Parameters

  • viewportWidth number
  • viewportHeight number

SetToOrthographic()

This action will set the camera to an orthographic projection using a viewport fitting the game's full width and height.

SetZoom(number zoom)

The SetZoom action will set the zoom level of the camera. A value of 1 will use the default zoom. A smaller value will zoom the camera out, while a larger value will zoom the camera in.

Parameters

  • zoom number

Update()

This action recalculates the camera's position and data. This should be used after the camera has been manipulated in any way.

Inherited Actions

64 actions from Libraries.Game.Graphics.Camera
3 actions from Libraries.Language.Object