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.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”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.
Parameters
Section titled “Parameters”number
Identifier of a ghost that already exists.
Returns
Section titled “Returns”PropGhost
Methods
Section titled “Methods”destroy()
Section titled “destroy()”destroy():
boolean
Defined in: client/api.d.ts:2668
Takes the ghost out of the world.
Returns
Section titled “Returns”boolean
True when it was still there to take.
getBounds()
Section titled “getBounds()”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.
Returns
Section titled “Returns”PropGhostBounds | null
Its bounds, or null once it is gone and for a ghost whose meshes carry none.
setHidden()
Section titled “setHidden()”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.
Parameters
Section titled “Parameters”hidden
Section titled “hidden”boolean
Whether to take it out of the draw.
Returns
Section titled “Returns”boolean
True while the ghost is still standing.
setPose()
Section titled “setPose()”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.
Parameters
Section titled “Parameters”position
Section titled “position”Where the ghost stands, in world-space metres.
rotation?
Section titled “rotation?”Which way it faces. The identity by default, which faces +Y.
scale?
Section titled “scale?”number
Uniform scale, 1 by default and clamped to 0.01 - 100.
Returns
Section titled “Returns”boolean
True while the ghost is still standing.
setTint()
Section titled “setTint()”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.
Parameters
Section titled “Parameters”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.
Returns
Section titled “Returns”boolean
True while the ghost is still standing.
toString()
Section titled “toString()”toString():
string
Defined in: client/api.d.ts:2631
Formats this ghost handle for logging and debugging.
Returns
Section titled “Returns”string
The ghost’s id, and whether it is still standing.
create()
Section titled “create()”
staticcreate(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.
Parameters
Section titled “Parameters”options
Section titled “options”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.
model?
Section titled “model?”string
models?
Section titled “models?”string[]
offsets?
Section titled “offsets?”Vector3[]
position
Section titled “position”rotation?
Section titled “rotation?”rotations?
Section titled “rotations?”scale?
Section titled “scale?”number
Returns
Section titled “Returns”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.
destroyAll()
Section titled “destroyAll()”
staticdestroyAll():void
Defined in: client/api.d.ts:2684
Takes every ghost this client is drawing out of the world, including other resources’.
Returns
Section titled “Returns”void
Properties
Section titled “Properties”
readonlyid:number
Defined in: client/api.d.ts:2620
Identifier of this ghost, unique for the lifetime of the session. Ids are not reused.
readonlyvalid: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.