Skip to content
KCKingdoms Connected Scripting APIScripting guides and API
Runtime classClient APIGenerated

Vector4

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

Mutable four-dimensional vector.

new Vector4(x, y, z, w): Vector4

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

Creates a vector from four numeric components.

number

Initial X component.

number

Initial Y component.

number

Initial Z component.

number

Initial W component.

Vector4

add(other): this

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

Adds another vector to this vector in place.

Vector4

Vector to add component-wise.

this

This mutated vector for chaining.


clone(): Vector4

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

Creates an independent copy of this vector.

Vector4

New vector with the same components.


distance(other): number

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

Computes Euclidean distance to another vector.

Vector4

Vector to measure from this vector.

number

Distance between the two vectors.


div(scalar): this

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

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:4035

Computes the dot product without changing either vector.

Vector4

Vector used for the dot product.

number

Scalar dot product.


lerp(target, t): this

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

Linearly interpolates this vector toward a target in place.

Vector4

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:4021

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:4048

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

this

This mutated vector for chaining.


set(x, y, z, w): this

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

Replaces all components in place.

number

Replacement X component.

number

Replacement Y component.

number

Replacement Z component.

number

Replacement W component.

this

This mutated vector for chaining.


sub(other): this

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

Subtracts another vector from this vector in place.

Vector4

Vector to subtract component-wise.

this

This mutated vector for chaining.


toJSON(): object

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

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

object

Object containing the current components.

w: number

x: number

y: number

z: number


toString(): string

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

Formats this vector for logging and debugging.

string

Text in Vector4(x, y, z, w) form.


static one(): Vector4

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

Creates a vector whose components are one.

Vector4

New Vector4(1, 1, 1, 1).


static zero(): Vector4

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

Creates a zero vector.

Vector4

New Vector4(0, 0, 0, 0).

readonly length: number

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

Read-only Euclidean magnitude of this vector.


readonly lengthSquared: number

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

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


w: number

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

Mutable W component.


x: number

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

Mutable X component.


y: number

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

Mutable Y component.


z: number

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

Mutable Z component.