Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit65083fe8f2

README.md

scene.player

The scene's player setup, in one tool.

What it does depends on the arguments:

  • none — report the intent, the prototypes (body and camera wiring) and the spawns.
  • the intent "none" — a playerless scene; removes every PlayerPrototype and PlayerSpawn.
  • the intent "spawns" — a player per joining user; authors the default setup if missing.
  • the intent "spawns" with a roles table — reshapes the player: swap the avatar with body, make it first-person with behavior, or wire an existing camera entity with camera.

The intent is typed: "spawns" or "none". "spawns" on a scene with no PlayerPrototype authors the canonical setup — humanoid body, third-person camera (OwnerOnly), a spawn at the origin — the same shape a fresh scene ships and the player template produces. "none" strips the player machinery entirely.

The roles table (second argument) reshapes the player and implies "spawns":

  • body — an entity name/id to adopt, or an avatar asset ref (@builtin::avatars.minimal_player) that repoints the body's avatar. A joining user's own avatar replaces this body socket, so reuse the canonical setup rather than hand-rolling one.
  • camera — an entity carrying a Camera component; moved under the prototype and scoped OwnerOnly so each joining user gets their own view.
  • behavior — any cameraBehavior component (built-in or authored) set on the player camera's Camera.behavior.
  • prototype — picks one when the scene has several.

Setting anything saves the scene.

The report names the root scene layer's intent and scene path, and lists every PlayerPrototype and PlayerSpawn the loaded layers hold. In play the scene holds each authored prototype as the captured template a joining player is cloned from; the report lists it through the spawn that names it, with template = true. With no scene loaded as the root layer the report carries unloaded in place of intent and scene, saying so and how to load one, and the setters refuse until a scene is loaded.

The behavior is attached to the player camera's entity as a component of its own type, so it is tuned there: component.get("<its type>") on the camera entity and set its fields. A component.add of that type writes its values onto the attached instance instead of adding a second one.