WorldObject
Defined in: server/api.d.ts:2188
A server-owned, interest-streamed world-object handle.
Extends
Section titled “Extends”ServerEntity.ServerEntity
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new WorldObject(
id):WorldObject
Defined in: server/api.d.ts:2193
Wraps a world-object entity id without spawning it.
Parameters
Section titled “Parameters”number
Network id of the server entity to wrap.
Returns
Section titled “Returns”WorldObject
Methods
Section titled “Methods”applyAngularImpulse()
Section titled “applyAngularImpulse()”applyAngularImpulse(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2360
Applies an instantaneous angular impulse in radians.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
applyAngularImpulseDegrees()
Section titled “applyAngularImpulseDegrees()”applyAngularImpulseDegrees(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2396
applyAngularImpulse with the vector in degrees.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
applyForce()
Section titled “applyForce()”applyForce(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2333
Applies a force for one physics step; call every tick for a continuous push. False when nobody simulates it.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
applyImpulse()
Section titled “applyImpulse()”applyImpulse(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2342
Applies an instantaneous impulse, optionally at a world point (opts.at).
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
applyTorque()
Section titled “applyTorque()”applyTorque(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2351
Applies a torque in radians for one physics step.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
applyTorqueDegrees()
Section titled “applyTorqueDegrees()”applyTorqueDegrees(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2387
applyTorque with the vector in degrees, the unit the rest of the API uses.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
attachTo()
Section titled “attachTo()”attachTo(
player,socket?):boolean
Defined in: server/api.d.ts:2412
Attaches a physics object to a player’s body on every client. False for a placed (non-physics) object or a missing player.
Parameters
Section titled “Parameters”player
Section titled “player”Carrier; their client becomes the owner.
socket?
Section titled “socket?”string
Body mesh socket it rides; the mesh origin when omitted.
Returns
Section titled “Returns”boolean
clearMaterialParams()
Section titled “clearMaterialParams()”clearMaterialParams():
void
Defined in: server/api.d.ts:2314
Drops every parameter set by setMaterialParam.
Returns
Section titled “Returns”void
destroy()
Section titled “destroy()”destroy():
boolean
Defined in: server/api.d.ts:2273
Destroys this world-object entity.
Returns
Section titled “Returns”boolean
detach()
Section titled “detach()”detach():
boolean
Defined in: server/api.d.ts:2417
Releases a carried physics object where it is. Its carrier keeps simulating it until the election moves it on.
Returns
Section titled “Returns”boolean
getAngularVelocity()
Section titled “getAngularVelocity()”getAngularVelocity():
Vector3
Defined in: server/api.d.ts:2324
Last simulator-reported angular velocity in rad/s.
Returns
Section titled “Returns”getLinearVelocity()
Section titled “getLinearVelocity()”getLinearVelocity():
Vector3
Defined in: server/api.d.ts:2319
Last simulator-reported velocity in cm/s.
Returns
Section titled “Returns”getMaterialParams()
Section titled “getMaterialParams()”getMaterialParams():
WorldObjectMaterialParam[]
Defined in: server/api.d.ts:2309
The parameters set by setMaterialParam, colors as linear { r, g, b, a }.
Returns
Section titled “Returns”getMaterials()
Section titled “getMaterials()”getMaterials():
Record<number,string>
Defined in: server/api.d.ts:2296
The per-slot materials set by materials or setMaterial, by slot.
Returns
Section titled “Returns”Record<number, string>
getScale()
Section titled “getScale()”getScale():
Vector3
Defined in: server/api.d.ts:2278
Scale per axis; a negative axis is mirrored.
Returns
Section titled “Returns”hasCollisionFor()
Section titled “hasCollisionFor()”hasCollisionFor(
player):boolean
Defined in: server/api.d.ts:2433
Whether this object blocks the player: false when it was created with collision off or the player has a pass (setCollisionFor).
Parameters
Section titled “Parameters”player
Section titled “player”Returns
Section titled “Returns”boolean
setAngularVelocity()
Section titled “setAngularVelocity()”setAngularVelocity(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2378
Sets the body’s angular velocity in rad/s.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
setAngularVelocityDegrees()
Section titled “setAngularVelocityDegrees()”setAngularVelocityDegrees(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2405
Sets the body’s angular velocity in degrees/s.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
setCollisionFor()
Section titled “setCollisionFor()”setCollisionFor(
player,enabled):boolean
Defined in: server/api.d.ts:2428
With false, the player walks through this collidable object and the bolts they fire fly through it, on every client; everyone and everything else meets it as before. The pass ends when the player leaves. False for an object created with collision off, a missing player, or a 65th pass.
Parameters
Section titled “Parameters”player
Section titled “player”enabled
Section titled “enabled”boolean
false lets the player through; true blocks them again.
Returns
Section titled “Returns”boolean
setLinearVelocity()
Section titled “setLinearVelocity()”setLinearVelocity(
x,y?,z?,opts?):boolean
Defined in: server/api.d.ts:2369
Sets the body’s velocity in cm/s.
Parameters
Section titled “Parameters”number | Vector3
X component, or the whole vector.
number
Y component.
number
Z component.
space (‘world’ | ‘local’), at, velocityChange, addToCurrent, overrideXY, overrideZ.
Returns
Section titled “Returns”boolean
setMaterial()
Section titled “setMaterial()”setMaterial(
slot,material):boolean
Defined in: server/api.d.ts:2291
Replaces the material of one slot on every client, over the create option material. Meshes only: a Blueprint draws itself. False when 16 slots are already replaced or the object is gone.
Parameters
Section titled “Parameters”number
Material slot 0-63 of the mesh.
material
Section titled “material”string | null
Material asset path (‘/Game/Dir/MI_X.MI_X’); null puts the mesh’s own back.
Returns
Section titled “Returns”boolean
setMaterialParam()
Section titled “setMaterialParam()”setMaterialParam(
slot,name,value):boolean
Defined in: server/api.d.ts:2304
Sets one parameter of the slot’s material on every client, through a dynamic instance of whatever material the slot shows. A name the material lacks is ignored. Throws TypeError on a malformed argument; false when 32 parameters are already set or the object is gone.
Parameters
Section titled “Parameters”number
Material slot 0-63, or -1 for every slot.
string
The parameter’s name in the material, e.g. ‘Hue Shift Percentage’.
string | number | WorldObjectColor | null
A number for a scalar parameter; ‘#rrggbb[aa]’ (sRGB) or { r, g, b, a? } (linear) for a vector one; a texture path for a texture one; null drops it.
Returns
Section titled “Returns”boolean
setScale()
Section titled “setScale()”setScale(
scale,y?,z?):boolean
Defined in: server/api.d.ts:2284
Rescales the object on every client, collision included. Each axis 0.001 to 1000 in size; a negative axis mirrors. Throws RangeError otherwise; false when the object is gone.
Parameters
Section titled “Parameters”number | Vector3
One number for every axis, { x, y, z } (a missing axis is 1), or x when y and z follow.
number
number
Returns
Section titled “Returns”boolean
setVelocity()
Section titled “setVelocity()”setVelocity(
x,y,z):boolean
Defined in: server/api.d.ts:2422
Sets a physics object’s linear velocity (cm/s) on whichever client simulates it.
Parameters
Section titled “Parameters”number
number
number
Returns
Section titled “Returns”boolean
setVirtualWorld()
Section titled “setVirtualWorld()”setVirtualWorld(
world,map?):void
Defined in: server/api.d.ts:2454
Moves this entity into another virtual world, within a map: there it meets the players in the same world of the same map, so world N of a dungeon is one instance of it.
Parameters
Section titled “Parameters”number
Virtual-world identifier used to partition replication and visibility.
string
The map it is in, as player.location().areaId names it; “Overland” or “” for the shared map. Left out, it stays in its current map.
Returns
Section titled “Returns”void
setVisibleTo()
Section titled “setVisibleTo()”setVisibleTo(
player):void
Defined in: shared.d.ts:82
Restricts replication to one player’s connection, within the usual range and visibility checks; null lifts it.
Parameters
Section titled “Parameters”player
Section titled “player”Entity | null
Returns
Section titled “Returns”void
toString()
Section titled “toString()”toString():
string
Defined in: shared.d.ts:74
Returns
Section titled “Returns”string
create()
Section titled “create()”
staticcreate(key,model,opts):WorldObject|undefined
Defined in: server/api.d.ts:2441
Creates or replaces an interest-streamed world object. Assigning position or rotation afterwards moves it on every client, interpolated. With motion, each client moves it from the spawn pose along motion.heading, so its server position stays at the spawn point; a client that streams it in mid-run places it where the others see it, and assigning position or rotation ends the run, leaving it at the assigned pose. With ttl, the server destroys it after that many seconds, and each client plays endFx where its copy is when the time runs out. Throws on a malformed path or an out-of-range number.
Parameters
Section titled “Parameters”string
Stable string key; creating again replaces the entity.
string | number
Static or skeletal mesh path (‘/Game/Dir/SM_X.SM_X’), Blueprint class path (‘/Game/Dir/BP_X.BP_X_C’) or catalog model id. Throws if none.
Placement, interaction, attached effect and sound, look (scale, animation, material, materials), motion and lifetime (ttl, startFx, endFx, shrinkOut).
Returns
Section titled “Returns”WorldObject | undefined
destroy()
Section titled “destroy()”
staticdestroy(key):boolean
Defined in: server/api.d.ts:2447
Destroys the world object stored under a stable key.
Parameters
Section titled “Parameters”string
Stable key passed to create.
Returns
Section titled “Returns”boolean
Properties
Section titled “Properties”angularDamping
Section titled “angularDamping”angularDamping:
number
Defined in: server/api.d.ts:2238
Angular damping; negative keeps the mesh’s own.
drawDistance
Section titled “drawDistance”drawDistance:
number
Defined in: server/api.d.ts:2248
Client cull distance in cm: players who have the object stop drawing it beyond this. 0 never culls; -1 is the default (a mesh never culls, a Blueprint keeps its own).
frozen
Section titled “frozen”frozen:
boolean
Defined in: server/api.d.ts:2223
Holds the body in place without turning physics off.
gravity
Section titled “gravity”gravity:
boolean
Defined in: server/api.d.ts:2218
Whether gravity applies while simulating.
readonlyid:number
Defined in: shared.d.ts:65
Network id, stable for the entity’s lifetime.
linearDamping
Section titled “linearDamping”linearDamping:
number
Defined in: server/api.d.ts:2233
Linear damping; negative keeps the mesh’s own.
mass:
number
Defined in: server/api.d.ts:2228
Mass override in kg; 0 keeps the mesh’s own.
modelId
Section titled “modelId”
readonlymodelId:number
Defined in: server/api.d.ts:2198
Catalog model id, or 0 when the mesh travels as a path.
modelPath
Section titled “modelPath”
readonlymodelPath:string
Defined in: server/api.d.ts:2203
Mesh asset path this object renders, whichever form it was created with.
ownerId
Section titled “ownerId”
readonlyownerId:number
Defined in: server/api.d.ts:2258
Network id of the player whose client simulates or holds this object (0 = server-held/dormant, or not simulated).
physics
Section titled “physics”physics:
boolean
Defined in: server/api.d.ts:2213
Whether a nearby client simulates this object as a rigid body.
position
Section titled “position”position:
Vector3
Defined in: shared.d.ts:67
World position. Read, call set(...), then assign back.
rotation
Section titled “rotation”rotation:
Vector3|Quaternion
Defined in: shared.d.ts:69
Reads as a quaternion; assignments also accept Euler angles in degrees.
readonlyscale:number
Defined in: server/api.d.ts:2208
Uniform actor scale; the X axis when the axes differ (see getScale).
simulatorId
Section titled “simulatorId”
readonlysimulatorId:number
Defined in: server/api.d.ts:2253
Network id of the player whose client simulates this object (0 = nobody).
readonlystate:StateBag
Defined in: shared.d.ts:71
This entity’s key/value state: the server writes it, and every client that can see the entity receives it. See StateBag.
streamRange
Section titled “streamRange”streamRange:
number
Defined in: server/api.d.ts:2243
Interest radius in cm: only players this close receive the object. Clamped to 100-200000; default 50000 (500 m).
virtualWorld
Section titled “virtualWorld”
readonlyvirtualWorld:number
Defined in: server/api.d.ts:2268
The virtual world scripts put this entity in. Outside the shared map (Overland) replication combines it with the entity’s map, as it does a player’s.
modelCount
Section titled “modelCount”
staticmodelCount:number
Defined in: server/api.d.ts:2263
Number of world-object-tagged models in the shared mesh registry.