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

PropGhost

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

A preview this client is drawing: one or more of the game’s meshes standing in the world with no body and no collision.

new PropGhost(id): PropGhost

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

Creates a handle for a ghost that already exists; use PropGhost.create() to make one.

number

Identifier of a ghost that already exists.

PropGhost

destroy(): boolean

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

Takes the ghost out of the world.

boolean

True when it was still there to take.


getBounds(): PropGhostBounds | null

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

The box the ghost occupies right now, in world space, as the engine reports it for the meshes themselves.

PropGhostBounds | null

Its bounds, or null once it is gone and for a ghost whose meshes carry none.


setHidden(hidden): boolean

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

Hides or shows the ghost without dropping it, which is cheaper than destroying and rebuilding one.

boolean

Whether to take it out of the draw.

boolean

True while the ghost is still standing.


setPose(position, rotation?, scale?): boolean

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

Moves the whole ghost, parts and all. Cheap enough to call every frame: a part is moved with one engine call that re-sorts it into the world by itself.

Vector3

Where the ghost stands, in world-space metres.

Quaternion

Which way it faces. The identity by default, which faces +Y.

number

Uniform scale, 1 by default and clamped to 0.01 - 100.

boolean

True while the ghost is still standing.


setTint(tint?): boolean

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

Recolours the ghost.

This is a real tint rather than a swapped material: the ghost’s materials are private copies, and writing an opacity under 1 on one is what moves it into the renderer’s transparent pass. A tint it already carries costs nothing, so this is safe to call every frame.

Color

The colour to wash the ghost in, with a below 1 making it translucent. Omit it, or pass null, to put every mesh back to the materials it shipped with.

boolean

True while the ghost is still standing.


toString(): string

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

Formats this ghost handle for logging and debugging.

string

The ghost’s id, and whether it is still standing.


static create(options): PropGhost | null

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

Puts a preview into the world: the game’s own geometry, with no body, no collision and nothing replicated.

This is what a build preview, a placement outline or a menu turntable is made of. It is not a prop – nobody else can see it, and it does not survive a level load.

model is one mesh from the shared prop catalog; models is several, which is how a blueprint of more than one piece is previewed. offsets and rotations line up with models by index and place each piece inside the ghost’s own frame, so the whole thing turns and scales as one. A path the catalog does not carry is refused, because it is a path the server could never be asked to spawn afterwards.

position, rotation and scale are where the ghost stands. tint washes it in a colour, with a below 1 making it translucent; omitted, every mesh keeps the materials it shipped with.

string

string[]

Vector3[]

Vector3

Quaternion

Quaternion[]

number

Color

PropGhost | null

The ghost, or null when this client has no world, at the ghost limit, and when not one of the meshes would load.


static destroyAll(): void

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

Takes every ghost this client is drawing out of the world, including other resources’.

void

readonly id: number

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

Identifier of this ghost, unique for the lifetime of the session. Ids are not reused.


readonly valid: boolean

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

Whether the ghost is still standing. A handle to a destroyed one keeps reading; every call on it answers false. A level load destroys every ghost, because the nodes they are made of belong to the level that went.