WebXRControllerTeleportation.ts 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576
  1. import { IWebXRFeature, WebXRFeaturesManager } from '../webXRFeaturesManager';
  2. import { Observer } from '../../../Misc/observable';
  3. import { WebXRSessionManager } from '../webXRSessionManager';
  4. import { Nullable } from '../../../types';
  5. import { WebXRInput } from '../webXRInput';
  6. import { WebXRController } from '../webXRController';
  7. import { WebXRControllerComponent, IWebXRMotionControllerAxesValue } from '../motionController/webXRControllerComponent';
  8. import { AbstractMesh } from '../../../Meshes/abstractMesh';
  9. import { Vector3, Quaternion } from '../../../Maths/math.vector';
  10. import { Ray } from '../../../Culling/ray';
  11. import { Material } from '../../../Materials/material';
  12. import { DynamicTexture } from '../../../Materials/Textures/dynamicTexture';
  13. import { CylinderBuilder } from '../../../Meshes/Builders/cylinderBuilder';
  14. import { SineEase, EasingFunction } from '../../../Animations/easing';
  15. import { Animation } from '../../../Animations/animation';
  16. import { Axis } from '../../../Maths/math.axis';
  17. import { StandardMaterial } from '../../../Materials/standardMaterial';
  18. import { GroundBuilder } from '../../../Meshes/Builders/groundBuilder';
  19. import { TorusBuilder } from '../../../Meshes/Builders/torusBuilder';
  20. import { PickingInfo } from '../../../Collisions/pickingInfo';
  21. import { Curve3 } from '../../../Maths/math.path';
  22. import { LinesBuilder } from '../../../Meshes/Builders/linesBuilder';
  23. import { WebXRAbstractFeature } from './WebXRAbstractFeature';
  24. const Name = "xr-controller-teleportation";
  25. /**
  26. * The options container for the teleportation module
  27. */
  28. export interface IWebXRTeleportationOptions {
  29. /**
  30. * Babylon XR Input class for controller
  31. */
  32. xrInput: WebXRInput;
  33. /**
  34. * A list of meshes to use as floor meshes.
  35. * Meshes can be added and removed after initializing the feature using the
  36. * addFloorMesh and removeFloorMesh functions
  37. * If empty, rotation will still work
  38. */
  39. floorMeshes?: AbstractMesh[];
  40. /**
  41. * Provide your own teleportation mesh instead of babylon's wonderful doughnut.
  42. * If you want to support rotation, make sure your mesh has a direction indicator.
  43. *
  44. * When left untouched, the default mesh will be initialized.
  45. */
  46. teleportationTargetMesh?: AbstractMesh;
  47. /**
  48. * Values to configure the default target mesh
  49. */
  50. defaultTargetMeshOptions?: {
  51. /**
  52. * Fill color of the teleportation area
  53. */
  54. teleportationFillColor?: string;
  55. /**
  56. * Border color for the teleportation area
  57. */
  58. teleportationBorderColor?: string;
  59. /**
  60. * Override the default material of the torus and arrow
  61. */
  62. torusArrowMaterial?: Material;
  63. /**
  64. * Disable the mesh's animation sequence
  65. */
  66. disableAnimation?: boolean;
  67. };
  68. /**
  69. * Disable using the thumbstick and use the main component (usuallly trigger) on long press.
  70. * This will be automatically true if the controller doesnt have a thumbstick or touchpad.
  71. */
  72. useMainComponentOnly?: boolean;
  73. /**
  74. * If main component is used (no thumbstick), how long should the "long press" take before teleporting
  75. */
  76. timeToTeleport?: number;
  77. }
  78. /**
  79. * This is a teleportation feature to be used with webxr-enabled motion controllers.
  80. * When enabled and attached, the feature will allow a user to move aroundand rotate in the scene using
  81. * the input of the attached controllers.
  82. */
  83. export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature implements IWebXRFeature {
  84. /**
  85. * The module's name
  86. */
  87. public static readonly Name = Name;
  88. /**
  89. * The (Babylon) version of this module.
  90. * This is an integer representing the implementation version.
  91. * This number does not correspond to the webxr specs version
  92. */
  93. public static readonly Version = 1;
  94. /**
  95. * Is rotation enabled when moving forward?
  96. * Disabling this feature will prevent the user from deciding the direction when teleporting
  97. */
  98. public rotationEnabled: boolean = true;
  99. /**
  100. * Should the module support parabolic ray on top of direct ray
  101. * If enabled, the user will be able to point "at the sky" and move according to predefined radius distance
  102. * Very helpful when moving between floors / different heights
  103. */
  104. public parabolicRayEnabled: boolean = true;
  105. /**
  106. * The distance from the user to the inspection point in the direction of the controller
  107. * A higher number will allow the user to move further
  108. * defaults to 5 (meters, in xr units)
  109. */
  110. public parabolicCheckRadius: number = 5;
  111. /**
  112. * How much rotation should be applied when rotating right and left
  113. */
  114. public rotationAngle: number = Math.PI / 8;
  115. /**
  116. * Distance to travel when moving backwards
  117. */
  118. public backwardsTeleportationDistance: number = 0.5;
  119. /**
  120. * Add a new mesh to the floor meshes array
  121. * @param mesh the mesh to use as floor mesh
  122. */
  123. public addFloorMesh(mesh: AbstractMesh) {
  124. this._floorMeshes.push(mesh);
  125. }
  126. /**
  127. * Remove a mesh from the floor meshes array
  128. * @param mesh the mesh to remove
  129. */
  130. public removeFloorMesh(mesh: AbstractMesh) {
  131. const index = this._floorMeshes.indexOf(mesh);
  132. if (index !== -1) {
  133. this._floorMeshes.splice(index, 1);
  134. }
  135. }
  136. /**
  137. * Remove a mesh from the floor meshes array using its name
  138. * @param name the mesh name to remove
  139. */
  140. public removeFloorMeshByName(name: string) {
  141. const mesh = this._xrSessionManager.scene.getMeshByName(name);
  142. if (mesh) {
  143. this.removeFloorMesh(mesh);
  144. }
  145. }
  146. private _tmpRay = new Ray(new Vector3(), new Vector3());
  147. private _tmpVector = new Vector3();
  148. private _floorMeshes: AbstractMesh[];
  149. private _controllers: {
  150. [controllerUniqueId: string]: {
  151. xrController: WebXRController;
  152. teleportationComponent?: WebXRControllerComponent;
  153. teleportationState: {
  154. forward: boolean;
  155. backwards: boolean;
  156. currentRotation: number;
  157. baseRotation: number;
  158. rotating: boolean;
  159. }
  160. onAxisChangedObserver?: Nullable<Observer<IWebXRMotionControllerAxesValue>>;
  161. onButtonChangedObserver?: Nullable<Observer<WebXRControllerComponent>>;
  162. };
  163. } = {};
  164. /**
  165. * constructs a new anchor system
  166. * @param _xrSessionManager an instance of WebXRSessionManager
  167. * @param _options configuration object for this feature
  168. */
  169. constructor(_xrSessionManager: WebXRSessionManager, private _options: IWebXRTeleportationOptions) {
  170. super(_xrSessionManager);
  171. // create default mesh if not provided
  172. if (!this._options.teleportationTargetMesh) {
  173. this.createDefaultTargetMesh();
  174. }
  175. this._floorMeshes = this._options.floorMeshes || [];
  176. this.setTargetMeshVisibility(false);
  177. }
  178. private _selectionFeature: IWebXRFeature;
  179. /**
  180. * This function sets a selection feature that will be disabled when
  181. * the forward ray is shown and will be reattached when hidden.
  182. * This is used to remove the selection rays when moving.
  183. * @param selectionFeature the feature to disable when forward movement is enabled
  184. */
  185. public setSelectionFeature(selectionFeature: IWebXRFeature) {
  186. this._selectionFeature = selectionFeature;
  187. }
  188. public attach(): boolean {
  189. super.attach();
  190. this._options.xrInput.controllers.forEach(this._attachController);
  191. this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable, this._attachController);
  192. this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable, (controller) => {
  193. // REMOVE the controller
  194. this._detachController(controller.uniqueId);
  195. });
  196. return true;
  197. }
  198. public detach(): boolean {
  199. super.detach();
  200. Object.keys(this._controllers).forEach((controllerId) => {
  201. this._detachController(controllerId);
  202. });
  203. this.setTargetMeshVisibility(false);
  204. return true;
  205. }
  206. public dispose(): void {
  207. super.dispose();
  208. this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.dispose(false, true);
  209. }
  210. protected _onXRFrame(_xrFrame: XRFrame) {
  211. const frame = this._xrSessionManager.currentFrame;
  212. const scene = this._xrSessionManager.scene;
  213. if (!this.attach || !frame) { return; }
  214. // render target if needed
  215. const targetMesh = this._options.teleportationTargetMesh;
  216. if (this._currentTeleportationControllerId) {
  217. if (!targetMesh) {
  218. return;
  219. }
  220. targetMesh.rotationQuaternion = targetMesh.rotationQuaternion || new Quaternion();
  221. const controllerData = this._controllers[this._currentTeleportationControllerId];
  222. if (controllerData.teleportationState.forward) {
  223. // set the rotation
  224. Quaternion.RotationYawPitchRollToRef(controllerData.teleportationState.currentRotation + controllerData.teleportationState.baseRotation, 0, 0, targetMesh.rotationQuaternion);
  225. // set the ray and position
  226. let hitPossible = false;
  227. // first check if direct ray possible
  228. controllerData.xrController.getWorldPointerRayToRef(this._tmpRay);
  229. let pick = scene.pickWithRay(this._tmpRay, (o) => {
  230. return this._floorMeshes.indexOf(o) !== -1;
  231. });
  232. if (pick && pick.pickedPoint) {
  233. hitPossible = true;
  234. this.setTargetMeshPosition(pick.pickedPoint);
  235. this.setTargetMeshVisibility(true);
  236. this.showParabolicPath(pick);
  237. } else {
  238. if (this.parabolicRayEnabled) {
  239. // check parabolic ray
  240. const radius = this.parabolicCheckRadius;
  241. this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(radius * 2), this._tmpVector);
  242. this._tmpVector.y = this._tmpRay.origin.y;
  243. this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(radius));
  244. this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction);
  245. this._tmpRay.direction.normalize();
  246. let pick = scene.pickWithRay(this._tmpRay, (o) => {
  247. return this._floorMeshes.indexOf(o) !== -1;
  248. });
  249. if (pick && pick.pickedPoint) {
  250. hitPossible = true;
  251. this.setTargetMeshPosition(pick.pickedPoint);
  252. this.setTargetMeshVisibility(true);
  253. this.showParabolicPath(pick);
  254. }
  255. }
  256. }
  257. // if needed, set visible:
  258. this.setTargetMeshVisibility(hitPossible);
  259. } else {
  260. this.setTargetMeshVisibility(false);
  261. }
  262. } else {
  263. this.setTargetMeshVisibility(false);
  264. }
  265. }
  266. private _currentTeleportationControllerId: string;
  267. private _attachController = (xrController: WebXRController) => {
  268. if (this._controllers[xrController.uniqueId]) {
  269. // already attached
  270. return;
  271. }
  272. this._controllers[xrController.uniqueId] = {
  273. xrController,
  274. teleportationState: {
  275. forward: false,
  276. backwards: false,
  277. rotating: false,
  278. currentRotation: 0,
  279. baseRotation: 0
  280. }
  281. };
  282. const controllerData = this._controllers[xrController.uniqueId];
  283. // motion controller support
  284. if (xrController.gamepadController) {
  285. const movementController = xrController.gamepadController.getComponent(WebXRControllerComponent.THUMBSTICK) || xrController.gamepadController.getComponent(WebXRControllerComponent.TOUCHPAD);
  286. if (!movementController || this._options.useMainComponentOnly) {
  287. // use trigger to move on long press
  288. const mainComponent = xrController.gamepadController.getMainComponent();
  289. if (!mainComponent) {
  290. return;
  291. }
  292. controllerData.onButtonChangedObserver = mainComponent.onButtonStateChanged.add(() => {
  293. // did "pressed" changed?
  294. if (mainComponent.changes.pressed) {
  295. if (mainComponent.changes.pressed.current) {
  296. // simulate "forward" thumbstick push
  297. controllerData.teleportationState.forward = true;
  298. this._currentTeleportationControllerId = controllerData.xrController.uniqueId;
  299. controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;
  300. controllerData.teleportationState.currentRotation = 0;
  301. const timeToSelect = this._options.timeToTeleport || 3000;
  302. let timer = 0;
  303. const observer = this._xrSessionManager.onXRFrameObservable.add(() => {
  304. if (!mainComponent.pressed) {
  305. this._xrSessionManager.onXRFrameObservable.remove(observer);
  306. return;
  307. }
  308. timer += this._xrSessionManager.scene.getEngine().getDeltaTime();
  309. if (timer >= timeToSelect && this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {
  310. this._teleportForward(xrController.uniqueId);
  311. }
  312. // failsafe
  313. if (timer >= timeToSelect) {
  314. this._xrSessionManager.onXRFrameObservable.remove(observer);
  315. }
  316. });
  317. } else {
  318. controllerData.teleportationState.forward = false;
  319. this._currentTeleportationControllerId = "";
  320. }
  321. }
  322. });
  323. } else {
  324. controllerData.onButtonChangedObserver = movementController.onButtonStateChanged.add(() => {
  325. if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward && !movementController.touched) {
  326. this._teleportForward(xrController.uniqueId);
  327. }
  328. });
  329. // use thumbstick (or touchpad if thumbstick not available)
  330. controllerData.onAxisChangedObserver = movementController.onAxisValueChanged.add((axesData) => {
  331. if (axesData.y <= 0.7 && controllerData.teleportationState.backwards) {
  332. //if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId) {
  333. controllerData.teleportationState.backwards = false;
  334. //this._currentTeleportationControllerId = "";
  335. //}
  336. }
  337. if (axesData.y > 0.7 && !controllerData.teleportationState.forward) {
  338. // teleport backwards
  339. if (!controllerData.teleportationState.backwards) {
  340. controllerData.teleportationState.backwards = true;
  341. // teleport backwards ONCE
  342. this._tmpVector.set(0, 0, -this.backwardsTeleportationDistance!);
  343. this._tmpVector.addInPlace(this._options.xrInput.xrCamera.position);
  344. this._tmpRay.origin.copyFrom(this._tmpVector);
  345. this._tmpRay.direction.set(0, -1, 0);
  346. let pick = this._xrSessionManager.scene.pickWithRay(this._tmpRay, (o) => {
  347. return this._floorMeshes.indexOf(o) !== -1;
  348. });
  349. // pick must exist, but stay safe
  350. if (pick && pick.pickedPoint) {
  351. // Teleport the users feet to where they targeted
  352. this._options.xrInput.xrCamera.position.addInPlace(pick.pickedPoint);
  353. }
  354. }
  355. }
  356. if (axesData.y < -0.7 && !this._currentTeleportationControllerId && !controllerData.teleportationState.rotating) {
  357. controllerData.teleportationState.forward = true;
  358. this._currentTeleportationControllerId = controllerData.xrController.uniqueId;
  359. controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;
  360. }
  361. if (axesData.x) {
  362. if (!controllerData.teleportationState.forward) {
  363. if (!controllerData.teleportationState.rotating && Math.abs(axesData.x) > 0.7) {
  364. // rotate in the right direction positive is right
  365. controllerData.teleportationState.rotating = true;
  366. const rotation = this.rotationAngle * (axesData.x > 0 ? 1 : -1);
  367. this._options.xrInput.xrCamera.rotationQuaternion.multiplyInPlace(Quaternion.FromEulerAngles(0, rotation, 0));
  368. }
  369. } else {
  370. if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId) {
  371. // set the rotation of the forward movement
  372. if (this.rotationEnabled) {
  373. setTimeout(() => {
  374. controllerData.teleportationState.currentRotation = Math.atan2(axesData.x, -axesData.y);
  375. });
  376. } else {
  377. controllerData.teleportationState.currentRotation = 0;
  378. }
  379. }
  380. }
  381. } else {
  382. controllerData.teleportationState.rotating = false;
  383. }
  384. });
  385. }
  386. }
  387. }
  388. private _teleportForward(controllerId: string) {
  389. const controllerData = this._controllers[controllerId];
  390. controllerData.teleportationState.forward = false;
  391. this._currentTeleportationControllerId = "";
  392. // do the movement forward here
  393. if (this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible) {
  394. const height = this._options.xrInput.xrCamera.position.y - this._options.teleportationTargetMesh.position.y;
  395. this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position);
  396. this._options.xrInput.xrCamera.position.y += height;
  397. this._options.xrInput.xrCamera.rotationQuaternion.multiplyInPlace(Quaternion.FromEulerAngles(0, controllerData.teleportationState.currentRotation, 0));
  398. }
  399. }
  400. private _detachController(xrControllerUniqueId: string) {
  401. const controllerData = this._controllers[xrControllerUniqueId];
  402. if (!controllerData) { return; }
  403. if (controllerData.teleportationComponent) {
  404. if (controllerData.onAxisChangedObserver) {
  405. controllerData.teleportationComponent.onAxisValueChanged.remove(controllerData.onAxisChangedObserver);
  406. }
  407. if (controllerData.onButtonChangedObserver) {
  408. controllerData.teleportationComponent.onButtonStateChanged.remove(controllerData.onButtonChangedObserver);
  409. }
  410. }
  411. // remove from the map
  412. delete this._controllers[xrControllerUniqueId];
  413. }
  414. private createDefaultTargetMesh() {
  415. // set defaults
  416. this._options.defaultTargetMeshOptions = this._options.defaultTargetMeshOptions || {};
  417. const scene = this._xrSessionManager.scene;
  418. let teleportationTarget = GroundBuilder.CreateGround("teleportationTarget", { width: 2, height: 2, subdivisions: 2 }, scene);
  419. teleportationTarget.isPickable = false;
  420. let length = 512;
  421. let dynamicTexture = new DynamicTexture("DynamicTexture", length, scene, true);
  422. dynamicTexture.hasAlpha = true;
  423. let context = dynamicTexture.getContext();
  424. let centerX = length / 2;
  425. let centerY = length / 2;
  426. let radius = 200;
  427. context.beginPath();
  428. context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);
  429. context.fillStyle = this._options.defaultTargetMeshOptions.teleportationFillColor || "#444444";
  430. context.fill();
  431. context.lineWidth = 10;
  432. context.strokeStyle = this._options.defaultTargetMeshOptions.teleportationBorderColor || "#FFFFFF";
  433. context.stroke();
  434. context.closePath();
  435. dynamicTexture.update();
  436. let teleportationCircleMaterial = new StandardMaterial("TextPlaneMaterial", scene);
  437. teleportationCircleMaterial.diffuseTexture = dynamicTexture;
  438. teleportationTarget.material = teleportationCircleMaterial;
  439. let torus = TorusBuilder.CreateTorus("torusTeleportation", {
  440. diameter: 0.75,
  441. thickness: 0.1,
  442. tessellation: 20
  443. }, scene);
  444. torus.isPickable = false;
  445. torus.parent = teleportationTarget;
  446. if (!this._options.defaultTargetMeshOptions.disableAnimation) {
  447. let animationInnerCircle = new Animation("animationInnerCircle", "position.y", 30, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);
  448. let keys = [];
  449. keys.push({
  450. frame: 0,
  451. value: 0
  452. });
  453. keys.push({
  454. frame: 30,
  455. value: 0.4
  456. });
  457. keys.push({
  458. frame: 60,
  459. value: 0
  460. });
  461. animationInnerCircle.setKeys(keys);
  462. let easingFunction = new SineEase();
  463. easingFunction.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);
  464. animationInnerCircle.setEasingFunction(easingFunction);
  465. torus.animations = [];
  466. torus.animations.push(animationInnerCircle);
  467. scene.beginAnimation(torus, 0, 60, true);
  468. }
  469. var cone = CylinderBuilder.CreateCylinder("cone", { diameterTop: 0, tessellation: 4 }, scene);
  470. cone.isPickable = false;
  471. cone.scaling.set(0.5, 0.12, 0.2);
  472. cone.rotate(Axis.X, Math.PI / 2);
  473. cone.position.z = 0.6;
  474. cone.parent = torus;
  475. if (this._options.defaultTargetMeshOptions.torusArrowMaterial) {
  476. torus.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;
  477. cone.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;
  478. }
  479. this._options.teleportationTargetMesh = teleportationTarget;
  480. }
  481. private setTargetMeshVisibility(visible: boolean) {
  482. if (!this._options.teleportationTargetMesh) { return; }
  483. if (this._options.teleportationTargetMesh.isVisible === visible) { return; }
  484. this._options.teleportationTargetMesh.isVisible = visible;
  485. this._options.teleportationTargetMesh.getChildren(undefined, false).forEach((m) => { (<any>(m)).isVisible = visible; });
  486. if (!visible) {
  487. if (this._quadraticBezierCurve) {
  488. this._quadraticBezierCurve.dispose();
  489. }
  490. if (this._selectionFeature) {
  491. this._selectionFeature.attach();
  492. }
  493. } else {
  494. if (this._selectionFeature) {
  495. this._selectionFeature.detach();
  496. }
  497. }
  498. }
  499. private setTargetMeshPosition(newPosition: Vector3) {
  500. if (!this._options.teleportationTargetMesh) { return; }
  501. this._options.teleportationTargetMesh.position.copyFrom(newPosition);
  502. this._options.teleportationTargetMesh.position.y += 0.01;
  503. }
  504. private _quadraticBezierCurve: AbstractMesh;
  505. private showParabolicPath(pickInfo: PickingInfo) {
  506. if (!pickInfo.pickedPoint) { return; }
  507. const controllerData = this._controllers[this._currentTeleportationControllerId];
  508. const quadraticBezierVectors = Curve3.CreateQuadraticBezier(
  509. controllerData.xrController.pointer.absolutePosition,
  510. pickInfo.ray!.origin,
  511. pickInfo.pickedPoint,
  512. 25);
  513. if (this._quadraticBezierCurve) {
  514. this._quadraticBezierCurve.dispose();
  515. }
  516. this._quadraticBezierCurve = LinesBuilder.CreateLines("path line", { points: quadraticBezierVectors.getPoints() });
  517. this._quadraticBezierCurve.isPickable = false;
  518. }
  519. }
  520. WebXRFeaturesManager.AddWebXRFeature(WebXRMotionControllerTeleportation.Name, (xrSessionManager, options) => {
  521. return () => new WebXRMotionControllerTeleportation(xrSessionManager, options);
  522. }, WebXRMotionControllerTeleportation.Version, true);