Prop

A model from the game's catalogue, or one your resource ships, placed by the server for all players or those named by showOnlyTo. Changing its physics, scale or mass rebuilds it in all games, while position, rotation and setPose move it as it is. One game simulates a rigid prop's body, the nearest player's however far, and others see the pose it reports.

prop.spawn()

Prop.spawn(model, position, orientation, scale, physics, dimension)

Spawns a prop, from the game's prop catalogue or one a resource streams, by its full path, objects/kcds/<resource>/<name>.cgf; see Assets. Throws a RangeError for a model that neither has.

prop.all()

Prop.all()

All props.

prop.getById()

Prop.getById(id)

The prop with this network id, or null.

prop.collisionOf()

Prop.collisionOf(model)

How a catalogue mesh collides, read from the game's meshes. 'mesh' collides as drawn. 'proxy' collides only with simplified shapes, a box, cylinder, capsule or rough mesh around it, so a body can fall through what is drawn, as with the witch's stake, which has no solid top. 'none' has no collision, as with carpets, furs and hangers. Null for a mesh not in the catalogue, such as one you ship.

prop.destroyAll()

Prop.destroyAll(dimension)

Removes all props, or those in one dimension, and returns how many.

prop.meshName

meshName

The model's file name.

prop.meshGroup

meshGroup

The catalogue group of the model.

prop.position

position

Its location. Assigning moves it at once on all screens showing it, with no rebuild.

prop.rotation

rotation

Its rotation. Assigning Euler degrees or a Quaternion turns it at once.

prop.setPose()

setPose(position, orientation)

Moves and turns it together, at once on all screens showing it. Nothing is sent if it stays in place.

prop.visibleTo

visibleTo

The players who see it, or null if everyone does.

prop.showOnlyTo()

showOnlyTo(players)

Shows the prop only to these players. Others remove it and never build it, including later joiners. null shows it to everyone again.

prop.physics

physics

'static' collides and never moves, 'rigid' falls and can be pushed, and 'none' has no collision. Assigning rebuilds the prop. The nearest player's game, however far, simulates a rigid prop. With nobody whose game shows it, it stays where it last rested.

prop.attachedTo

attachedTo

The player it is attached to through Player.attachProp, or null in the world. An attached prop has no physics, so setting `physics` throws a TypeError, and its `position` and `rotation` are an offset from the joint, up to 5 m.

prop.joint

joint

The joint an attached prop hangs on, or '' for the body itself or a prop in the world.

prop.visible

visible

Whether players see the model, true by default. Assign false to keep a static prop's collision with nothing drawn, for an invisible support, barrier or floor. Only a static prop can be hidden, otherwise it throws a TypeError, and a hidden prop stays static until shown.

prop.mass

mass

A rigid prop's mass in kilograms, applied when its body is created. With 0, the default, the mesh's collision data decides. It accepts 0 to 100,000, and ignores others. Most decorative meshes have no mass in that data, so set one, otherwise clients log a message and keep the prop static. Changing it recreates the prop on all clients, so do so before applying force.

prop.applyImpulse()

applyImpulse(impulse, point, angularImpulse)

Applies a force to a rigid prop, starting its simulation on the responsible client, and others receive the movement. propRest fires when it stops. Returns false for a removed or non-rigid prop, a bad value, or when no client is available to simulate.

prop.setVelocity()

setVelocity(velocity, angularVelocity)

Replaces a rigid prop's velocity, ignoring mass, and starts its simulation. propRest fires when it stops. Returns false as for applyImpulse.

prop.wake()

wake()

Restarts physics on a resting rigid prop where it is, so an unsupported one drops. propRest fires when it stops. Returns false as for applyImpulse.

prop.sleep()

sleep()

Freezes a rigid prop where it is, even in the air, until a collision or script moves it. propRest gives the final position. To fix it permanently, set physics to 'static' after propRest. Returns false as for applyImpulse.

prop.resetPhysics()

resetPhysics()

Stops the prop's physics and returns it to its spawn position for all players, with no propRest. Returns false if it is gone or not rigid.

prop.scale

scale

A number while all sizes match, otherwise a Vector3. Assigning rebuilds the prop.

prop.destroy()

destroy()

Removes the prop, firing propDestroy.

prop.id

id: number

The network id.

prop.model

model: string

The model it was spawned with.

prop.dimension

dimension: number

Its dimension.