UNPKG

@needle-tools/engine

Version:

Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.

48 lines (47 loc) 1.86 kB
/// <reference types="webxr" /> import type { NeedleXREventArgs } from "../../../engine/engine_xr.js"; import { Behaviour } from "../../Component.js"; /** * Add this script to an object and set `side` to make the object follow a specific controller. * @category XR * @group Components * */ export declare class XRControllerFollow extends Behaviour { get activeAndEnabled(): boolean; /** Should this object follow a right hand/controller or left hand/controller. * When a number is provided, the controller with that index is followed. * @default "none" **/ side: XRHandedness | number; /** should it follow controllers (the physics controller) * @default true */ controller: boolean; /** should it follow hands (when using hand tracking in WebXR) * @default false */ hands: boolean; /** Disable if you don't want this script to modify the object's visibility * If enabled the object will be hidden when the configured controller or hand is not available * If disabled this script will not modify the object's visibility * @default true */ controlVisibility: boolean; /** when true it will use the grip space, otherwise the ray space * @default false */ useGripSpace: boolean; /** when enabled the position, rotation and scale of this object will be set to the position it was at when it entered the XR session * @default true */ resetTransformAfterXRSession: boolean; private readonly _startPosition; private readonly _startRotation; private readonly _startScale; /** @internal */ onEnterXR(_args: NeedleXREventArgs): void; /** @internal */ onUpdateXR(args: NeedleXREventArgs): void; /** @internal */ onLeaveXR(_args: NeedleXREventArgs): void; }