Class: WorldSensingDirector
Defined in: packages/webxr-environment/src/world-sensing-director.ts:84
Constructors
Constructor
new WorldSensingDirector(port: WorldSensingPort, options?: WorldSensingDirectorOptions): WorldSensingDirector;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:99
Parameters
| Parameter | Type |
|---|---|
port | WorldSensingPort |
options | WorldSensingDirectorOptions |
Returns
WorldSensingDirector
Accessors
detection
Get Signature
get detection():
| ResolvedWorldDetection
| null;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:107
What is being detected, or null when nothing was asked for.
Returns
| ResolvedWorldDetection
| null
Methods
anchors()
anchors(): readonly WorldAnchor[];
Defined in: packages/webxr-environment/src/world-sensing-director.ts:152
Returns
readonly WorldAnchor[]
createAnchor()
createAnchor(pose: WorldPose): Promise<string | null>;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:213
Ask the runtime to remember a point in the room.
Resolves to the new anchor's id, or null when the host cannot - which is
a normal answer, not an error: anchors are refused when tracking is poor,
and an app that treats that as a crash is an app that crashes in a dark
room.
Parameters
| Parameter | Type |
|---|---|
pose | WorldPose |
Returns
Promise<string | null>
dispose()
dispose(): void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:268
Returns
void
getSensing()
getSensing(feature: "planes" | "meshes" | "anchors" | "hitTest"): SensingReport;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:244
The last thing the adapter said about a world feature.
Parameters
| Parameter | Type |
|---|---|
feature | "planes" | "meshes" | "anchors" | "hitTest" |
Returns
hits()
hits(sourceId?: string): readonly WorldHit[];
Defined in: packages/webxr-environment/src/world-sensing-director.ts:178
The latest answers for a standing request, or every answer with no id.
Parameters
| Parameter | Type |
|---|---|
sourceId? | string |
Returns
readonly WorldHit[]
meshes()
meshes(): readonly WorldMesh[];
Defined in: packages/webxr-environment/src/world-sensing-director.ts:148
Returns
readonly WorldMesh[]
meshesLabelled()
meshesLabelled(label: string): readonly WorldMesh[];
Defined in: packages/webxr-environment/src/world-sensing-director.ts:172
The same for meshes, and not a nicety: a wall arrives as a detected MESH
as often as a plane, so an app looking for one needs both. Having the
helper on one side only would also hide that the matching is
case-insensitive, and a hand-written === "Wall" returns an empty array
with nothing to explain it.
Parameters
| Parameter | Type |
|---|---|
label | string |
Returns
readonly WorldMesh[]
onChange()
onChange(listener: WorldChangeListener): () => void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:256
Subscribe to what appeared, moved and went away. Returns the unsubscribe.
Parameters
| Parameter | Type |
|---|---|
listener | WorldChangeListener |
Returns
() => void
onSensing()
onSensing(listener: SensingListener): () => void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:248
Parameters
| Parameter | Type |
|---|---|
listener | SensingListener |
Returns
() => void
planes()
planes(): readonly WorldPlane[];
Defined in: packages/webxr-environment/src/world-sensing-director.ts:144
Returns
readonly WorldPlane[]
planesLabelled()
planesLabelled(label: string): readonly WorldPlane[];
Defined in: packages/webxr-environment/src/world-sensing-director.ts:160
Planes carrying a label, matched without case. The host's vocabulary, not ours: an unknown label is a string to log, not an error.
Parameters
| Parameter | Type |
|---|---|
label | string |
Returns
readonly WorldPlane[]
removeAnchor()
removeAnchor(id: string): void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:238
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void
setDetection()
setDetection(detection:
| boolean
| WorldDetectionSpec
| null): void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:118
Ask for detection. true turns everything on, false or null stops.
Turning a feature off drops what was found through it, and the change event says so - an app that spawned content on those planes gets told to clean it up rather than being left holding ids nothing will ever update.
Parameters
| Parameter | Type |
|---|---|
detection | | boolean | WorldDetectionSpec | null |
Returns
void
startHitTest()
startHitTest(request: HitTestRequest): void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:187
Start a standing hit test. Repeating an id replaces the request, which is what an app aiming from a moving hand wants: one source, not one per frame.
Parameters
| Parameter | Type |
|---|---|
request | HitTestRequest |
Returns
void
stopHitTest()
stopHitTest(id: string): void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:198
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
void
update()
update(deltaMs: number): void;
Defined in: packages/webxr-environment/src/world-sensing-director.ts:263
Parameters
| Parameter | Type |
|---|---|
deltaMs | number |
Returns
void