Skip to content
M2O Scripting APIScripting reference
Global objectClient APIGenerated

Camera

const Camera: object

Defined in: client/api.d.ts:658

Client control of the local game camera: projecting world positions through it, and driving a scripted view on its own camera layer.

interpolate(x, y, z, lookX, lookY, lookZ, durationSeconds): void

Smoothly moves the camera from its current view to a fixed destination until reset is called.

number

Destination camera world-space X coordinate.

number

Destination camera world-space Y coordinate.

number

Destination camera world-space Z coordinate.

number

Destination world-space look-at X coordinate.

number

Destination world-space look-at Y coordinate.

number

Destination world-space look-at Z coordinate.

number

Transition duration in seconds; zero or less cuts.

void

isScripted(): boolean

Checks whether a scripted camera view is currently held.

boolean

True while setPosition or interpolate owns the camera.

reset(): void

Returns control to the normal gameplay camera.

void

setPosition(x, y, z, lookX, lookY, lookZ): void

Cuts the camera to a fixed position and look-at target until reset is called. Streaming stays pinned to the player while a scripted view is active.

number

Camera world-space X coordinate.

number

Camera world-space Y coordinate.

number

Camera world-space Z coordinate.

number

World-space X coordinate the camera looks at.

number

World-space Y coordinate the camera looks at.

number

World-space Z coordinate the camera looks at.

void

worldToScreen(x, y, z): ScreenPosition

Projects a world-space position to display pixel coordinates.

number

World X coordinate.

number

World Y coordinate.

number

World Z coordinate.

ScreenPosition

Screen coordinates and whether the point is visible through the active camera.

const point = Camera.worldToScreen(10, 20, 5);
if (point.visible) {
// point.x and point.y are display pixels.
}