Skip to content

static class Camera (client-side)

Available since version: 0.1.3

This class represents in game Camera.

Properties

Mat4& vobMatrix

Deprecated since version: 0.3.4

Represents the reference to the camera vob matrix in world space.


Mat4& viewMatrix (read-only)

Available since version: 0.2.0

Represents the reference to the camera view matrix.


Mat4& projectionMatrix (read-only)

Available since version: 0.2.0

Represents the reference to the camera projection matrix.


Mat4& worldMatrix (read-only)

Available since version: 0.2.0

Represents the reference to the camera world matrix.


Mat4& worldViewMatrix (read-only)

Available since version: 0.2.0

Represents the reference to the camera world-view matrix.


bool modeChangeEnabled

Represents the camera mode change feature.
When mode change is enabled, game switches between different camera modes, e.g: when you draw weapon, camera mode will switch to "CAMMODMELEE".


bool movementEnabled

Represents the camera movement feature.
When movement is disabled, the camera gets detached from the player.


Vob& targetVob

Available since version: 0.3.4

Represents the reference to the currently attached vob for the camera.


float targetAlpha

Available since version: 0.3.4

Note

The alpha must be in range between 0.0 (fully transparent) to 1.0 (fully visible).

Represents the transparency of the target camera vob visual.


float nearClipZ (read-only)

Available since version: 0.3.5.6

Represents the near plane of the camera.


float farClipZ (read-only)

Available since version: 0.3.5.6

Represents the far plane of the camera.


Methods

setMode

This method will set the camera mode.

void setMode(string mode, array[userpointer] targetList)

Parameters:

  • string mode: the camera mode.
  • array[userpointer] targetList: =[] the list containing vobs used by the specific camera mode, e.g: CamModDialog requires list containing two npc pointers.

getMode

This method will get the camera mode.

string getMode()

Returns string:

the camera mode.


getPosition

This method will get the camera position.

Vec3 getPosition()

Returns Vec3:

the camera position.


setPosition

This method will set the camera position.

void setPosition(float x, float y, float z)

Parameters:

  • float x: the position on x axis.
  • float y: the position on y axis.
  • float z: the position on z axis.

getRotation

Note

There's no guarantee that returned rotation will be the same as the set one.

This method will get the camera rotation.

Vec3 getRotation()

Returns Vec3:

the camera rotation.


setRotation

This method will set the camera rotation.

void setRotation(float x, float y, float z)

Parameters:

  • float x: the rotation on x-axis in degrees.
  • float y: the rotation on y-axis in degrees.
  • float z: the rotation on z-axis in degrees.

project

Available since version: 0.1.10

This method will convert point from 3d world space to screen coordinates (pixels).

Vec2|null project(float x, float y, float z)

Parameters:

  • float x: the position on x axis.
  • float y: the position on y axis.
  • float z: the position on z axis.

Returns Vec2|null:

screen coordinates represented as pixels. If projected point is behind camera, null is returned instead.


backProject

Available since version: 0.2.1

This method will convert point from 2d screen coordinates (pixels) to 3d world space.

Vec3 backProject(int screenX, int screenY, float distance)

Parameters:

  • int screenX: the x position on screen in pixels.
  • int screenY: the y position on screen in pixels.
  • float distance: the relative distance from the camera.

Returns Vec3:

world space coordinates.


setTargetVob

Deprecated since version: 0.3.4

This method will set the target vob for the camera.

void setTargetVob(Vob vob)

Parameters:

  • Vob vob: the vob object reference.

setTargetPlayer

Deprecated since version: 0.3.4

This method will set the target player for the camera.

void setTargetPlayer(int playerId)

Parameters:

  • int playerId: the id of the player.

getFOV

Available since version: 0.3.0

This method will get the camera FOV.

{x, y} getFOV()

Returns {x, y}:

the camera FOV.


setFOV

Available since version: 0.3.0

This method will set the camera FOV.

void setFOV(float x, float y)

Parameters:

  • float x: the FOV value on x-axis.
  • float y: the FOV value on y-axis.

Callbacks

No callbacks.