Skip to content
M2O Scripting APIScripting reference
Runtime classClient APIGenerated

Vector3

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

Mutable three-dimensional vector for positions, directions, and Euler angles.

new Vector3(x, y, z): Vector3

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

Creates a vector from three numeric components.

number

Initial X component.

number

Initial Y component.

number

Initial Z component.

Vector3

add(other): this

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

Adds another vector to this vector in place.

Vector3

Vector to add component-wise.

this

This mutated vector for chaining.


clone(): Vector3

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

Creates an independent copy of this vector.

Vector3

New vector with the same components.


cross(other): this

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

Replaces this vector with its cross product against another vector.

Vector3

Second vector in the cross product.

this

This mutated perpendicular vector for chaining.


distance(other): number

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

Computes Euclidean distance to another vector.

Vector3

Vector to measure from this vector.

number

Distance between the two vectors.


div(scalar): this

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

Divides this vector by a scalar in place.

number

Divisor applied to every component; must be non-zero.

this

This mutated vector for chaining.


dot(other): number

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

Computes the dot product without changing either vector.

Vector3

Vector used for the dot product.

number

Scalar dot product.


lerp(target, t): this

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

Linearly interpolates this vector toward a target in place.

Vector3

Destination vector.

number

Interpolation factor; 0 keeps the current value and 1 reaches target.

this

This mutated vector for chaining.


mul(scalar): this

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

Multiplies this vector by a scalar in place.

number

Multiplier applied to every component.

this

This mutated vector for chaining.


normalize(): this

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

Normalizes this vector in place; a zero vector remains unchanged.

this

This mutated vector for chaining.


set(x, y, z): this

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

Replaces all components in place.

number

Replacement X component.

number

Replacement Y component.

number

Replacement Z component.

this

This mutated vector for chaining.


sub(other): this

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

Subtracts another vector from this vector in place.

Vector3

Vector to subtract component-wise.

this

This mutated vector for chaining.


toJSON(): object

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

Converts this vector to a plain object for JSON.stringify.

object

Object containing the current components.

x: number

y: number

z: number


toString(): string

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

Formats this vector for logging and debugging.

string

Text in Vector3(x, y, z) form.


static forward(): Vector3

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

Creates the framework’s positive-Z unit direction.

Vector3

New Vector3(0, 0, 1).


static one(): Vector3

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

Creates a vector whose components are one.

Vector3

New Vector3(1, 1, 1).


static right(): Vector3

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

Creates the framework’s positive-X unit direction.

Vector3

New Vector3(1, 0, 0).


static up(): Vector3

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

Creates the framework’s positive-Y unit direction.

Vector3

New Vector3(0, 1, 0).


static zero(): Vector3

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

Creates a zero vector.

Vector3

New Vector3(0, 0, 0).

readonly length: number

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

Read-only Euclidean magnitude of this vector.


readonly lengthSquared: number

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

Read-only squared magnitude, avoiding a square-root calculation.


x: number

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

Mutable X component.


y: number

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

Mutable Y component.


z: number

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

Mutable Z component.