@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / XREnvironmentComponent
Class: XREnvironmentComponent ​
Defined in: components/XREnvironment.ts:26
Marks an entity as a piece of the user's REAL room, detected at runtime.
These entities are spawned by XREnvironmentSystem from WebXR plane and mesh detection — they are never authored, never saved, and vanish with the session. They exist as ordinary entities (rather than colliders hidden inside a system) so the normal physics pipeline builds their colliders, and so scripts can find them with a plain world.query(XREnvironmentComponent).
semanticLabel is what makes them useful to a game rather than just solid: it is how a script says "spawn the target on a WALL" or "only drop coins on the FLOOR". It is whatever the runtime reported — commonly floor, wall, ceiling, table, desk, couch, door, window — and is null on runtimes that classify nothing, so always handle the null case.
Extends ​
Constructors ​
Constructor ​
new XREnvironmentComponent(
kind,
semanticLabel?,
orientation?): XREnvironmentComponent;Defined in: components/XREnvironment.ts:34
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
kind | XrEnvironmentKind | undefined |
semanticLabel | string | null | null |
orientation | | XrEnvironmentOrientation | null | null |
Returns ​
XREnvironmentComponent
Overrides ​
Properties ​
| Property | Type | Description | Defined in |
|---|---|---|---|
kind | XrEnvironmentKind | Whether this came from plane detection or the room mesh. | components/XREnvironment.ts:28 |
semanticLabel | string | null | The runtime's classification, or null when it did not provide one. | components/XREnvironment.ts:30 |
orientation | | XrEnvironmentOrientation | null | Plane orientation, or null for mesh geometry and unclassified planes. | components/XREnvironment.ts:32 |

