Skip to content

Scene

Some settings live on the scene rather than on a single object the skybox, fog, gravity, and the post-processing stack. They are stored on a singleton entity so you can read and mutate them from any Behaviour.

PageWhat it covers
EnvironmentSkybox (gradient / color / image), fog (linear / exponential), and physics gravity.
PostprocessingBloom, vignette, depth-of-field, tone mapping, and other full-screen effects.

Pattern

Both components expose a convenience method on world — no manual entity lookup needed:

ts
import { Behaviour } from "@relu-interactives/spatial-ecs";

export default class TweakScene extends Behaviour {
  init() {
    const env = this.world.getEnvironmentComponent();
    if (!env) return;

    // Mutate `env.values` — sync systems pick the change up next frame.
    env.values.fog.type = "linear";
    env.values.fog.color = "#88aaff";
    env.values.fog.linear.near = 5;
    env.values.fog.linear.far = 60;
  }
}

The same pattern works for Postprocessing via this.world.getPostprocessingComponent() — see each page for the full set of authorable values.