Skip to main content

Class: XRReferenceSpaceCache

Defined in: src/core/components/XRReferenceSpaceCache.ts:20

Manages and caches WebXR reference spaces for the active XR session.

Constructors​

Constructor​

new XRReferenceSpaceCache(): XRReferenceSpaceCache

Returns​

XRReferenceSpaceCache

Methods​

convertPose()​

convertPose(pose, from, to, frame): XRRigidTransform | null

Defined in: src/core/components/XRReferenceSpaceCache.ts:78

Converts a pose from a source reference space to a target reference space using the active XRFrame.

Parameters​

pose​

XRRigidTransform

The pose in the source reference space.

from​

The source reference space type or XRSpace instance.

XRReferenceSpaceType | XRSpace

to​

The target reference space type or XRSpace instance.

XRReferenceSpaceType | XRSpace

frame​

XRFrame

The active XR frame.

Returns​

XRRigidTransform | null

The converted pose in the target reference space, or null if reference spaces or relative pose cannot be resolved.


getCached()​

getCached(type): XRReferenceSpace | undefined

Defined in: src/core/components/XRReferenceSpaceCache.ts:66

Synchronously returns a reference space if it has already been cached.

Parameters​

type​

XRReferenceSpaceType

The reference space type to check.

Returns​

XRReferenceSpace | undefined


onXRSessionStart()​

onXRSessionStart(session): void

Defined in: src/core/components/XRReferenceSpaceCache.ts:28

Called when an XR session starts to reset the cache and request all reference spaces.

Parameters​

session​

XRSession

The newly started WebXR session.

Returns​

void