UNPKG

@threlte/xr

Version:

Tools to more easily create VR and AR experiences with Threlte

20 lines (19 loc) 852 B
import { Quaternion, Vector3, type Vector3Tuple } from 'three'; /** * Returns a callback that teleports the player to a target position and optional orientation. * * When used inside `<XROrigin>`, the origin group is translated directly — the * user's feet end up at the target, and their room-scale offset from the origin is preserved. * * When used outside `<XROrigin>`, the underlying `XRReferenceSpace` is mutated to compensate * for the viewer's current position so the feet end up at the target regardless of where the * user has walked in their physical space. * * @example * const teleport = useTeleport() * teleport([5, 0, 5]) * * const quat = new THREE.Quaternion() * teleport(new THREE.Vector3(5, 0, 5), quat) */ export declare const useTeleport: () => (position: Vector3 | Vector3Tuple, orientation?: Quaternion) => void;