@babylonjs/core 5.22.1 → 5.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Actions/abstractActionManager.d.ts +6 -6
- package/Actions/abstractActionManager.js +1 -1
- package/Actions/abstractActionManager.js.map +1 -1
- package/Actions/actionManager.d.ts +5 -5
- package/Actions/actionManager.js +5 -5
- package/Actions/actionManager.js.map +1 -1
- package/Animations/animatable.js +2 -1
- package/Animations/animatable.js.map +1 -1
- package/Animations/animation.js +137 -139
- package/Animations/animation.js.map +1 -1
- package/Animations/animationGroup.d.ts +3 -3
- package/Animations/animationGroup.js +3 -3
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/runtimeAnimation.js +6 -7
- package/Animations/runtimeAnimation.js.map +1 -1
- package/Audio/audioSceneComponent.d.ts +1 -1
- package/Audio/audioSceneComponent.js.map +1 -1
- package/Audio/sound.d.ts +2 -1
- package/Audio/sound.js +21 -9
- package/Audio/sound.js.map +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.d.ts +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
- package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
- package/Behaviors/Cameras/bouncingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js +1 -1
- package/Behaviors/Cameras/bouncingBehavior.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.d.ts +1 -1
- package/Behaviors/Cameras/framingBehavior.js +1 -1
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Bones/bone.d.ts +1 -1
- package/Bones/bone.js +1 -1
- package/Bones/bone.js.map +1 -1
- package/Bones/skeleton.d.ts +2 -2
- package/Bones/skeleton.js +11 -5
- package/Bones/skeleton.js.map +1 -1
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js +3 -22
- package/Cameras/Inputs/BaseCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +3 -3
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js +1 -11
- package/Cameras/Inputs/arcRotateCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraMouseInput.js +3 -3
- package/Cameras/Inputs/flyCameraMouseInput.js.map +1 -1
- package/Cameras/Inputs/followCameraMouseWheelInput.js +1 -4
- package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraMouseInput.js +3 -3
- package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
- package/Cameras/arcRotateCamera.d.ts +1 -1
- package/Cameras/arcRotateCamera.js +1 -1
- package/Cameras/arcRotateCamera.js.map +1 -1
- package/Cameras/camera.d.ts +2 -2
- package/Cameras/camera.js +2 -2
- package/Cameras/camera.js.map +1 -1
- package/Cameras/freeCamera.d.ts +1 -1
- package/Cameras/freeCamera.js +1 -1
- package/Cameras/freeCamera.js.map +1 -1
- package/Cameras/gamepadCamera.d.ts +1 -1
- package/Cameras/gamepadCamera.js +1 -1
- package/Cameras/gamepadCamera.js.map +1 -1
- package/Cameras/targetCamera.d.ts +1 -1
- package/Cameras/targetCamera.js +1 -1
- package/Cameras/targetCamera.js.map +1 -1
- package/Cameras/touchCamera.d.ts +1 -1
- package/Cameras/touchCamera.js +1 -1
- package/Cameras/touchCamera.js.map +1 -1
- package/Cameras/universalCamera.d.ts +1 -1
- package/Cameras/universalCamera.js +1 -1
- package/Cameras/universalCamera.js.map +1 -1
- package/Cameras/virtualJoysticksCamera.d.ts +1 -1
- package/Cameras/virtualJoysticksCamera.js +1 -1
- package/Cameras/virtualJoysticksCamera.js.map +1 -1
- package/Culling/boundingBox.d.ts +2 -2
- package/Culling/boundingBox.js +2 -2
- package/Culling/boundingBox.js.map +1 -1
- package/Culling/ray.d.ts +1 -1
- package/Culling/ray.js +1 -1
- package/Culling/ray.js.map +1 -1
- package/Debug/debugLayer.d.ts +1 -1
- package/Debug/debugLayer.js +1 -1
- package/Debug/debugLayer.js.map +1 -1
- package/DeviceInput/webDeviceInputSystem.js +20 -2
- package/DeviceInput/webDeviceInputSystem.js.map +1 -1
- package/Engines/Extensions/engine.multiRender.js +8 -10
- package/Engines/Extensions/engine.multiRender.js.map +1 -1
- package/Engines/Extensions/engine.query.d.ts +2 -2
- package/Engines/Extensions/engine.query.js.map +1 -1
- package/Engines/ICanvas.d.ts +11 -0
- package/Engines/ICanvas.js.map +1 -1
- package/Engines/WebGL/webGLPipelineContext.d.ts +29 -19
- package/Engines/WebGL/webGLPipelineContext.js +99 -311
- package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -1
- package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
- package/Engines/engine.d.ts +2 -2
- package/Engines/engine.js +2 -2
- package/Engines/engine.js.map +1 -1
- package/Engines/nativeEngine.d.ts +2 -2
- package/Engines/nativeEngine.js +2 -2
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/renderTargetWrapper.d.ts +1 -0
- package/Engines/renderTargetWrapper.js +5 -2
- package/Engines/renderTargetWrapper.js.map +1 -1
- package/Engines/thinEngine.d.ts +6 -5
- package/Engines/thinEngine.js +11 -7
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.js +4 -1
- package/Engines/webgpuEngine.js.map +1 -1
- package/Events/clipboardEvents.d.ts +1 -1
- package/Events/clipboardEvents.js +1 -1
- package/Events/clipboardEvents.js.map +1 -1
- package/Events/deviceInputEvents.d.ts +11 -4
- package/Events/deviceInputEvents.js.map +1 -1
- package/Gamepads/Controllers/windowsMotionController.d.ts +1 -1
- package/Gamepads/Controllers/windowsMotionController.js +1 -1
- package/Gamepads/Controllers/windowsMotionController.js.map +1 -1
- package/Gizmos/boundingBoxGizmo.d.ts +4 -0
- package/Gizmos/boundingBoxGizmo.js +6 -0
- package/Gizmos/boundingBoxGizmo.js.map +1 -1
- package/Inputs/scene.inputManager.js +4 -4
- package/Inputs/scene.inputManager.js.map +1 -1
- package/Layers/effectLayer.d.ts +3 -3
- package/Layers/effectLayer.js +1 -1
- package/Layers/effectLayer.js.map +1 -1
- package/Layers/glowLayer.d.ts +3 -3
- package/Layers/glowLayer.js +2 -2
- package/Layers/glowLayer.js.map +1 -1
- package/Layers/highlightLayer.d.ts +3 -3
- package/Layers/highlightLayer.js +2 -2
- package/Layers/highlightLayer.js.map +1 -1
- package/Lights/directionalLight.d.ts +2 -2
- package/Lights/directionalLight.js +2 -2
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/hemisphericLight.d.ts +3 -3
- package/Lights/hemisphericLight.js +3 -3
- package/Lights/hemisphericLight.js.map +1 -1
- package/Lights/light.d.ts +2 -2
- package/Lights/light.js +2 -2
- package/Lights/light.js.map +1 -1
- package/Lights/lightConstants.d.ts +1 -1
- package/Lights/lightConstants.js +1 -1
- package/Lights/lightConstants.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +3 -0
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Loading/sceneLoader.d.ts +1 -1
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +4 -0
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +4 -1
- package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
- package/Materials/Node/nodeMaterial.d.ts +1 -1
- package/Materials/Node/nodeMaterial.js +5 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/PBR/pbrBaseMaterial.js +4 -1
- package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.d.ts +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.js +1 -1
- package/Materials/Textures/Filtering/hdrFiltering.js.map +1 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.d.ts +2 -1
- package/Materials/Textures/Procedurals/customProceduralTexture.js +9 -3
- package/Materials/Textures/Procedurals/customProceduralTexture.js.map +1 -1
- package/Materials/Textures/Procedurals/proceduralTexture.d.ts +9 -9
- package/Materials/Textures/Procedurals/proceduralTexture.js +9 -9
- package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
- package/Materials/Textures/colorGradingTexture.d.ts +1 -1
- package/Materials/Textures/colorGradingTexture.js +1 -1
- package/Materials/Textures/colorGradingTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.d.ts +2 -2
- package/Materials/Textures/cubeTexture.js +2 -2
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/rawCubeTexture.d.ts +1 -1
- package/Materials/Textures/rawCubeTexture.js +1 -1
- package/Materials/Textures/rawCubeTexture.js.map +1 -1
- package/Materials/Textures/renderTargetTexture.d.ts +3 -5
- package/Materials/Textures/renderTargetTexture.js +19 -19
- package/Materials/Textures/renderTargetTexture.js.map +1 -1
- package/Materials/colorCurves.d.ts +3 -3
- package/Materials/colorCurves.js +3 -3
- package/Materials/colorCurves.js.map +1 -1
- package/Materials/effect.d.ts +27 -27
- package/Materials/effect.js +22 -288
- package/Materials/effect.js.map +1 -1
- package/Materials/fresnelParameters.d.ts +1 -1
- package/Materials/fresnelParameters.js +1 -1
- package/Materials/fresnelParameters.js.map +1 -1
- package/Materials/imageProcessingConfiguration.d.ts +4 -4
- package/Materials/imageProcessingConfiguration.js +4 -4
- package/Materials/imageProcessingConfiguration.js.map +1 -1
- package/Materials/shaderMaterial.d.ts +25 -25
- package/Materials/shaderMaterial.js +25 -25
- package/Materials/shaderMaterial.js.map +1 -1
- package/Materials/standardMaterial.js +4 -1
- package/Materials/standardMaterial.js.map +1 -1
- package/Maths/index.d.ts +1 -0
- package/Maths/index.js +1 -0
- package/Maths/index.js.map +1 -1
- package/Maths/math.functions.d.ts +2 -2
- package/Maths/math.functions.js +2 -2
- package/Maths/math.functions.js.map +1 -1
- package/Maths/math.polar.d.ts +77 -0
- package/Maths/math.polar.js +114 -0
- package/Maths/math.polar.js.map +1 -0
- package/Maths/math.scalar.d.ts +2 -2
- package/Maths/math.scalar.js +2 -2
- package/Maths/math.scalar.js.map +1 -1
- package/Maths/math.vector.d.ts +13 -12
- package/Maths/math.vector.js +13 -12
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/abstractMesh.d.ts +1 -1
- package/Meshes/abstractMesh.js +13 -2
- package/Meshes/abstractMesh.js.map +1 -1
- package/Meshes/geometry.d.ts +3 -3
- package/Meshes/geometry.js +3 -3
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/groundMesh.d.ts +5 -4
- package/Meshes/groundMesh.js +5 -4
- package/Meshes/groundMesh.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +1 -1
- package/Meshes/instancedMesh.js +1 -1
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +3 -3
- package/Meshes/mesh.js +7 -3
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/subMesh.d.ts +1 -1
- package/Meshes/subMesh.js +1 -1
- package/Meshes/subMesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.d.ts +1 -1
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Meshes/transformNode.js +6 -0
- package/Meshes/transformNode.js.map +1 -1
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +2 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +2 -2
- package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
- package/Misc/HighDynamicRange/hdr.d.ts +3 -3
- package/Misc/HighDynamicRange/hdr.js +3 -3
- package/Misc/HighDynamicRange/hdr.js.map +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js +1 -1
- package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
- package/Misc/arrayTools.d.ts +13 -12
- package/Misc/arrayTools.js +70 -39
- package/Misc/arrayTools.js.map +1 -1
- package/Misc/assetsManager.d.ts +3 -3
- package/Misc/assetsManager.js +3 -3
- package/Misc/assetsManager.js.map +1 -1
- package/Misc/basis.js +17 -3
- package/Misc/basis.js.map +1 -1
- package/Misc/environmentTextureTools.d.ts +4 -4
- package/Misc/environmentTextureTools.js +5 -5
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/fileTools.d.ts +3 -3
- package/Misc/fileTools.js +19 -12
- package/Misc/fileTools.js.map +1 -1
- package/Misc/logger.js +1 -1
- package/Misc/logger.js.map +1 -1
- package/Misc/observable.d.ts +1 -1
- package/Misc/observable.js +1 -1
- package/Misc/observable.js.map +1 -1
- package/Misc/performanceMonitor.d.ts +3 -3
- package/Misc/performanceMonitor.js +3 -3
- package/Misc/performanceMonitor.js.map +1 -1
- package/Misc/rgbdTextureTools.d.ts +1 -1
- package/Misc/rgbdTextureTools.js +1 -1
- package/Misc/rgbdTextureTools.js.map +1 -1
- package/Misc/sceneOptimizer.d.ts +7 -7
- package/Misc/sceneOptimizer.js +7 -7
- package/Misc/sceneOptimizer.js.map +1 -1
- package/Misc/stringDictionary.d.ts +6 -6
- package/Misc/stringDictionary.js +6 -6
- package/Misc/stringDictionary.js.map +1 -1
- package/Misc/textureTools.d.ts +4 -4
- package/Misc/textureTools.js +4 -4
- package/Misc/textureTools.js.map +1 -1
- package/Misc/tools.d.ts +6 -6
- package/Misc/tools.js +6 -6
- package/Misc/tools.js.map +1 -1
- package/Misc/videoRecorder.d.ts +1 -1
- package/Misc/videoRecorder.js +1 -1
- package/Misc/videoRecorder.js.map +1 -1
- package/Offline/database.js +3 -3
- package/Offline/database.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +1 -1
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +1 -1
- package/Particles/gpuParticleSystem.js +1 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/particleSystem.d.ts +1 -1
- package/Particles/particleSystem.js +1 -1
- package/Particles/particleSystem.js.map +1 -1
- package/Particles/solidParticleSystem.d.ts +4 -0
- package/Particles/solidParticleSystem.js +25 -3
- package/Particles/solidParticleSystem.js.map +1 -1
- package/Physics/Plugins/ammoJSPlugin.d.ts +1 -1
- package/Physics/Plugins/ammoJSPlugin.js +1 -1
- package/Physics/Plugins/ammoJSPlugin.js.map +1 -1
- package/Physics/Plugins/oimoJSPlugin.js +1 -1
- package/Physics/Plugins/oimoJSPlugin.js.map +1 -1
- package/Physics/physicsEngineComponent.d.ts +1 -1
- package/Physics/physicsEngineComponent.js +1 -1
- package/Physics/physicsEngineComponent.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js +3 -3
- package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +1 -2
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/blurPostProcess.d.ts +3 -3
- package/PostProcesses/blurPostProcess.js +3 -3
- package/PostProcesses/blurPostProcess.js.map +1 -1
- package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +3 -3
- package/PostProcesses/volumetricLightScatteringPostProcess.js +3 -3
- package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
- package/Rendering/depthPeelingRenderer.d.ts +1 -0
- package/Rendering/depthPeelingRenderer.js +32 -5
- package/Rendering/depthPeelingRenderer.js.map +1 -1
- package/Rendering/edgesRenderer.d.ts +2 -2
- package/Rendering/edgesRenderer.js +1 -1
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.d.ts +4 -2
- package/Rendering/geometryBufferRenderer.js +5 -3
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/geometryBufferRendererSceneComponent.d.ts +2 -1
- package/Rendering/geometryBufferRendererSceneComponent.js +3 -2
- package/Rendering/geometryBufferRendererSceneComponent.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +11 -3
- package/Rendering/prePassRenderer.js +18 -3
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/subSurfaceConfiguration.d.ts +2 -2
- package/Rendering/subSurfaceConfiguration.js +2 -2
- package/Rendering/subSurfaceConfiguration.js.map +1 -1
- package/Sprites/spriteSceneComponent.js +4 -1
- package/Sprites/spriteSceneComponent.js.map +1 -1
- package/XR/features/WebXRControllerTeleportation.d.ts +4 -0
- package/XR/features/WebXRControllerTeleportation.js +24 -19
- package/XR/features/WebXRControllerTeleportation.js.map +1 -1
- package/XR/motionController/webXRAbstractMotionController.d.ts +2 -2
- package/XR/motionController/webXRAbstractMotionController.js +2 -2
- package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
- package/XR/motionController/webXRControllerComponent.d.ts +1 -1
- package/XR/motionController/webXRControllerComponent.js +1 -1
- package/XR/motionController/webXRControllerComponent.js.map +1 -1
- package/XR/motionController/webXRMotionControllerManager.d.ts +3 -3
- package/XR/motionController/webXRMotionControllerManager.js +3 -3
- package/XR/motionController/webXRMotionControllerManager.js.map +1 -1
- package/node.d.ts +4 -4
- package/node.js +3 -3
- package/node.js.map +1 -1
- package/package.json +1 -1
- package/readme.md +0 -4
- package/scene.d.ts +80 -63
- package/scene.js +92 -46
- package/scene.js.map +1 -1
- package/sceneComponent.d.ts +1 -1
- package/sceneComponent.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebXRControllerTeleportation.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/XR/features/WebXRControllerTeleportation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAA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Q,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAC;YACjG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,MAAM,CAAC;YACpD,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,kBAAkB,CAAC,eAAe,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,aAAa,CACjK,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,EACjD,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CACpD,CAAC;YACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACjH;IACL,CAAC;;AA7uBD;;GAEG;AACoB,uCAAI,GAAG,gBAAgB,CAAC,aAAa,CAAC;AAC7D;;;;GAIG;AACoB,0CAAO,GAAG,CAAC,CAAC;AAuuBvC,oBAAoB,CAAC,eAAe,CAChC,kCAAkC,CAAC,IAAI,EACvC,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,kCAAkC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC,EACD,kCAAkC,CAAC,OAAO,EAC1C,IAAI,CACP,CAAC","sourcesContent":["import type { IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport { WebXRFeaturesManager, WebXRFeatureName } from \"../webXRFeaturesManager\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { WebXRInput } from \"../webXRInput\";\r\nimport type { WebXRInputSource } from \"../webXRInputSource\";\r\nimport type { IWebXRMotionControllerAxesValue } from \"../motionController/webXRControllerComponent\";\r\nimport { WebXRControllerComponent } from \"../motionController/webXRControllerComponent\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport type { Material } from \"../../Materials/material\";\r\nimport { DynamicTexture } from \"../../Materials/Textures/dynamicTexture\";\r\nimport { CreateCylinder } from \"../../Meshes/Builders/cylinderBuilder\";\r\nimport { SineEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { Animation } from \"../../Animations/animation\";\r\nimport { Axis } from \"../../Maths/math.axis\";\r\nimport { StandardMaterial } from \"../../Materials/standardMaterial\";\r\nimport { CreateGround } from \"../../Meshes/Builders/groundBuilder\";\r\nimport { CreateTorus } from \"../../Meshes/Builders/torusBuilder\";\r\nimport type { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Curve3 } from \"../../Maths/math.path\";\r\nimport { CreateLines } from \"../../Meshes/Builders/linesBuilder\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { UtilityLayerRenderer } from \"../../Rendering/utilityLayerRenderer\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { setAndStartTimer } from \"../../Misc/timer\";\r\nimport type { LinesMesh } from \"../../Meshes/linesMesh\";\r\n\r\n/**\r\n * The options container for the teleportation module\r\n */\r\nexport interface IWebXRTeleportationOptions {\r\n /**\r\n * if provided, this scene will be used to render meshes.\r\n */\r\n customUtilityLayerScene?: Scene;\r\n /**\r\n * Values to configure the default target mesh\r\n */\r\n defaultTargetMeshOptions?: {\r\n /**\r\n * Fill color of the teleportation area\r\n */\r\n teleportationFillColor?: string;\r\n /**\r\n * Border color for the teleportation area\r\n */\r\n teleportationBorderColor?: string;\r\n /**\r\n * Disable the mesh's animation sequence\r\n */\r\n disableAnimation?: boolean;\r\n /**\r\n * Disable lighting on the material or the ring and arrow\r\n */\r\n disableLighting?: boolean;\r\n /**\r\n * Override the default material of the torus and arrow\r\n */\r\n torusArrowMaterial?: Material;\r\n };\r\n /**\r\n * A list of meshes to use as floor meshes.\r\n * Meshes can be added and removed after initializing the feature using the\r\n * addFloorMesh and removeFloorMesh functions\r\n * If empty, rotation will still work\r\n */\r\n floorMeshes?: AbstractMesh[];\r\n /**\r\n * use this rendering group id for the meshes (optional)\r\n */\r\n renderingGroupId?: number;\r\n /**\r\n * Should teleportation move only to snap points\r\n */\r\n snapPointsOnly?: boolean;\r\n /**\r\n * An array of points to which the teleportation will snap to.\r\n * If the teleportation ray is in the proximity of one of those points, it will be corrected to this point.\r\n */\r\n snapPositions?: Vector3[];\r\n /**\r\n * How close should the teleportation ray be in order to snap to position.\r\n * Default to 0.8 units (meters)\r\n */\r\n snapToPositionRadius?: number;\r\n /**\r\n * Provide your own teleportation mesh instead of babylon's wonderful doughnut.\r\n * If you want to support rotation, make sure your mesh has a direction indicator.\r\n *\r\n * When left untouched, the default mesh will be initialized.\r\n */\r\n teleportationTargetMesh?: AbstractMesh;\r\n /**\r\n * If main component is used (no thumbstick), how long should the \"long press\" take before teleport\r\n */\r\n timeToTeleport?: number;\r\n /**\r\n * Disable using the thumbstick and use the main component (usually trigger) on long press.\r\n * This will be automatically true if the controller doesn't have a thumbstick or touchpad.\r\n */\r\n useMainComponentOnly?: boolean;\r\n /**\r\n * Should meshes created here be added to a utility layer or the main scene\r\n */\r\n useUtilityLayer?: boolean;\r\n /**\r\n * Babylon XR Input class for controller\r\n */\r\n xrInput: WebXRInput;\r\n\r\n /**\r\n * Meshes that the teleportation ray cannot go through\r\n */\r\n pickBlockerMeshes?: AbstractMesh[];\r\n\r\n /**\r\n * Should teleport work only on a specific hand?\r\n */\r\n forceHandedness?: XRHandedness;\r\n\r\n /**\r\n * If provided, this function will be used to generate the ray mesh instead of the lines mesh being used per default\r\n */\r\n generateRayPathMesh?: (points: Vector3[], pickingInfo: PickingInfo) => AbstractMesh;\r\n}\r\n\r\n/**\r\n * This is a teleportation feature to be used with WebXR-enabled motion controllers.\r\n * When enabled and attached, the feature will allow a user to move around and rotate in the scene using\r\n * the input of the attached controllers.\r\n */\r\nexport class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {\r\n private _controllers: {\r\n [controllerUniqueId: string]: {\r\n xrController: WebXRInputSource;\r\n teleportationComponent?: WebXRControllerComponent;\r\n teleportationState: {\r\n forward: boolean;\r\n backwards: boolean;\r\n currentRotation: number;\r\n baseRotation: number;\r\n rotating: boolean;\r\n };\r\n onAxisChangedObserver?: Nullable<Observer<IWebXRMotionControllerAxesValue>>;\r\n onButtonChangedObserver?: Nullable<Observer<WebXRControllerComponent>>;\r\n };\r\n } = {};\r\n private _currentTeleportationControllerId: string;\r\n private _floorMeshes: AbstractMesh[];\r\n private _quadraticBezierCurve: Nullable<AbstractMesh>;\r\n private _selectionFeature: Nullable<IWebXRFeature>;\r\n private _snapToPositions: Vector3[];\r\n private _snappedToPoint: boolean = false;\r\n private _teleportationRingMaterial?: StandardMaterial;\r\n private _tmpRay = new Ray(new Vector3(), new Vector3());\r\n private _tmpVector = new Vector3();\r\n private _tmpQuaternion = new Quaternion();\r\n\r\n /**\r\n * Skip the next teleportation. This can be controlled by the user to prevent the user from teleportation\r\n * to sections that are not yet \"unlocked\", but should still show the teleportation mesh.\r\n */\r\n public skipNextTeleportation = false;\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.TELEPORTATION;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the webxr specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * Is movement backwards enabled\r\n */\r\n public backwardsMovementEnabled = true;\r\n /**\r\n * Distance to travel when moving backwards\r\n */\r\n public backwardsTeleportationDistance: number = 0.7;\r\n /**\r\n * The distance from the user to the inspection point in the direction of the controller\r\n * A higher number will allow the user to move further\r\n * defaults to 5 (meters, in xr units)\r\n */\r\n public parabolicCheckRadius: number = 5;\r\n /**\r\n * Should the module support parabolic ray on top of direct ray\r\n * If enabled, the user will be able to point \"at the sky\" and move according to predefined radius distance\r\n * Very helpful when moving between floors / different heights\r\n */\r\n public parabolicRayEnabled: boolean = true;\r\n\r\n /**\r\n * The second type of ray - straight line.\r\n * Should it be enabled or should the parabolic line be the only one.\r\n */\r\n public straightRayEnabled: boolean = true;\r\n /**\r\n * How much rotation should be applied when rotating right and left\r\n */\r\n public rotationAngle: number = Math.PI / 8;\r\n\r\n /**\r\n * This observable will notify when the target mesh position was updated.\r\n * The picking info it provides contains the point to which the target mesh will move ()\r\n */\r\n public onTargetMeshPositionUpdatedObservable: Observable<PickingInfo> = new Observable();\r\n\r\n /**\r\n * Is teleportation enabled. Can be used to allow rotation only.\r\n */\r\n public teleportationEnabled: boolean = true;\r\n\r\n private _rotationEnabled: boolean = true;\r\n\r\n /**\r\n * Is rotation enabled when moving forward?\r\n * Disabling this feature will prevent the user from deciding the direction when teleporting\r\n */\r\n public get rotationEnabled(): boolean {\r\n return this._rotationEnabled;\r\n }\r\n\r\n /**\r\n * Sets whether rotation is enabled or not\r\n * @param enabled is rotation enabled when teleportation is shown\r\n */\r\n public set rotationEnabled(enabled: boolean) {\r\n this._rotationEnabled = enabled;\r\n\r\n if (this._options.teleportationTargetMesh) {\r\n const children = this._options.teleportationTargetMesh.getChildMeshes(false, (node) => node.name === \"rotationCone\");\r\n if (children[0]) {\r\n children[0].setEnabled(enabled);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Exposes the currently set teleportation target mesh.\r\n */\r\n public get teleportationTargetMesh(): Nullable<AbstractMesh> {\r\n return this._options.teleportationTargetMesh || null;\r\n }\r\n\r\n /**\r\n * constructs a new teleportation system\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param _options configuration object for this feature\r\n */\r\n constructor(_xrSessionManager: WebXRSessionManager, private _options: IWebXRTeleportationOptions) {\r\n super(_xrSessionManager);\r\n // create default mesh if not provided\r\n if (!this._options.teleportationTargetMesh) {\r\n this._createDefaultTargetMesh();\r\n }\r\n\r\n this._floorMeshes = this._options.floorMeshes || [];\r\n this._snapToPositions = this._options.snapPositions || [];\r\n\r\n this._setTargetMeshVisibility(false);\r\n }\r\n\r\n /**\r\n * Get the snapPointsOnly flag\r\n */\r\n public get snapPointsOnly(): boolean {\r\n return !!this._options.snapPointsOnly;\r\n }\r\n\r\n /**\r\n * Sets the snapPointsOnly flag\r\n * @param snapToPoints should teleportation be exclusively to snap points\r\n */\r\n public set snapPointsOnly(snapToPoints: boolean) {\r\n this._options.snapPointsOnly = snapToPoints;\r\n }\r\n\r\n /**\r\n * Add a new mesh to the floor meshes array\r\n * @param mesh the mesh to use as floor mesh\r\n */\r\n public addFloorMesh(mesh: AbstractMesh) {\r\n this._floorMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a mesh to the list of meshes blocking the teleportation ray\r\n * @param mesh The mesh to add to the teleportation-blocking meshes\r\n */\r\n public addBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n this._options.pickBlockerMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a new snap-to point to fix teleportation to this position\r\n * @param newSnapPoint The new Snap-To point\r\n */\r\n public addSnapPoint(newSnapPoint: Vector3) {\r\n this._snapToPositions.push(newSnapPoint);\r\n }\r\n\r\n public attach(): boolean {\r\n if (!super.attach()) {\r\n return false;\r\n }\r\n\r\n // Safety reset\r\n this._currentTeleportationControllerId = \"\";\r\n\r\n this._options.xrInput.controllers.forEach(this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable, this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable, (controller) => {\r\n // REMOVE the controller\r\n this._detachController(controller.uniqueId);\r\n });\r\n\r\n return true;\r\n }\r\n\r\n public detach(): boolean {\r\n if (!super.detach()) {\r\n return false;\r\n }\r\n\r\n Object.keys(this._controllers).forEach((controllerId) => {\r\n this._detachController(controllerId);\r\n });\r\n\r\n this._setTargetMeshVisibility(false);\r\n this._currentTeleportationControllerId = \"\";\r\n this._controllers = {};\r\n\r\n return true;\r\n }\r\n\r\n public dispose(): void {\r\n super.dispose();\r\n this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.dispose(false, true);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeFloorMesh(mesh: AbstractMesh) {\r\n const index = this._floorMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._floorMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the blocker meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n const index = this._options.pickBlockerMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._options.pickBlockerMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array using its name\r\n * @param name the mesh name to remove\r\n */\r\n public removeFloorMeshByName(name: string) {\r\n const mesh = this._xrSessionManager.scene.getMeshByName(name);\r\n if (mesh) {\r\n this.removeFloorMesh(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * This function will iterate through the array, searching for this point or equal to it. It will then remove it from the snap-to array\r\n * @param snapPointToRemove the point (or a clone of it) to be removed from the array\r\n * @returns was the point found and removed or not\r\n */\r\n public removeSnapPoint(snapPointToRemove: Vector3): boolean {\r\n // check if the object is in the array\r\n let index = this._snapToPositions.indexOf(snapPointToRemove);\r\n // if not found as an object, compare to the points\r\n if (index === -1) {\r\n for (let i = 0; i < this._snapToPositions.length; ++i) {\r\n // equals? index is i, break the loop\r\n if (this._snapToPositions[i].equals(snapPointToRemove)) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n }\r\n // index is not -1? remove the object\r\n if (index !== -1) {\r\n this._snapToPositions.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * This function sets a selection feature that will be disabled when\r\n * the forward ray is shown and will be reattached when hidden.\r\n * This is used to remove the selection rays when moving.\r\n * @param selectionFeature the feature to disable when forward movement is enabled\r\n */\r\n public setSelectionFeature(selectionFeature: Nullable<IWebXRFeature>) {\r\n this._selectionFeature = selectionFeature;\r\n }\r\n\r\n protected _onXRFrame(_xrFrame: XRFrame) {\r\n const frame = this._xrSessionManager.currentFrame;\r\n const scene = this._xrSessionManager.scene;\r\n if (!this.attach || !frame) {\r\n return;\r\n }\r\n\r\n // render target if needed\r\n const targetMesh = this._options.teleportationTargetMesh;\r\n if (this._currentTeleportationControllerId) {\r\n if (!targetMesh) {\r\n return;\r\n }\r\n targetMesh.rotationQuaternion = targetMesh.rotationQuaternion || new Quaternion();\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n if (controllerData && controllerData.teleportationState.forward) {\r\n // set the rotation\r\n Quaternion.RotationYawPitchRollToRef(\r\n controllerData.teleportationState.currentRotation + controllerData.teleportationState.baseRotation,\r\n 0,\r\n 0,\r\n targetMesh.rotationQuaternion\r\n );\r\n // set the ray and position\r\n\r\n let hitPossible = false;\r\n controllerData.xrController.getWorldPointerRayToRef(this._tmpRay);\r\n if (this.straightRayEnabled) {\r\n // first check if direct ray possible\r\n // pick grounds that are LOWER only. upper will use parabolic path\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n const index = this._floorMeshes.indexOf(o);\r\n if (index === -1) {\r\n return false;\r\n }\r\n return this._floorMeshes[index].absolutePosition.y < this._options.xrInput.xrCamera.globalPosition.y;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n // straight ray is still the main ray, but disabling the straight line will force parabolic line.\r\n if (this.parabolicRayEnabled && !hitPossible) {\r\n // radius compensation according to pointer rotation around X\r\n const xRotation = controllerData.xrController.pointer.rotationQuaternion!.toEulerAngles().x;\r\n const compensation = 1 + (Math.PI / 2 - Math.abs(xRotation));\r\n // check parabolic ray\r\n const radius = this.parabolicCheckRadius * compensation;\r\n this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(radius * 2), this._tmpVector);\r\n this._tmpVector.y = this._tmpRay.origin.y;\r\n this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(radius));\r\n this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction);\r\n this._tmpRay.direction.normalize();\r\n\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n\r\n // if needed, set visible:\r\n this._setTargetMeshVisibility(hitPossible);\r\n } else {\r\n this._setTargetMeshVisibility(false);\r\n }\r\n } else {\r\n this._setTargetMeshVisibility(false);\r\n }\r\n }\r\n\r\n private _attachController = (xrController: WebXRInputSource) => {\r\n if (this._controllers[xrController.uniqueId] || (this._options.forceHandedness && xrController.inputSource.handedness !== this._options.forceHandedness)) {\r\n // already attached\r\n return;\r\n }\r\n this._controllers[xrController.uniqueId] = {\r\n xrController,\r\n teleportationState: {\r\n forward: false,\r\n backwards: false,\r\n rotating: false,\r\n currentRotation: 0,\r\n baseRotation: 0,\r\n },\r\n };\r\n const controllerData = this._controllers[xrController.uniqueId];\r\n // motion controller only available to gamepad-enabled input sources.\r\n if (controllerData.xrController.inputSource.targetRayMode === \"tracked-pointer\" && controllerData.xrController.inputSource.gamepad) {\r\n // motion controller support\r\n const initMotionController = () => {\r\n if (xrController.motionController) {\r\n const movementController =\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.THUMBSTICK_TYPE) ||\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.TOUCHPAD_TYPE);\r\n if (!movementController || this._options.useMainComponentOnly) {\r\n // use trigger to move on long press\r\n const mainComponent = xrController.motionController.getMainComponent();\r\n if (!mainComponent) {\r\n return;\r\n }\r\n controllerData.teleportationComponent = mainComponent;\r\n controllerData.onButtonChangedObserver = mainComponent.onButtonStateChangedObservable.add(() => {\r\n if (!this.teleportationEnabled) {\r\n return;\r\n }\r\n // did \"pressed\" changed?\r\n if (mainComponent.changes.pressed) {\r\n if (mainComponent.changes.pressed.current) {\r\n // simulate \"forward\" thumbstick push\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n breakCondition: () => !mainComponent.pressed,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n }\r\n });\r\n } else {\r\n controllerData.teleportationComponent = movementController;\r\n // use thumbstick (or touchpad if thumbstick not available)\r\n controllerData.onAxisChangedObserver = movementController.onAxisValueChangedObservable.add((axesData) => {\r\n if (axesData.y <= 0.7 && controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = false;\r\n }\r\n if (axesData.y > 0.7 && !controllerData.teleportationState.forward && this.backwardsMovementEnabled && !this.snapPointsOnly) {\r\n // teleport backwards\r\n\r\n // General gist: Go Back N units, cast a ray towards the floor. If collided, move.\r\n if (!controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = true;\r\n // teleport backwards ONCE\r\n this._tmpQuaternion.copyFrom(this._options.xrInput.xrCamera.rotationQuaternion!);\r\n this._tmpQuaternion.toEulerAnglesToRef(this._tmpVector);\r\n // get only the y rotation\r\n this._tmpVector.x = 0;\r\n this._tmpVector.z = 0;\r\n // get the quaternion\r\n Quaternion.FromEulerVectorToRef(this._tmpVector, this._tmpQuaternion);\r\n this._tmpVector.set(0, 0, this.backwardsTeleportationDistance * (this._xrSessionManager.scene.useRightHandedSystem ? 1.0 : -1.0));\r\n this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion, this._tmpVector);\r\n this._tmpVector.addInPlace(this._options.xrInput.xrCamera.position);\r\n this._tmpRay.origin.copyFrom(this._tmpVector);\r\n // This will prevent the user from \"falling\" to a lower platform!\r\n // TODO - should this be a flag? 'allow falling to lower platforms'?\r\n this._tmpRay.length = this._options.xrInput.xrCamera.realWorldHeight + 0.1;\r\n // Right handed system had here \"1\" instead of -1. This is unneeded.\r\n this._tmpRay.direction.set(0, -1, 0);\r\n const pick = this._xrSessionManager.scene.pickWithRay(this._tmpRay, (o) => {\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n\r\n // pick must exist, but stay safe\r\n if (pick && pick.pickedPoint) {\r\n // Teleport the users feet to where they targeted. Ignore the Y axis.\r\n // If the \"falling to lower platforms\" feature is implemented the Y axis should be set here as well\r\n this._options.xrInput.xrCamera.position.x = pick.pickedPoint.x;\r\n this._options.xrInput.xrCamera.position.z = pick.pickedPoint.z;\r\n }\r\n }\r\n }\r\n if (axesData.y < -0.7 && !this._currentTeleportationControllerId && !controllerData.teleportationState.rotating && this.teleportationEnabled) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n }\r\n if (axesData.x) {\r\n if (!controllerData.teleportationState.forward) {\r\n if (!controllerData.teleportationState.rotating && Math.abs(axesData.x) > 0.7) {\r\n // rotate in the right direction positive is right\r\n controllerData.teleportationState.rotating = true;\r\n const rotation = this.rotationAngle * (axesData.x > 0 ? 1 : -1) * (this._xrSessionManager.scene.useRightHandedSystem ? -1 : 1);\r\n Quaternion.FromEulerAngles(0, rotation, 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n }\r\n } else {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId) {\r\n // set the rotation of the forward movement\r\n if (this.rotationEnabled) {\r\n setTimeout(() => {\r\n controllerData.teleportationState.currentRotation = Math.atan2(\r\n axesData.x,\r\n axesData.y * (this._xrSessionManager.scene.useRightHandedSystem ? 1 : -1)\r\n );\r\n });\r\n } else {\r\n controllerData.teleportationState.currentRotation = 0;\r\n }\r\n }\r\n }\r\n } else {\r\n controllerData.teleportationState.rotating = false;\r\n }\r\n\r\n if (axesData.x === 0 && axesData.y === 0) {\r\n if (controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n };\r\n if (xrController.motionController) {\r\n initMotionController();\r\n } else {\r\n xrController.onMotionControllerInitObservable.addOnce(() => {\r\n initMotionController();\r\n });\r\n }\r\n } else {\r\n this._xrSessionManager.scene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n });\r\n }\r\n };\r\n\r\n private _createDefaultTargetMesh() {\r\n // set defaults\r\n this._options.defaultTargetMeshOptions = this._options.defaultTargetMeshOptions || {};\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n const teleportationTarget = CreateGround(\"teleportationTarget\", { width: 2, height: 2, subdivisions: 2 }, sceneToRenderTo);\r\n teleportationTarget.isPickable = false;\r\n const length = 512;\r\n const dynamicTexture = new DynamicTexture(\"teleportationPlaneDynamicTexture\", length, sceneToRenderTo, true);\r\n dynamicTexture.hasAlpha = true;\r\n const context = dynamicTexture.getContext();\r\n const centerX = length / 2;\r\n const centerY = length / 2;\r\n const radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = this._options.defaultTargetMeshOptions.teleportationFillColor || \"#444444\";\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = this._options.defaultTargetMeshOptions.teleportationBorderColor || \"#FFFFFF\";\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n const teleportationCircleMaterial = new StandardMaterial(\"teleportationPlaneMaterial\", sceneToRenderTo);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n teleportationTarget.material = teleportationCircleMaterial;\r\n const torus = CreateTorus(\r\n \"torusTeleportation\",\r\n {\r\n diameter: 0.75,\r\n thickness: 0.1,\r\n tessellation: 20,\r\n },\r\n sceneToRenderTo\r\n );\r\n torus.isPickable = false;\r\n torus.parent = teleportationTarget;\r\n if (!this._options.defaultTargetMeshOptions.disableAnimation) {\r\n const animationInnerCircle = new Animation(\"animationInnerCircle\", \"position.y\", 30, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n const keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0,\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4,\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0,\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n const easingFunction = new SineEase();\r\n easingFunction.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n sceneToRenderTo.beginAnimation(torus, 0, 60, true);\r\n }\r\n\r\n const cone = CreateCylinder(\"rotationCone\", { diameterTop: 0, tessellation: 4 }, sceneToRenderTo);\r\n cone.isPickable = false;\r\n cone.scaling.set(0.5, 0.12, 0.2);\r\n\r\n cone.rotate(Axis.X, Math.PI / 2);\r\n\r\n cone.position.z = 0.6;\r\n cone.parent = torus;\r\n\r\n if (this._options.defaultTargetMeshOptions.torusArrowMaterial) {\r\n torus.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n cone.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n } else {\r\n const torusConeMaterial = new StandardMaterial(\"torusConsMat\", sceneToRenderTo);\r\n torusConeMaterial.disableLighting = !!this._options.defaultTargetMeshOptions.disableLighting;\r\n if (torusConeMaterial.disableLighting) {\r\n torusConeMaterial.emissiveColor = new Color3(0.3, 0.3, 1.0);\r\n } else {\r\n torusConeMaterial.diffuseColor = new Color3(0.3, 0.3, 1.0);\r\n }\r\n torusConeMaterial.alpha = 0.9;\r\n torus.material = torusConeMaterial;\r\n cone.material = torusConeMaterial;\r\n this._teleportationRingMaterial = torusConeMaterial;\r\n }\r\n\r\n if (this._options.renderingGroupId !== undefined) {\r\n teleportationTarget.renderingGroupId = this._options.renderingGroupId;\r\n torus.renderingGroupId = this._options.renderingGroupId;\r\n cone.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n\r\n this._options.teleportationTargetMesh = teleportationTarget;\r\n }\r\n\r\n private _detachController(xrControllerUniqueId: string) {\r\n const controllerData = this._controllers[xrControllerUniqueId];\r\n if (!controllerData) {\r\n return;\r\n }\r\n if (controllerData.teleportationComponent) {\r\n if (controllerData.onAxisChangedObserver) {\r\n controllerData.teleportationComponent.onAxisValueChangedObservable.remove(controllerData.onAxisChangedObserver);\r\n }\r\n if (controllerData.onButtonChangedObserver) {\r\n controllerData.teleportationComponent.onButtonStateChangedObservable.remove(controllerData.onButtonChangedObserver);\r\n }\r\n }\r\n // remove from the map\r\n delete this._controllers[xrControllerUniqueId];\r\n }\r\n\r\n private _findClosestSnapPointWithRadius(realPosition: Vector3, radius: number = this._options.snapToPositionRadius || 0.8) {\r\n let closestPoint: Nullable<Vector3> = null;\r\n let closestDistance = Number.MAX_VALUE;\r\n if (this._snapToPositions.length) {\r\n const radiusSquared = radius * radius;\r\n this._snapToPositions.forEach((position) => {\r\n const dist = Vector3.DistanceSquared(position, realPosition);\r\n if (dist <= radiusSquared && dist < closestDistance) {\r\n closestDistance = dist;\r\n closestPoint = position;\r\n }\r\n });\r\n }\r\n return closestPoint;\r\n }\r\n\r\n private _setTargetMeshPosition(pickInfo: PickingInfo) {\r\n const newPosition = pickInfo.pickedPoint;\r\n if (!this._options.teleportationTargetMesh || !newPosition) {\r\n return;\r\n }\r\n const snapPosition = this._findClosestSnapPointWithRadius(newPosition);\r\n this._snappedToPoint = !!snapPosition;\r\n if (this.snapPointsOnly && !this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(1.0, 0.3, 0.3);\r\n } else if (this.snapPointsOnly && this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(0.3, 0.3, 1.0);\r\n }\r\n this._options.teleportationTargetMesh.position.copyFrom(snapPosition || newPosition);\r\n this._options.teleportationTargetMesh.position.y += 0.01;\r\n this.onTargetMeshPositionUpdatedObservable.notifyObservers(pickInfo);\r\n }\r\n\r\n private _setTargetMeshVisibility(visible: boolean) {\r\n if (!this._options.teleportationTargetMesh) {\r\n return;\r\n }\r\n if (this._options.teleportationTargetMesh.isVisible === visible) {\r\n return;\r\n }\r\n this._options.teleportationTargetMesh.isVisible = visible;\r\n this._options.teleportationTargetMesh.getChildren(undefined, false).forEach((m) => {\r\n (<any>m).isVisible = visible;\r\n });\r\n\r\n if (!visible) {\r\n if (this._quadraticBezierCurve) {\r\n this._quadraticBezierCurve.dispose();\r\n this._quadraticBezierCurve = null;\r\n }\r\n if (this._selectionFeature) {\r\n this._selectionFeature.attach();\r\n }\r\n } else {\r\n if (this._selectionFeature) {\r\n this._selectionFeature.detach();\r\n }\r\n }\r\n }\r\n\r\n private _showParabolicPath(pickInfo: PickingInfo) {\r\n if (!pickInfo.pickedPoint) {\r\n return;\r\n }\r\n\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n\r\n const quadraticBezierVectors = Curve3.CreateQuadraticBezier(controllerData.xrController.pointer.absolutePosition, pickInfo.ray!.origin, pickInfo.pickedPoint, 25);\r\n if (!this._options.generateRayPathMesh) {\r\n this._quadraticBezierCurve = CreateLines(\r\n \"teleportation path line\",\r\n { points: quadraticBezierVectors.getPoints(), instance: this._quadraticBezierCurve as LinesMesh, updatable: true },\r\n sceneToRenderTo\r\n );\r\n } else {\r\n this._quadraticBezierCurve = this._options.generateRayPathMesh(quadraticBezierVectors.getPoints(), pickInfo);\r\n }\r\n this._quadraticBezierCurve.isPickable = false;\r\n if (this._options.renderingGroupId !== undefined) {\r\n this._quadraticBezierCurve.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n }\r\n\r\n private _teleportForward(controllerId: string) {\r\n const controllerData = this._controllers[controllerId];\r\n if (!controllerData || !controllerData.teleportationState.forward || !this.teleportationEnabled) {\r\n return;\r\n }\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n if (this.snapPointsOnly && !this._snappedToPoint) {\r\n return;\r\n }\r\n\r\n if (this.skipNextTeleportation) {\r\n this.skipNextTeleportation = false;\r\n return;\r\n }\r\n // do the movement forward here\r\n if (this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible) {\r\n const height = this._options.xrInput.xrCamera.realWorldHeight;\r\n this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position);\r\n this._options.xrInput.xrCamera.position.y += height;\r\n Quaternion.FromEulerAngles(0, controllerData.teleportationState.currentRotation - (this._xrSessionManager.scene.useRightHandedSystem ? Math.PI : 0), 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n }\r\n }\r\n}\r\n\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRMotionControllerTeleportation(xrSessionManager, options);\r\n },\r\n WebXRMotionControllerTeleportation.Version,\r\n true\r\n);\r\n"]}
|
|
1
|
+
{"version":3,"file":"WebXRControllerTeleportation.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/XR/features/WebXRControllerTeleportation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,8CAA8C,CAAC;AAExF,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,cAAc,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEjE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,o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CAAC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CACpD,CAAC;YACF,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;SACjH;IACL,CAAC;;AAnvBD;;GAEG;AACoB,uCAAI,GAAG,gBAAgB,CAAC,aAAa,CAAC;AAC7D;;;;GAIG;AACoB,0CAAO,GAAG,CAAC,CAAC;AA6uBvC,oBAAoB,CAAC,eAAe,CAChC,kCAAkC,CAAC,IAAI,EACvC,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,kCAAkC,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AACnF,CAAC,EACD,kCAAkC,CAAC,OAAO,EAC1C,IAAI,CACP,CAAC","sourcesContent":["import type { IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport { WebXRFeaturesManager, WebXRFeatureName } from \"../webXRFeaturesManager\";\r\nimport type { Observer } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { WebXRInput } from \"../webXRInput\";\r\nimport type { WebXRInputSource } from \"../webXRInputSource\";\r\nimport type { IWebXRMotionControllerAxesValue } from \"../motionController/webXRControllerComponent\";\r\nimport { WebXRControllerComponent } from \"../motionController/webXRControllerComponent\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport { Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport { Ray } from \"../../Culling/ray\";\r\nimport type { Material } from \"../../Materials/material\";\r\nimport { DynamicTexture } from \"../../Materials/Textures/dynamicTexture\";\r\nimport { CreateCylinder } from \"../../Meshes/Builders/cylinderBuilder\";\r\nimport { SineEase, EasingFunction } from \"../../Animations/easing\";\r\nimport { Animation } from \"../../Animations/animation\";\r\nimport { Axis } from \"../../Maths/math.axis\";\r\nimport { StandardMaterial } from \"../../Materials/standardMaterial\";\r\nimport { CreateGround } from \"../../Meshes/Builders/groundBuilder\";\r\nimport { CreateTorus } from \"../../Meshes/Builders/torusBuilder\";\r\nimport type { PickingInfo } from \"../../Collisions/pickingInfo\";\r\nimport { Curve3 } from \"../../Maths/math.path\";\r\nimport { CreateLines } from \"../../Meshes/Builders/linesBuilder\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport { Color3 } from \"../../Maths/math.color\";\r\nimport type { Scene } from \"../../scene\";\r\nimport { UtilityLayerRenderer } from \"../../Rendering/utilityLayerRenderer\";\r\nimport { PointerEventTypes } from \"../../Events/pointerEvents\";\r\nimport { setAndStartTimer } from \"../../Misc/timer\";\r\nimport type { LinesMesh } from \"../../Meshes/linesMesh\";\r\n\r\n/**\r\n * The options container for the teleportation module\r\n */\r\nexport interface IWebXRTeleportationOptions {\r\n /**\r\n * if provided, this scene will be used to render meshes.\r\n */\r\n customUtilityLayerScene?: Scene;\r\n /**\r\n * Values to configure the default target mesh\r\n */\r\n defaultTargetMeshOptions?: {\r\n /**\r\n * Fill color of the teleportation area\r\n */\r\n teleportationFillColor?: string;\r\n /**\r\n * Border color for the teleportation area\r\n */\r\n teleportationBorderColor?: string;\r\n /**\r\n * Disable the mesh's animation sequence\r\n */\r\n disableAnimation?: boolean;\r\n /**\r\n * Disable lighting on the material or the ring and arrow\r\n */\r\n disableLighting?: boolean;\r\n /**\r\n * Override the default material of the torus and arrow\r\n */\r\n torusArrowMaterial?: Material;\r\n /**\r\n * Override the default material of the Landing Zone\r\n */\r\n teleportationCircleMaterial?: Material;\r\n };\r\n /**\r\n * A list of meshes to use as floor meshes.\r\n * Meshes can be added and removed after initializing the feature using the\r\n * addFloorMesh and removeFloorMesh functions\r\n * If empty, rotation will still work\r\n */\r\n floorMeshes?: AbstractMesh[];\r\n /**\r\n * use this rendering group id for the meshes (optional)\r\n */\r\n renderingGroupId?: number;\r\n /**\r\n * Should teleportation move only to snap points\r\n */\r\n snapPointsOnly?: boolean;\r\n /**\r\n * An array of points to which the teleportation will snap to.\r\n * If the teleportation ray is in the proximity of one of those points, it will be corrected to this point.\r\n */\r\n snapPositions?: Vector3[];\r\n /**\r\n * How close should the teleportation ray be in order to snap to position.\r\n * Default to 0.8 units (meters)\r\n */\r\n snapToPositionRadius?: number;\r\n /**\r\n * Provide your own teleportation mesh instead of babylon's wonderful doughnut.\r\n * If you want to support rotation, make sure your mesh has a direction indicator.\r\n *\r\n * When left untouched, the default mesh will be initialized.\r\n */\r\n teleportationTargetMesh?: AbstractMesh;\r\n /**\r\n * If main component is used (no thumbstick), how long should the \"long press\" take before teleport\r\n */\r\n timeToTeleport?: number;\r\n /**\r\n * Disable using the thumbstick and use the main component (usually trigger) on long press.\r\n * This will be automatically true if the controller doesn't have a thumbstick or touchpad.\r\n */\r\n useMainComponentOnly?: boolean;\r\n /**\r\n * Should meshes created here be added to a utility layer or the main scene\r\n */\r\n useUtilityLayer?: boolean;\r\n /**\r\n * Babylon XR Input class for controller\r\n */\r\n xrInput: WebXRInput;\r\n\r\n /**\r\n * Meshes that the teleportation ray cannot go through\r\n */\r\n pickBlockerMeshes?: AbstractMesh[];\r\n\r\n /**\r\n * Should teleport work only on a specific hand?\r\n */\r\n forceHandedness?: XRHandedness;\r\n\r\n /**\r\n * If provided, this function will be used to generate the ray mesh instead of the lines mesh being used per default\r\n */\r\n generateRayPathMesh?: (points: Vector3[], pickingInfo: PickingInfo) => AbstractMesh;\r\n}\r\n\r\n/**\r\n * This is a teleportation feature to be used with WebXR-enabled motion controllers.\r\n * When enabled and attached, the feature will allow a user to move around and rotate in the scene using\r\n * the input of the attached controllers.\r\n */\r\nexport class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {\r\n private _controllers: {\r\n [controllerUniqueId: string]: {\r\n xrController: WebXRInputSource;\r\n teleportationComponent?: WebXRControllerComponent;\r\n teleportationState: {\r\n forward: boolean;\r\n backwards: boolean;\r\n currentRotation: number;\r\n baseRotation: number;\r\n rotating: boolean;\r\n };\r\n onAxisChangedObserver?: Nullable<Observer<IWebXRMotionControllerAxesValue>>;\r\n onButtonChangedObserver?: Nullable<Observer<WebXRControllerComponent>>;\r\n };\r\n } = {};\r\n private _currentTeleportationControllerId: string;\r\n private _floorMeshes: AbstractMesh[];\r\n private _quadraticBezierCurve: Nullable<AbstractMesh>;\r\n private _selectionFeature: Nullable<IWebXRFeature>;\r\n private _snapToPositions: Vector3[];\r\n private _snappedToPoint: boolean = false;\r\n private _teleportationRingMaterial?: StandardMaterial;\r\n private _tmpRay = new Ray(new Vector3(), new Vector3());\r\n private _tmpVector = new Vector3();\r\n private _tmpQuaternion = new Quaternion();\r\n\r\n /**\r\n * Skip the next teleportation. This can be controlled by the user to prevent the user from teleportation\r\n * to sections that are not yet \"unlocked\", but should still show the teleportation mesh.\r\n */\r\n public skipNextTeleportation = false;\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.TELEPORTATION;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the webxr specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * Is movement backwards enabled\r\n */\r\n public backwardsMovementEnabled = true;\r\n /**\r\n * Distance to travel when moving backwards\r\n */\r\n public backwardsTeleportationDistance: number = 0.7;\r\n /**\r\n * The distance from the user to the inspection point in the direction of the controller\r\n * A higher number will allow the user to move further\r\n * defaults to 5 (meters, in xr units)\r\n */\r\n public parabolicCheckRadius: number = 5;\r\n /**\r\n * Should the module support parabolic ray on top of direct ray\r\n * If enabled, the user will be able to point \"at the sky\" and move according to predefined radius distance\r\n * Very helpful when moving between floors / different heights\r\n */\r\n public parabolicRayEnabled: boolean = true;\r\n\r\n /**\r\n * The second type of ray - straight line.\r\n * Should it be enabled or should the parabolic line be the only one.\r\n */\r\n public straightRayEnabled: boolean = true;\r\n /**\r\n * How much rotation should be applied when rotating right and left\r\n */\r\n public rotationAngle: number = Math.PI / 8;\r\n\r\n /**\r\n * This observable will notify when the target mesh position was updated.\r\n * The picking info it provides contains the point to which the target mesh will move ()\r\n */\r\n public onTargetMeshPositionUpdatedObservable: Observable<PickingInfo> = new Observable();\r\n\r\n /**\r\n * Is teleportation enabled. Can be used to allow rotation only.\r\n */\r\n public teleportationEnabled: boolean = true;\r\n\r\n private _rotationEnabled: boolean = true;\r\n\r\n /**\r\n * Is rotation enabled when moving forward?\r\n * Disabling this feature will prevent the user from deciding the direction when teleporting\r\n */\r\n public get rotationEnabled(): boolean {\r\n return this._rotationEnabled;\r\n }\r\n\r\n /**\r\n * Sets whether rotation is enabled or not\r\n * @param enabled is rotation enabled when teleportation is shown\r\n */\r\n public set rotationEnabled(enabled: boolean) {\r\n this._rotationEnabled = enabled;\r\n\r\n if (this._options.teleportationTargetMesh) {\r\n const children = this._options.teleportationTargetMesh.getChildMeshes(false, (node) => node.name === \"rotationCone\");\r\n if (children[0]) {\r\n children[0].setEnabled(enabled);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Exposes the currently set teleportation target mesh.\r\n */\r\n public get teleportationTargetMesh(): Nullable<AbstractMesh> {\r\n return this._options.teleportationTargetMesh || null;\r\n }\r\n\r\n /**\r\n * constructs a new teleportation system\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param _options configuration object for this feature\r\n */\r\n constructor(_xrSessionManager: WebXRSessionManager, private _options: IWebXRTeleportationOptions) {\r\n super(_xrSessionManager);\r\n // create default mesh if not provided\r\n if (!this._options.teleportationTargetMesh) {\r\n this._createDefaultTargetMesh();\r\n }\r\n\r\n this._floorMeshes = this._options.floorMeshes || [];\r\n this._snapToPositions = this._options.snapPositions || [];\r\n\r\n this._setTargetMeshVisibility(false);\r\n }\r\n\r\n /**\r\n * Get the snapPointsOnly flag\r\n */\r\n public get snapPointsOnly(): boolean {\r\n return !!this._options.snapPointsOnly;\r\n }\r\n\r\n /**\r\n * Sets the snapPointsOnly flag\r\n * @param snapToPoints should teleportation be exclusively to snap points\r\n */\r\n public set snapPointsOnly(snapToPoints: boolean) {\r\n this._options.snapPointsOnly = snapToPoints;\r\n }\r\n\r\n /**\r\n * Add a new mesh to the floor meshes array\r\n * @param mesh the mesh to use as floor mesh\r\n */\r\n public addFloorMesh(mesh: AbstractMesh) {\r\n this._floorMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a mesh to the list of meshes blocking the teleportation ray\r\n * @param mesh The mesh to add to the teleportation-blocking meshes\r\n */\r\n public addBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n this._options.pickBlockerMeshes.push(mesh);\r\n }\r\n\r\n /**\r\n * Add a new snap-to point to fix teleportation to this position\r\n * @param newSnapPoint The new Snap-To point\r\n */\r\n public addSnapPoint(newSnapPoint: Vector3) {\r\n this._snapToPositions.push(newSnapPoint);\r\n }\r\n\r\n public attach(): boolean {\r\n if (!super.attach()) {\r\n return false;\r\n }\r\n\r\n // Safety reset\r\n this._currentTeleportationControllerId = \"\";\r\n\r\n this._options.xrInput.controllers.forEach(this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerAddedObservable, this._attachController);\r\n this._addNewAttachObserver(this._options.xrInput.onControllerRemovedObservable, (controller) => {\r\n // REMOVE the controller\r\n this._detachController(controller.uniqueId);\r\n });\r\n\r\n return true;\r\n }\r\n\r\n public detach(): boolean {\r\n if (!super.detach()) {\r\n return false;\r\n }\r\n\r\n Object.keys(this._controllers).forEach((controllerId) => {\r\n this._detachController(controllerId);\r\n });\r\n\r\n this._setTargetMeshVisibility(false);\r\n this._currentTeleportationControllerId = \"\";\r\n this._controllers = {};\r\n\r\n return true;\r\n }\r\n\r\n public dispose(): void {\r\n super.dispose();\r\n this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.dispose(false, true);\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeFloorMesh(mesh: AbstractMesh) {\r\n const index = this._floorMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._floorMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the blocker meshes array\r\n * @param mesh the mesh to remove\r\n */\r\n public removeBlockerMesh(mesh: AbstractMesh) {\r\n this._options.pickBlockerMeshes = this._options.pickBlockerMeshes || [];\r\n const index = this._options.pickBlockerMeshes.indexOf(mesh);\r\n if (index !== -1) {\r\n this._options.pickBlockerMeshes.splice(index, 1);\r\n }\r\n }\r\n\r\n /**\r\n * Remove a mesh from the floor meshes array using its name\r\n * @param name the mesh name to remove\r\n */\r\n public removeFloorMeshByName(name: string) {\r\n const mesh = this._xrSessionManager.scene.getMeshByName(name);\r\n if (mesh) {\r\n this.removeFloorMesh(mesh);\r\n }\r\n }\r\n\r\n /**\r\n * This function will iterate through the array, searching for this point or equal to it. It will then remove it from the snap-to array\r\n * @param snapPointToRemove the point (or a clone of it) to be removed from the array\r\n * @returns was the point found and removed or not\r\n */\r\n public removeSnapPoint(snapPointToRemove: Vector3): boolean {\r\n // check if the object is in the array\r\n let index = this._snapToPositions.indexOf(snapPointToRemove);\r\n // if not found as an object, compare to the points\r\n if (index === -1) {\r\n for (let i = 0; i < this._snapToPositions.length; ++i) {\r\n // equals? index is i, break the loop\r\n if (this._snapToPositions[i].equals(snapPointToRemove)) {\r\n index = i;\r\n break;\r\n }\r\n }\r\n }\r\n // index is not -1? remove the object\r\n if (index !== -1) {\r\n this._snapToPositions.splice(index, 1);\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * This function sets a selection feature that will be disabled when\r\n * the forward ray is shown and will be reattached when hidden.\r\n * This is used to remove the selection rays when moving.\r\n * @param selectionFeature the feature to disable when forward movement is enabled\r\n */\r\n public setSelectionFeature(selectionFeature: Nullable<IWebXRFeature>) {\r\n this._selectionFeature = selectionFeature;\r\n }\r\n\r\n protected _onXRFrame(_xrFrame: XRFrame) {\r\n const frame = this._xrSessionManager.currentFrame;\r\n const scene = this._xrSessionManager.scene;\r\n if (!this.attach || !frame) {\r\n return;\r\n }\r\n\r\n // render target if needed\r\n const targetMesh = this._options.teleportationTargetMesh;\r\n if (this._currentTeleportationControllerId) {\r\n if (!targetMesh) {\r\n return;\r\n }\r\n targetMesh.rotationQuaternion = targetMesh.rotationQuaternion || new Quaternion();\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n if (controllerData && controllerData.teleportationState.forward) {\r\n // set the rotation\r\n Quaternion.RotationYawPitchRollToRef(\r\n controllerData.teleportationState.currentRotation + controllerData.teleportationState.baseRotation,\r\n 0,\r\n 0,\r\n targetMesh.rotationQuaternion\r\n );\r\n // set the ray and position\r\n\r\n let hitPossible = false;\r\n controllerData.xrController.getWorldPointerRayToRef(this._tmpRay);\r\n if (this.straightRayEnabled) {\r\n // first check if direct ray possible\r\n // pick grounds that are LOWER only. upper will use parabolic path\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n const index = this._floorMeshes.indexOf(o);\r\n if (index === -1) {\r\n return false;\r\n }\r\n return this._floorMeshes[index].absolutePosition.y < this._options.xrInput.xrCamera.globalPosition.y;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n // straight ray is still the main ray, but disabling the straight line will force parabolic line.\r\n if (this.parabolicRayEnabled && !hitPossible) {\r\n // radius compensation according to pointer rotation around X\r\n const xRotation = controllerData.xrController.pointer.rotationQuaternion!.toEulerAngles().x;\r\n const compensation = 1 + (Math.PI / 2 - Math.abs(xRotation));\r\n // check parabolic ray\r\n const radius = this.parabolicCheckRadius * compensation;\r\n this._tmpRay.origin.addToRef(this._tmpRay.direction.scale(radius * 2), this._tmpVector);\r\n this._tmpVector.y = this._tmpRay.origin.y;\r\n this._tmpRay.origin.addInPlace(this._tmpRay.direction.scale(radius));\r\n this._tmpVector.subtractToRef(this._tmpRay.origin, this._tmpRay.direction);\r\n this._tmpRay.direction.normalize();\r\n\r\n const pick = scene.pickWithRay(this._tmpRay, (o) => {\r\n // check for mesh-blockers\r\n if (this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(o) !== -1) {\r\n return true;\r\n }\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n if (pick && pick.pickedMesh && this._options.pickBlockerMeshes && this._options.pickBlockerMeshes.indexOf(pick.pickedMesh) !== -1) {\r\n return;\r\n } else if (pick && pick.pickedPoint) {\r\n hitPossible = true;\r\n this._setTargetMeshPosition(pick);\r\n this._setTargetMeshVisibility(true);\r\n this._showParabolicPath(pick);\r\n }\r\n }\r\n\r\n // if needed, set visible:\r\n this._setTargetMeshVisibility(hitPossible);\r\n } else {\r\n this._setTargetMeshVisibility(false);\r\n }\r\n } else {\r\n this._setTargetMeshVisibility(false);\r\n }\r\n }\r\n\r\n private _attachController = (xrController: WebXRInputSource) => {\r\n if (this._controllers[xrController.uniqueId] || (this._options.forceHandedness && xrController.inputSource.handedness !== this._options.forceHandedness)) {\r\n // already attached\r\n return;\r\n }\r\n this._controllers[xrController.uniqueId] = {\r\n xrController,\r\n teleportationState: {\r\n forward: false,\r\n backwards: false,\r\n rotating: false,\r\n currentRotation: 0,\r\n baseRotation: 0,\r\n },\r\n };\r\n const controllerData = this._controllers[xrController.uniqueId];\r\n // motion controller only available to gamepad-enabled input sources.\r\n if (controllerData.xrController.inputSource.targetRayMode === \"tracked-pointer\" && controllerData.xrController.inputSource.gamepad) {\r\n // motion controller support\r\n const initMotionController = () => {\r\n if (xrController.motionController) {\r\n const movementController =\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.THUMBSTICK_TYPE) ||\r\n xrController.motionController.getComponentOfType(WebXRControllerComponent.TOUCHPAD_TYPE);\r\n if (!movementController || this._options.useMainComponentOnly) {\r\n // use trigger to move on long press\r\n const mainComponent = xrController.motionController.getMainComponent();\r\n if (!mainComponent) {\r\n return;\r\n }\r\n controllerData.teleportationComponent = mainComponent;\r\n controllerData.onButtonChangedObserver = mainComponent.onButtonStateChangedObservable.add(() => {\r\n if (!this.teleportationEnabled) {\r\n return;\r\n }\r\n // did \"pressed\" changed?\r\n if (mainComponent.changes.pressed) {\r\n if (mainComponent.changes.pressed.current) {\r\n // simulate \"forward\" thumbstick push\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n breakCondition: () => !mainComponent.pressed,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n }\r\n });\r\n } else {\r\n controllerData.teleportationComponent = movementController;\r\n // use thumbstick (or touchpad if thumbstick not available)\r\n controllerData.onAxisChangedObserver = movementController.onAxisValueChangedObservable.add((axesData) => {\r\n if (axesData.y <= 0.7 && controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = false;\r\n }\r\n if (axesData.y > 0.7 && !controllerData.teleportationState.forward && this.backwardsMovementEnabled && !this.snapPointsOnly) {\r\n // teleport backwards\r\n\r\n // General gist: Go Back N units, cast a ray towards the floor. If collided, move.\r\n if (!controllerData.teleportationState.backwards) {\r\n controllerData.teleportationState.backwards = true;\r\n // teleport backwards ONCE\r\n this._tmpQuaternion.copyFrom(this._options.xrInput.xrCamera.rotationQuaternion!);\r\n this._tmpQuaternion.toEulerAnglesToRef(this._tmpVector);\r\n // get only the y rotation\r\n this._tmpVector.x = 0;\r\n this._tmpVector.z = 0;\r\n // get the quaternion\r\n Quaternion.FromEulerVectorToRef(this._tmpVector, this._tmpQuaternion);\r\n this._tmpVector.set(0, 0, this.backwardsTeleportationDistance * (this._xrSessionManager.scene.useRightHandedSystem ? 1.0 : -1.0));\r\n this._tmpVector.rotateByQuaternionToRef(this._tmpQuaternion, this._tmpVector);\r\n this._tmpVector.addInPlace(this._options.xrInput.xrCamera.position);\r\n this._tmpRay.origin.copyFrom(this._tmpVector);\r\n // This will prevent the user from \"falling\" to a lower platform!\r\n // TODO - should this be a flag? 'allow falling to lower platforms'?\r\n this._tmpRay.length = this._options.xrInput.xrCamera.realWorldHeight + 0.1;\r\n // Right handed system had here \"1\" instead of -1. This is unneeded.\r\n this._tmpRay.direction.set(0, -1, 0);\r\n const pick = this._xrSessionManager.scene.pickWithRay(this._tmpRay, (o) => {\r\n return this._floorMeshes.indexOf(o) !== -1;\r\n });\r\n\r\n // pick must exist, but stay safe\r\n if (pick && pick.pickedPoint) {\r\n // Teleport the users feet to where they targeted. Ignore the Y axis.\r\n // If the \"falling to lower platforms\" feature is implemented the Y axis should be set here as well\r\n this._options.xrInput.xrCamera.position.x = pick.pickedPoint.x;\r\n this._options.xrInput.xrCamera.position.z = pick.pickedPoint.z;\r\n }\r\n }\r\n }\r\n if (axesData.y < -0.7 && !this._currentTeleportationControllerId && !controllerData.teleportationState.rotating && this.teleportationEnabled) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n }\r\n if (axesData.x) {\r\n if (!controllerData.teleportationState.forward) {\r\n if (!controllerData.teleportationState.rotating && Math.abs(axesData.x) > 0.7) {\r\n // rotate in the right direction positive is right\r\n controllerData.teleportationState.rotating = true;\r\n const rotation = this.rotationAngle * (axesData.x > 0 ? 1 : -1) * (this._xrSessionManager.scene.useRightHandedSystem ? -1 : 1);\r\n Quaternion.FromEulerAngles(0, rotation, 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n }\r\n } else {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId) {\r\n // set the rotation of the forward movement\r\n if (this.rotationEnabled) {\r\n setTimeout(() => {\r\n controllerData.teleportationState.currentRotation = Math.atan2(\r\n axesData.x,\r\n axesData.y * (this._xrSessionManager.scene.useRightHandedSystem ? 1 : -1)\r\n );\r\n });\r\n } else {\r\n controllerData.teleportationState.currentRotation = 0;\r\n }\r\n }\r\n }\r\n } else {\r\n controllerData.teleportationState.rotating = false;\r\n }\r\n\r\n if (axesData.x === 0 && axesData.y === 0) {\r\n if (controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n }\r\n });\r\n }\r\n }\r\n };\r\n if (xrController.motionController) {\r\n initMotionController();\r\n } else {\r\n xrController.onMotionControllerInitObservable.addOnce(() => {\r\n initMotionController();\r\n });\r\n }\r\n } else {\r\n this._xrSessionManager.scene.onPointerObservable.add((pointerInfo) => {\r\n if (pointerInfo.type === PointerEventTypes.POINTERDOWN) {\r\n controllerData.teleportationState.forward = true;\r\n this._currentTeleportationControllerId = controllerData.xrController.uniqueId;\r\n controllerData.teleportationState.baseRotation = this._options.xrInput.xrCamera.rotationQuaternion.toEulerAngles().y;\r\n controllerData.teleportationState.currentRotation = 0;\r\n const timeToSelect = this._options.timeToTeleport || 3000;\r\n setAndStartTimer({\r\n timeout: timeToSelect,\r\n contextObservable: this._xrSessionManager.onXRFrameObservable,\r\n onEnded: () => {\r\n if (this._currentTeleportationControllerId === controllerData.xrController.uniqueId && controllerData.teleportationState.forward) {\r\n this._teleportForward(xrController.uniqueId);\r\n }\r\n },\r\n });\r\n } else if (pointerInfo.type === PointerEventTypes.POINTERUP) {\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n }\r\n });\r\n }\r\n };\r\n\r\n private _createDefaultTargetMesh() {\r\n // set defaults\r\n this._options.defaultTargetMeshOptions = this._options.defaultTargetMeshOptions || {};\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n const teleportationTarget = CreateGround(\"teleportationTarget\", { width: 2, height: 2, subdivisions: 2 }, sceneToRenderTo);\r\n teleportationTarget.isPickable = false;\r\n\r\n if (this._options.defaultTargetMeshOptions.teleportationCircleMaterial) {\r\n teleportationTarget.material = this._options.defaultTargetMeshOptions.teleportationCircleMaterial;\r\n } else {\r\n const length = 512;\r\n const dynamicTexture = new DynamicTexture(\"teleportationPlaneDynamicTexture\", length, sceneToRenderTo, true);\r\n dynamicTexture.hasAlpha = true;\r\n const context = dynamicTexture.getContext();\r\n const centerX = length / 2;\r\n const centerY = length / 2;\r\n const radius = 200;\r\n context.beginPath();\r\n context.arc(centerX, centerY, radius, 0, 2 * Math.PI, false);\r\n context.fillStyle = this._options.defaultTargetMeshOptions.teleportationFillColor || \"#444444\";\r\n context.fill();\r\n context.lineWidth = 10;\r\n context.strokeStyle = this._options.defaultTargetMeshOptions.teleportationBorderColor || \"#FFFFFF\";\r\n context.stroke();\r\n context.closePath();\r\n dynamicTexture.update();\r\n const teleportationCircleMaterial = new StandardMaterial(\"teleportationPlaneMaterial\", sceneToRenderTo);\r\n teleportationCircleMaterial.diffuseTexture = dynamicTexture;\r\n teleportationTarget.material = teleportationCircleMaterial;\r\n }\r\n\r\n const torus = CreateTorus(\r\n \"torusTeleportation\",\r\n {\r\n diameter: 0.75,\r\n thickness: 0.1,\r\n tessellation: 20,\r\n },\r\n sceneToRenderTo\r\n );\r\n torus.isPickable = false;\r\n torus.parent = teleportationTarget;\r\n if (!this._options.defaultTargetMeshOptions.disableAnimation) {\r\n const animationInnerCircle = new Animation(\"animationInnerCircle\", \"position.y\", 30, Animation.ANIMATIONTYPE_FLOAT, Animation.ANIMATIONLOOPMODE_CYCLE);\r\n const keys = [];\r\n keys.push({\r\n frame: 0,\r\n value: 0,\r\n });\r\n keys.push({\r\n frame: 30,\r\n value: 0.4,\r\n });\r\n keys.push({\r\n frame: 60,\r\n value: 0,\r\n });\r\n animationInnerCircle.setKeys(keys);\r\n const easingFunction = new SineEase();\r\n easingFunction.setEasingMode(EasingFunction.EASINGMODE_EASEINOUT);\r\n animationInnerCircle.setEasingFunction(easingFunction);\r\n torus.animations = [];\r\n torus.animations.push(animationInnerCircle);\r\n sceneToRenderTo.beginAnimation(torus, 0, 60, true);\r\n }\r\n\r\n const cone = CreateCylinder(\"rotationCone\", { diameterTop: 0, tessellation: 4 }, sceneToRenderTo);\r\n cone.isPickable = false;\r\n cone.scaling.set(0.5, 0.12, 0.2);\r\n\r\n cone.rotate(Axis.X, Math.PI / 2);\r\n\r\n cone.position.z = 0.6;\r\n cone.parent = torus;\r\n\r\n if (this._options.defaultTargetMeshOptions.torusArrowMaterial) {\r\n torus.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n cone.material = this._options.defaultTargetMeshOptions.torusArrowMaterial;\r\n } else {\r\n const torusConeMaterial = new StandardMaterial(\"torusConsMat\", sceneToRenderTo);\r\n torusConeMaterial.disableLighting = !!this._options.defaultTargetMeshOptions.disableLighting;\r\n if (torusConeMaterial.disableLighting) {\r\n torusConeMaterial.emissiveColor = new Color3(0.3, 0.3, 1.0);\r\n } else {\r\n torusConeMaterial.diffuseColor = new Color3(0.3, 0.3, 1.0);\r\n }\r\n torusConeMaterial.alpha = 0.9;\r\n torus.material = torusConeMaterial;\r\n cone.material = torusConeMaterial;\r\n this._teleportationRingMaterial = torusConeMaterial;\r\n }\r\n\r\n if (this._options.renderingGroupId !== undefined) {\r\n teleportationTarget.renderingGroupId = this._options.renderingGroupId;\r\n torus.renderingGroupId = this._options.renderingGroupId;\r\n cone.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n\r\n this._options.teleportationTargetMesh = teleportationTarget;\r\n }\r\n\r\n private _detachController(xrControllerUniqueId: string) {\r\n const controllerData = this._controllers[xrControllerUniqueId];\r\n if (!controllerData) {\r\n return;\r\n }\r\n if (controllerData.teleportationComponent) {\r\n if (controllerData.onAxisChangedObserver) {\r\n controllerData.teleportationComponent.onAxisValueChangedObservable.remove(controllerData.onAxisChangedObserver);\r\n }\r\n if (controllerData.onButtonChangedObserver) {\r\n controllerData.teleportationComponent.onButtonStateChangedObservable.remove(controllerData.onButtonChangedObserver);\r\n }\r\n }\r\n // remove from the map\r\n delete this._controllers[xrControllerUniqueId];\r\n }\r\n\r\n private _findClosestSnapPointWithRadius(realPosition: Vector3, radius: number = this._options.snapToPositionRadius || 0.8) {\r\n let closestPoint: Nullable<Vector3> = null;\r\n let closestDistance = Number.MAX_VALUE;\r\n if (this._snapToPositions.length) {\r\n const radiusSquared = radius * radius;\r\n this._snapToPositions.forEach((position) => {\r\n const dist = Vector3.DistanceSquared(position, realPosition);\r\n if (dist <= radiusSquared && dist < closestDistance) {\r\n closestDistance = dist;\r\n closestPoint = position;\r\n }\r\n });\r\n }\r\n return closestPoint;\r\n }\r\n\r\n private _setTargetMeshPosition(pickInfo: PickingInfo) {\r\n const newPosition = pickInfo.pickedPoint;\r\n if (!this._options.teleportationTargetMesh || !newPosition) {\r\n return;\r\n }\r\n const snapPosition = this._findClosestSnapPointWithRadius(newPosition);\r\n this._snappedToPoint = !!snapPosition;\r\n if (this.snapPointsOnly && !this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(1.0, 0.3, 0.3);\r\n } else if (this.snapPointsOnly && this._snappedToPoint && this._teleportationRingMaterial) {\r\n this._teleportationRingMaterial.diffuseColor.set(0.3, 0.3, 1.0);\r\n }\r\n this._options.teleportationTargetMesh.position.copyFrom(snapPosition || newPosition);\r\n this._options.teleportationTargetMesh.position.y += 0.01;\r\n this.onTargetMeshPositionUpdatedObservable.notifyObservers(pickInfo);\r\n }\r\n\r\n private _setTargetMeshVisibility(visible: boolean) {\r\n if (!this._options.teleportationTargetMesh) {\r\n return;\r\n }\r\n if (this._options.teleportationTargetMesh.isVisible === visible) {\r\n return;\r\n }\r\n this._options.teleportationTargetMesh.isVisible = visible;\r\n this._options.teleportationTargetMesh.getChildren(undefined, false).forEach((m) => {\r\n (<any>m).isVisible = visible;\r\n });\r\n\r\n if (!visible) {\r\n if (this._quadraticBezierCurve) {\r\n this._quadraticBezierCurve.dispose();\r\n this._quadraticBezierCurve = null;\r\n }\r\n if (this._selectionFeature) {\r\n this._selectionFeature.attach();\r\n }\r\n } else {\r\n if (this._selectionFeature) {\r\n this._selectionFeature.detach();\r\n }\r\n }\r\n }\r\n\r\n private _showParabolicPath(pickInfo: PickingInfo) {\r\n if (!pickInfo.pickedPoint) {\r\n return;\r\n }\r\n\r\n const sceneToRenderTo = this._options.useUtilityLayer\r\n ? this._options.customUtilityLayerScene || UtilityLayerRenderer.DefaultUtilityLayer.utilityLayerScene\r\n : this._xrSessionManager.scene;\r\n\r\n const controllerData = this._controllers[this._currentTeleportationControllerId];\r\n\r\n const quadraticBezierVectors = Curve3.CreateQuadraticBezier(controllerData.xrController.pointer.absolutePosition, pickInfo.ray!.origin, pickInfo.pickedPoint, 25);\r\n if (!this._options.generateRayPathMesh) {\r\n this._quadraticBezierCurve = CreateLines(\r\n \"teleportation path line\",\r\n { points: quadraticBezierVectors.getPoints(), instance: this._quadraticBezierCurve as LinesMesh, updatable: true },\r\n sceneToRenderTo\r\n );\r\n } else {\r\n this._quadraticBezierCurve = this._options.generateRayPathMesh(quadraticBezierVectors.getPoints(), pickInfo);\r\n }\r\n this._quadraticBezierCurve.isPickable = false;\r\n if (this._options.renderingGroupId !== undefined) {\r\n this._quadraticBezierCurve.renderingGroupId = this._options.renderingGroupId;\r\n }\r\n }\r\n\r\n private _teleportForward(controllerId: string) {\r\n const controllerData = this._controllers[controllerId];\r\n if (!controllerData || !controllerData.teleportationState.forward || !this.teleportationEnabled) {\r\n return;\r\n }\r\n controllerData.teleportationState.forward = false;\r\n this._currentTeleportationControllerId = \"\";\r\n if (this.snapPointsOnly && !this._snappedToPoint) {\r\n return;\r\n }\r\n\r\n if (this.skipNextTeleportation) {\r\n this.skipNextTeleportation = false;\r\n return;\r\n }\r\n // do the movement forward here\r\n if (this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible) {\r\n const height = this._options.xrInput.xrCamera.realWorldHeight;\r\n this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position);\r\n this._options.xrInput.xrCamera.position.y += height;\r\n Quaternion.FromEulerAngles(0, controllerData.teleportationState.currentRotation - (this._xrSessionManager.scene.useRightHandedSystem ? Math.PI : 0), 0).multiplyToRef(\r\n this._options.xrInput.xrCamera.rotationQuaternion,\r\n this._options.xrInput.xrCamera.rotationQuaternion\r\n );\r\n this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);\r\n }\r\n }\r\n}\r\n\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRMotionControllerTeleportation.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRMotionControllerTeleportation(xrSessionManager, options);\r\n },\r\n WebXRMotionControllerTeleportation.Version,\r\n true\r\n);\r\n"]}
|
|
@@ -288,7 +288,7 @@ export declare abstract class WebXRAbstractMotionController implements IDisposab
|
|
|
288
288
|
/**
|
|
289
289
|
* Returns all components of specific type
|
|
290
290
|
* @param type the type to search for
|
|
291
|
-
* @
|
|
291
|
+
* @returns an array of components with this type
|
|
292
292
|
*/
|
|
293
293
|
getAllComponentsOfType(type: MotionControllerComponentType): WebXRControllerComponent[];
|
|
294
294
|
/**
|
|
@@ -305,7 +305,7 @@ export declare abstract class WebXRAbstractMotionController implements IDisposab
|
|
|
305
305
|
/**
|
|
306
306
|
* Get the first component of specific type
|
|
307
307
|
* @param type type of component to find
|
|
308
|
-
* @
|
|
308
|
+
* @returns a controller component or null if not found
|
|
309
309
|
*/
|
|
310
310
|
getComponentOfType(type: MotionControllerComponentType): Nullable<WebXRControllerComponent>;
|
|
311
311
|
/**
|
|
@@ -91,7 +91,7 @@ export class WebXRAbstractMotionController {
|
|
|
91
91
|
/**
|
|
92
92
|
* Returns all components of specific type
|
|
93
93
|
* @param type the type to search for
|
|
94
|
-
* @
|
|
94
|
+
* @returns an array of components with this type
|
|
95
95
|
*/
|
|
96
96
|
getAllComponentsOfType(type) {
|
|
97
97
|
return this.getComponentIds()
|
|
@@ -116,7 +116,7 @@ export class WebXRAbstractMotionController {
|
|
|
116
116
|
/**
|
|
117
117
|
* Get the first component of specific type
|
|
118
118
|
* @param type type of component to find
|
|
119
|
-
* @
|
|
119
|
+
* @returns a controller component or null if not found
|
|
120
120
|
*/
|
|
121
121
|
getComponentOfType(type) {
|
|
122
122
|
return this.getAllComponentsOfType(type)[0] || null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webXRAbstractMotionController.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/XR/motionController/webXRAbstractMotionController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAA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AC,QAAQ,CAAC,CAAC;aACjC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,kBAAkB,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC;CACJ","sourcesContent":["import type { IDisposable, Scene } from \"../../scene\";\r\nimport { WebXRControllerComponent } from \"./webXRControllerComponent\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { SceneLoader } from \"../../Loading/sceneLoader\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\n\r\n/**\r\n * Handedness type in xrInput profiles. These can be used to define layouts in the Layout Map.\r\n */\r\nexport type MotionControllerHandedness = \"none\" | \"left\" | \"right\";\r\n/**\r\n * The type of components available in motion controllers.\r\n * This is not the name of the component.\r\n */\r\nexport type MotionControllerComponentType = \"trigger\" | \"squeeze\" | \"touchpad\" | \"thumbstick\" | \"button\";\r\n\r\n/**\r\n * The state of a controller component\r\n */\r\nexport type MotionControllerComponentStateType = \"default\" | \"touched\" | \"pressed\";\r\n\r\n/**\r\n * The schema of motion controller layout.\r\n * No object will be initialized using this interface\r\n * This is used just to define the profile.\r\n */\r\nexport interface IMotionControllerLayout {\r\n /**\r\n * Path to load the assets. Usually relative to the base path\r\n */\r\n assetPath: string;\r\n /**\r\n * Available components (unsorted)\r\n */\r\n components: {\r\n /**\r\n * A map of component Ids\r\n */\r\n [componentId: string]: {\r\n /**\r\n * The type of input the component outputs\r\n */\r\n type: MotionControllerComponentType;\r\n /**\r\n * The indices of this component in the gamepad object\r\n */\r\n gamepadIndices: {\r\n /**\r\n * Index of button\r\n */\r\n button?: number;\r\n /**\r\n * If available, index of x-axis\r\n */\r\n xAxis?: number;\r\n /**\r\n * If available, index of y-axis\r\n */\r\n yAxis?: number;\r\n };\r\n /**\r\n * The mesh's root node name\r\n */\r\n rootNodeName: string;\r\n /**\r\n * Animation definitions for this model\r\n */\r\n visualResponses: {\r\n [stateKey: string]: {\r\n /**\r\n * What property will be animated\r\n */\r\n componentProperty: \"xAxis\" | \"yAxis\" | \"button\" | \"state\";\r\n /**\r\n * What states influence this visual response\r\n */\r\n states: MotionControllerComponentStateType[];\r\n /**\r\n * Type of animation - movement or visibility\r\n */\r\n valueNodeProperty: \"transform\" | \"visibility\";\r\n /**\r\n * Base node name to move. Its position will be calculated according to the min and max nodes\r\n */\r\n valueNodeName?: string;\r\n /**\r\n * Minimum movement node\r\n */\r\n minNodeName?: string;\r\n /**\r\n * Max movement node\r\n */\r\n maxNodeName?: string;\r\n };\r\n };\r\n /**\r\n * If touch enabled, what is the name of node to display user feedback\r\n */\r\n touchPointNodeName?: string;\r\n };\r\n };\r\n /**\r\n * Is it xr standard mapping or not\r\n */\r\n gamepadMapping: \"\" | \"xr-standard\";\r\n /**\r\n * Base root node of this entire model\r\n */\r\n rootNodeName: string;\r\n /**\r\n * Defines the main button component id\r\n */\r\n selectComponentId: string;\r\n}\r\n\r\n/**\r\n * A definition for the layout map in the input profile\r\n */\r\nexport interface IMotionControllerLayoutMap {\r\n /**\r\n * Layouts with handedness type as a key\r\n */\r\n [handedness: string /* handedness */]: IMotionControllerLayout;\r\n}\r\n\r\n/**\r\n * The XR Input profile schema\r\n * Profiles can be found here:\r\n * https://github.com/immersive-web/webxr-input-profiles/tree/master/packages/registry/profiles\r\n */\r\nexport interface IMotionControllerProfile {\r\n /**\r\n * fallback profiles for this profileId\r\n */\r\n fallbackProfileIds: string[];\r\n /**\r\n * The layout map, with handedness as key\r\n */\r\n layouts: IMotionControllerLayoutMap;\r\n /**\r\n * The id of this profile\r\n * correlates to the profile(s) in the xrInput.profiles array\r\n */\r\n profileId: string;\r\n}\r\n\r\n/**\r\n * A helper-interface for the 3 meshes needed for controller button animation\r\n * The meshes are provided to the _lerpButtonTransform function to calculate the current position of the value mesh\r\n */\r\nexport interface IMotionControllerButtonMeshMap {\r\n /**\r\n * the mesh that defines the pressed value mesh position.\r\n * This is used to find the max-position of this button\r\n */\r\n pressedMesh: AbstractMesh;\r\n /**\r\n * the mesh that defines the unpressed value mesh position.\r\n * This is used to find the min (or initial) position of this button\r\n */\r\n unpressedMesh: AbstractMesh;\r\n /**\r\n * The mesh that will be changed when value changes\r\n */\r\n valueMesh: AbstractMesh;\r\n}\r\n\r\n/**\r\n * A helper-interface for the 3 meshes needed for controller axis animation.\r\n * This will be expanded when touchpad animations are fully supported\r\n * The meshes are provided to the _lerpAxisTransform function to calculate the current position of the value mesh\r\n */\r\nexport interface IMotionControllerMeshMap {\r\n /**\r\n * the mesh that defines the maximum value mesh position.\r\n */\r\n maxMesh?: AbstractMesh;\r\n /**\r\n * the mesh that defines the minimum value mesh position.\r\n */\r\n minMesh?: AbstractMesh;\r\n /**\r\n * The mesh that will be changed when axis value changes\r\n */\r\n valueMesh?: AbstractMesh;\r\n}\r\n\r\n/**\r\n * The elements needed for change-detection of the gamepad objects in motion controllers\r\n */\r\nexport interface IMinimalMotionControllerObject {\r\n /**\r\n * Available axes of this controller\r\n */\r\n axes: number[];\r\n /**\r\n * An array of available buttons\r\n */\r\n buttons: Array<{\r\n /**\r\n * Value of the button/trigger\r\n */\r\n value: number;\r\n /**\r\n * If the button/trigger is currently touched\r\n */\r\n touched: boolean;\r\n /**\r\n * If the button/trigger is currently pressed\r\n */\r\n pressed: boolean;\r\n }>;\r\n\r\n /**\r\n * EXPERIMENTAL haptic support.\r\n */\r\n hapticActuators?: Array<{\r\n pulse: (value: number, duration: number) => Promise<boolean>;\r\n }>;\r\n}\r\n\r\n/**\r\n * An Abstract Motion controller\r\n * This class receives an xrInput and a profile layout and uses those to initialize the components\r\n * Each component has an observable to check for changes in value and state\r\n */\r\nexport abstract class WebXRAbstractMotionController implements IDisposable {\r\n private _initComponent = (id: string) => {\r\n if (!id) {\r\n return;\r\n }\r\n const componentDef = this.layout.components[id];\r\n const type = componentDef.type;\r\n const buttonIndex = componentDef.gamepadIndices.button;\r\n // search for axes\r\n const axes: number[] = [];\r\n if (componentDef.gamepadIndices.xAxis !== undefined && componentDef.gamepadIndices.yAxis !== undefined) {\r\n axes.push(componentDef.gamepadIndices.xAxis, componentDef.gamepadIndices.yAxis);\r\n }\r\n\r\n this.components[id] = new WebXRControllerComponent(id, type, buttonIndex, axes);\r\n };\r\n\r\n private _modelReady: boolean = false;\r\n\r\n /**\r\n * A map of components (WebXRControllerComponent) in this motion controller\r\n * Components have a ComponentType and can also have both button and axis definitions\r\n */\r\n public readonly components: {\r\n [id: string]: WebXRControllerComponent;\r\n } = {};\r\n\r\n /**\r\n * Disable the model's animation. Can be set at any time.\r\n */\r\n public disableAnimation: boolean = false;\r\n /**\r\n * Observers registered here will be triggered when the model of this controller is done loading\r\n */\r\n public onModelLoadedObservable: Observable<WebXRAbstractMotionController> = new Observable();\r\n /**\r\n * The profile id of this motion controller\r\n */\r\n public abstract profileId: string;\r\n /**\r\n * The root mesh of the model. It is null if the model was not yet initialized\r\n */\r\n public rootMesh: Nullable<AbstractMesh>;\r\n\r\n /**\r\n * constructs a new abstract motion controller\r\n * @param scene the scene to which the model of the controller will be added\r\n * @param layout The profile layout to load\r\n * @param gamepadObject The gamepad object correlating to this controller\r\n * @param handedness handedness (left/right/none) of this controller\r\n * @param _doNotLoadControllerMesh set this flag to ignore the mesh loading\r\n * @param _controllerCache a cache holding controller models already loaded in this session\r\n */\r\n constructor(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected scene: Scene,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected layout: IMotionControllerLayout,\r\n /**\r\n * The gamepad object correlating to this controller\r\n */\r\n public gamepadObject: IMinimalMotionControllerObject,\r\n /**\r\n * handedness (left/right/none) of this controller\r\n */\r\n public handedness: MotionControllerHandedness,\r\n /**\r\n * @hidden\r\n */\r\n public _doNotLoadControllerMesh: boolean = false,\r\n private _controllerCache?: Array<{\r\n filename: string;\r\n path: string;\r\n meshes: AbstractMesh[];\r\n }>\r\n ) {\r\n // initialize the components\r\n if (layout.components) {\r\n Object.keys(layout.components).forEach(this._initComponent);\r\n }\r\n // Model is loaded in WebXRInput\r\n }\r\n\r\n /**\r\n * Dispose this controller, the model mesh and all its components\r\n */\r\n public dispose(): void {\r\n this.getComponentIds().forEach((id) => this.getComponent(id).dispose());\r\n if (this.rootMesh) {\r\n this.rootMesh.getChildren(undefined, true).forEach((node) => {\r\n node.setEnabled(false);\r\n });\r\n this.rootMesh.dispose(!!this._controllerCache, !this._controllerCache);\r\n }\r\n }\r\n\r\n /**\r\n * Returns all components of specific type\r\n * @param type the type to search for\r\n * @return an array of components with this type\r\n */\r\n public getAllComponentsOfType(type: MotionControllerComponentType): WebXRControllerComponent[] {\r\n return this.getComponentIds()\r\n .map((id) => this.components[id])\r\n .filter((component) => component.type === type);\r\n }\r\n\r\n /**\r\n * get a component based an its component id as defined in layout.components\r\n * @param id the id of the component\r\n * @returns the component correlates to the id or undefined if not found\r\n */\r\n public getComponent(id: string): WebXRControllerComponent {\r\n return this.components[id];\r\n }\r\n\r\n /**\r\n * Get the list of components available in this motion controller\r\n * @returns an array of strings correlating to available components\r\n */\r\n public getComponentIds(): string[] {\r\n return Object.keys(this.components);\r\n }\r\n\r\n /**\r\n * Get the first component of specific type\r\n * @param type type of component to find\r\n * @return a controller component or null if not found\r\n */\r\n public getComponentOfType(type: MotionControllerComponentType): Nullable<WebXRControllerComponent> {\r\n return this.getAllComponentsOfType(type)[0] || null;\r\n }\r\n\r\n /**\r\n * Get the main (Select) component of this controller as defined in the layout\r\n * @returns the main component of this controller\r\n */\r\n public getMainComponent(): WebXRControllerComponent {\r\n return this.getComponent(this.layout.selectComponentId);\r\n }\r\n\r\n /**\r\n * Loads the model correlating to this controller\r\n * When the mesh is loaded, the onModelLoadedObservable will be triggered\r\n * @returns A promise fulfilled with the result of the model loading\r\n */\r\n public async loadModel(): Promise<boolean> {\r\n const useGeneric = !this._getModelLoadingConstraints();\r\n let loadingParams = this._getGenericFilenameAndPath();\r\n // Checking if GLB loader is present\r\n if (useGeneric) {\r\n Logger.Warn(\"Falling back to generic models\");\r\n } else {\r\n loadingParams = this._getFilenameAndPath();\r\n }\r\n return new Promise((resolve, reject) => {\r\n const meshesLoaded = (meshes: AbstractMesh[]) => {\r\n if (useGeneric) {\r\n this._getGenericParentMesh(meshes);\r\n } else {\r\n this._setRootMesh(meshes);\r\n }\r\n this._processLoadedModel(meshes);\r\n this._modelReady = true;\r\n this.onModelLoadedObservable.notifyObservers(this);\r\n resolve(true);\r\n };\r\n if (this._controllerCache) {\r\n // look for it in the cache\r\n const found = this._controllerCache.filter((c) => {\r\n return c.filename === loadingParams.filename && c.path === loadingParams.path;\r\n });\r\n if (found[0]) {\r\n found[0].meshes.forEach((mesh) => mesh.setEnabled(true));\r\n meshesLoaded(found[0].meshes);\r\n return;\r\n // found, don't continue to load\r\n }\r\n }\r\n SceneLoader.ImportMesh(\r\n \"\",\r\n loadingParams.path,\r\n loadingParams.filename,\r\n this.scene,\r\n (meshes) => {\r\n if (this._controllerCache) {\r\n this._controllerCache.push({\r\n ...loadingParams,\r\n meshes,\r\n });\r\n }\r\n meshesLoaded(meshes);\r\n },\r\n null,\r\n (_scene: Scene, message: string) => {\r\n Logger.Log(message);\r\n Logger.Warn(`Failed to retrieve controller model of type ${this.profileId} from the remote server: ${loadingParams.path}${loadingParams.filename}`);\r\n reject(message);\r\n }\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Update this model using the current XRFrame\r\n * @param xrFrame the current xr frame to use and update the model\r\n */\r\n public updateFromXRFrame(xrFrame: XRFrame): void {\r\n this.getComponentIds().forEach((id) => this.getComponent(id).update(this.gamepadObject));\r\n this.updateModel(xrFrame);\r\n }\r\n\r\n /**\r\n * Backwards compatibility due to a deeply-integrated typo\r\n */\r\n public get handness() {\r\n return this.handedness;\r\n }\r\n\r\n /**\r\n * Pulse (vibrate) this controller\r\n * If the controller does not support pulses, this function will fail silently and return Promise<false> directly after called\r\n * Consecutive calls to this function will cancel the last pulse call\r\n *\r\n * @param value the strength of the pulse in 0.0...1.0 range\r\n * @param duration Duration of the pulse in milliseconds\r\n * @param hapticActuatorIndex optional index of actuator (will usually be 0)\r\n * @returns a promise that will send true when the pulse has ended and false if the device doesn't support pulse or an error accrued\r\n */\r\n public pulse(value: number, duration: number, hapticActuatorIndex: number = 0): Promise<boolean> {\r\n if (this.gamepadObject.hapticActuators && this.gamepadObject.hapticActuators[hapticActuatorIndex]) {\r\n return this.gamepadObject.hapticActuators[hapticActuatorIndex].pulse(value, duration);\r\n } else {\r\n return Promise.resolve(false);\r\n }\r\n }\r\n\r\n // Look through all children recursively. This will return null if no mesh exists with the given name.\r\n protected _getChildByName(node: AbstractMesh, name: string): AbstractMesh | undefined {\r\n return <AbstractMesh | undefined>node.getChildren((n) => n.name === name, false)[0];\r\n }\r\n\r\n // Look through only immediate children. This will return null if no mesh exists with the given name.\r\n protected _getImmediateChildByName(node: AbstractMesh, name: string): AbstractMesh | undefined {\r\n return <AbstractMesh | undefined>node.getChildren((n) => n.name == name, true)[0];\r\n }\r\n\r\n /**\r\n * Moves the axis on the controller mesh based on its current state\r\n * @param axisMap\r\n * @param axisValue the value of the axis which determines the meshes new position\r\n * @param fixValueCoordinates\r\n * @hidden\r\n */\r\n protected _lerpTransform(axisMap: IMotionControllerMeshMap, axisValue: number, fixValueCoordinates?: boolean): void {\r\n if (!axisMap.minMesh || !axisMap.maxMesh || !axisMap.valueMesh) {\r\n return;\r\n }\r\n\r\n if (!axisMap.minMesh.rotationQuaternion || !axisMap.maxMesh.rotationQuaternion || !axisMap.valueMesh.rotationQuaternion) {\r\n return;\r\n }\r\n\r\n // Convert from gamepad value range (-1 to +1) to lerp range (0 to 1)\r\n const lerpValue = fixValueCoordinates ? axisValue * 0.5 + 0.5 : axisValue;\r\n Quaternion.SlerpToRef(axisMap.minMesh.rotationQuaternion, axisMap.maxMesh.rotationQuaternion, lerpValue, axisMap.valueMesh.rotationQuaternion);\r\n Vector3.LerpToRef(axisMap.minMesh.position, axisMap.maxMesh.position, lerpValue, axisMap.valueMesh.position);\r\n }\r\n\r\n /**\r\n * Update the model itself with the current frame data\r\n * @param xrFrame the frame to use for updating the model mesh\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected updateModel(xrFrame: XRFrame): void {\r\n if (!this._modelReady) {\r\n return;\r\n }\r\n this._updateModel(xrFrame);\r\n }\r\n\r\n /**\r\n * Get the filename and path for this controller's model\r\n * @returns a map of filename and path\r\n */\r\n protected abstract _getFilenameAndPath(): { filename: string; path: string };\r\n /**\r\n * This function is called before the mesh is loaded. It checks for loading constraints.\r\n * For example, this function can check if the GLB loader is available\r\n * If this function returns false, the generic controller will be loaded instead\r\n * @returns Is the client ready to load the mesh\r\n */\r\n protected abstract _getModelLoadingConstraints(): boolean;\r\n /**\r\n * This function will be called after the model was successfully loaded and can be used\r\n * for mesh transformations before it is available for the user\r\n * @param meshes the loaded meshes\r\n */\r\n protected abstract _processLoadedModel(meshes: AbstractMesh[]): void;\r\n /**\r\n * Set the root mesh for this controller. Important for the WebXR controller class\r\n * @param meshes the loaded meshes\r\n */\r\n protected abstract _setRootMesh(meshes: AbstractMesh[]): void;\r\n /**\r\n * A function executed each frame that updates the mesh (if needed)\r\n * @param xrFrame the current xrFrame\r\n */\r\n protected abstract _updateModel(xrFrame: XRFrame): void;\r\n\r\n private _getGenericFilenameAndPath(): { filename: string; path: string } {\r\n return {\r\n filename: \"generic.babylon\",\r\n path: \"https://controllers.babylonjs.com/generic/\",\r\n };\r\n }\r\n\r\n private _getGenericParentMesh(meshes: AbstractMesh[]): void {\r\n this.rootMesh = new Mesh(this.profileId + \" \" + this.handedness, this.scene);\r\n\r\n meshes.forEach((mesh) => {\r\n if (!mesh.parent) {\r\n mesh.isPickable = false;\r\n mesh.setParent(this.rootMesh);\r\n }\r\n });\r\n\r\n this.rootMesh.rotationQuaternion = Quaternion.FromEulerAngles(0, Math.PI, 0);\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"webXRAbstractMotionController.js","sourceRoot":"","sources":["../../../../../../lts/core/generated/XR/motionController/webXRAbstractMotionController.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAyNzC;;;;GAIG;AACH,MAAM,OAAgB,6BAA6B;IA4C/C;;;;;;;;OAQG;IACH;IACI,gEAAgE;IACtD,KAAY;IACtB,gEAAgE;IACtD,MAA+B;IACzC;;OAEG;IACI,aAA6C;IACpD;;OAEG;IACI,UAAsC;IAC7C;;OAEG;IACI,2BAAoC,KAAK,EACxC,gBAIN;QAnBQ,UAAK,GAAL,KAAK,CAAO;QAEZ,WAAM,GAAN,MAAM,CAAyB;QAIlC,kBAAa,GAAb,aAAa,CAAgC;QAI7C,eAAU,GAAV,UAAU,CAA4B;QAItC,6BAAwB,GAAxB,wBAAwB,CAAiB;QACxC,qBAAgB,GAAhB,gBAAgB,CAItB;QAzEE,mBAAc,GAAG,CAAC,EAAU,EAAE,EAAE;YACpC,IAAI,CAAC,EAAE,EAAE;gBACL,OAAO;aACV;YACD,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YAChD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC;YAC/B,MAAM,WAAW,GAAG,YAAY,CAAC,cAAc,CAAC,MAAM,CAAC;YACvD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B,CAAC;IA+BO,0BAA0B;QAC9B,OAAO;YACH,QAAQ,EAAE,iBAAiB;YAC3B,IAAI,EAAE,4CAA4C;SACrD,CAAC;IACN,CAAC;IAEO,qBAAqB,CAAC,MAAsB;QAChD,IAAI,CAAC,QAAQ,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;QAE7E,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACpB,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;gBACd,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;gBACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;aACjC;QACL,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,kBAAkB,GAAG,UAAU,CAAC,eAAe,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACjF,CAAC;CACJ","sourcesContent":["import type { IDisposable, Scene } from \"../../scene\";\r\nimport { WebXRControllerComponent } from \"./webXRControllerComponent\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Logger } from \"../../Misc/logger\";\r\nimport { SceneLoader } from \"../../Loading/sceneLoader\";\r\nimport type { AbstractMesh } from \"../../Meshes/abstractMesh\";\r\nimport type { Nullable } from \"../../types\";\r\nimport { Quaternion, Vector3 } from \"../../Maths/math.vector\";\r\nimport { Mesh } from \"../../Meshes/mesh\";\r\n\r\n/**\r\n * Handedness type in xrInput profiles. These can be used to define layouts in the Layout Map.\r\n */\r\nexport type MotionControllerHandedness = \"none\" | \"left\" | \"right\";\r\n/**\r\n * The type of components available in motion controllers.\r\n * This is not the name of the component.\r\n */\r\nexport type MotionControllerComponentType = \"trigger\" | \"squeeze\" | \"touchpad\" | \"thumbstick\" | \"button\";\r\n\r\n/**\r\n * The state of a controller component\r\n */\r\nexport type MotionControllerComponentStateType = \"default\" | \"touched\" | \"pressed\";\r\n\r\n/**\r\n * The schema of motion controller layout.\r\n * No object will be initialized using this interface\r\n * This is used just to define the profile.\r\n */\r\nexport interface IMotionControllerLayout {\r\n /**\r\n * Path to load the assets. Usually relative to the base path\r\n */\r\n assetPath: string;\r\n /**\r\n * Available components (unsorted)\r\n */\r\n components: {\r\n /**\r\n * A map of component Ids\r\n */\r\n [componentId: string]: {\r\n /**\r\n * The type of input the component outputs\r\n */\r\n type: MotionControllerComponentType;\r\n /**\r\n * The indices of this component in the gamepad object\r\n */\r\n gamepadIndices: {\r\n /**\r\n * Index of button\r\n */\r\n button?: number;\r\n /**\r\n * If available, index of x-axis\r\n */\r\n xAxis?: number;\r\n /**\r\n * If available, index of y-axis\r\n */\r\n yAxis?: number;\r\n };\r\n /**\r\n * The mesh's root node name\r\n */\r\n rootNodeName: string;\r\n /**\r\n * Animation definitions for this model\r\n */\r\n visualResponses: {\r\n [stateKey: string]: {\r\n /**\r\n * What property will be animated\r\n */\r\n componentProperty: \"xAxis\" | \"yAxis\" | \"button\" | \"state\";\r\n /**\r\n * What states influence this visual response\r\n */\r\n states: MotionControllerComponentStateType[];\r\n /**\r\n * Type of animation - movement or visibility\r\n */\r\n valueNodeProperty: \"transform\" | \"visibility\";\r\n /**\r\n * Base node name to move. Its position will be calculated according to the min and max nodes\r\n */\r\n valueNodeName?: string;\r\n /**\r\n * Minimum movement node\r\n */\r\n minNodeName?: string;\r\n /**\r\n * Max movement node\r\n */\r\n maxNodeName?: string;\r\n };\r\n };\r\n /**\r\n * If touch enabled, what is the name of node to display user feedback\r\n */\r\n touchPointNodeName?: string;\r\n };\r\n };\r\n /**\r\n * Is it xr standard mapping or not\r\n */\r\n gamepadMapping: \"\" | \"xr-standard\";\r\n /**\r\n * Base root node of this entire model\r\n */\r\n rootNodeName: string;\r\n /**\r\n * Defines the main button component id\r\n */\r\n selectComponentId: string;\r\n}\r\n\r\n/**\r\n * A definition for the layout map in the input profile\r\n */\r\nexport interface IMotionControllerLayoutMap {\r\n /**\r\n * Layouts with handedness type as a key\r\n */\r\n [handedness: string /* handedness */]: IMotionControllerLayout;\r\n}\r\n\r\n/**\r\n * The XR Input profile schema\r\n * Profiles can be found here:\r\n * https://github.com/immersive-web/webxr-input-profiles/tree/master/packages/registry/profiles\r\n */\r\nexport interface IMotionControllerProfile {\r\n /**\r\n * fallback profiles for this profileId\r\n */\r\n fallbackProfileIds: string[];\r\n /**\r\n * The layout map, with handedness as key\r\n */\r\n layouts: IMotionControllerLayoutMap;\r\n /**\r\n * The id of this profile\r\n * correlates to the profile(s) in the xrInput.profiles array\r\n */\r\n profileId: string;\r\n}\r\n\r\n/**\r\n * A helper-interface for the 3 meshes needed for controller button animation\r\n * The meshes are provided to the _lerpButtonTransform function to calculate the current position of the value mesh\r\n */\r\nexport interface IMotionControllerButtonMeshMap {\r\n /**\r\n * the mesh that defines the pressed value mesh position.\r\n * This is used to find the max-position of this button\r\n */\r\n pressedMesh: AbstractMesh;\r\n /**\r\n * the mesh that defines the unpressed value mesh position.\r\n * This is used to find the min (or initial) position of this button\r\n */\r\n unpressedMesh: AbstractMesh;\r\n /**\r\n * The mesh that will be changed when value changes\r\n */\r\n valueMesh: AbstractMesh;\r\n}\r\n\r\n/**\r\n * A helper-interface for the 3 meshes needed for controller axis animation.\r\n * This will be expanded when touchpad animations are fully supported\r\n * The meshes are provided to the _lerpAxisTransform function to calculate the current position of the value mesh\r\n */\r\nexport interface IMotionControllerMeshMap {\r\n /**\r\n * the mesh that defines the maximum value mesh position.\r\n */\r\n maxMesh?: AbstractMesh;\r\n /**\r\n * the mesh that defines the minimum value mesh position.\r\n */\r\n minMesh?: AbstractMesh;\r\n /**\r\n * The mesh that will be changed when axis value changes\r\n */\r\n valueMesh?: AbstractMesh;\r\n}\r\n\r\n/**\r\n * The elements needed for change-detection of the gamepad objects in motion controllers\r\n */\r\nexport interface IMinimalMotionControllerObject {\r\n /**\r\n * Available axes of this controller\r\n */\r\n axes: number[];\r\n /**\r\n * An array of available buttons\r\n */\r\n buttons: Array<{\r\n /**\r\n * Value of the button/trigger\r\n */\r\n value: number;\r\n /**\r\n * If the button/trigger is currently touched\r\n */\r\n touched: boolean;\r\n /**\r\n * If the button/trigger is currently pressed\r\n */\r\n pressed: boolean;\r\n }>;\r\n\r\n /**\r\n * EXPERIMENTAL haptic support.\r\n */\r\n hapticActuators?: Array<{\r\n pulse: (value: number, duration: number) => Promise<boolean>;\r\n }>;\r\n}\r\n\r\n/**\r\n * An Abstract Motion controller\r\n * This class receives an xrInput and a profile layout and uses those to initialize the components\r\n * Each component has an observable to check for changes in value and state\r\n */\r\nexport abstract class WebXRAbstractMotionController implements IDisposable {\r\n private _initComponent = (id: string) => {\r\n if (!id) {\r\n return;\r\n }\r\n const componentDef = this.layout.components[id];\r\n const type = componentDef.type;\r\n const buttonIndex = componentDef.gamepadIndices.button;\r\n // search for axes\r\n const axes: number[] = [];\r\n if (componentDef.gamepadIndices.xAxis !== undefined && componentDef.gamepadIndices.yAxis !== undefined) {\r\n axes.push(componentDef.gamepadIndices.xAxis, componentDef.gamepadIndices.yAxis);\r\n }\r\n\r\n this.components[id] = new WebXRControllerComponent(id, type, buttonIndex, axes);\r\n };\r\n\r\n private _modelReady: boolean = false;\r\n\r\n /**\r\n * A map of components (WebXRControllerComponent) in this motion controller\r\n * Components have a ComponentType and can also have both button and axis definitions\r\n */\r\n public readonly components: {\r\n [id: string]: WebXRControllerComponent;\r\n } = {};\r\n\r\n /**\r\n * Disable the model's animation. Can be set at any time.\r\n */\r\n public disableAnimation: boolean = false;\r\n /**\r\n * Observers registered here will be triggered when the model of this controller is done loading\r\n */\r\n public onModelLoadedObservable: Observable<WebXRAbstractMotionController> = new Observable();\r\n /**\r\n * The profile id of this motion controller\r\n */\r\n public abstract profileId: string;\r\n /**\r\n * The root mesh of the model. It is null if the model was not yet initialized\r\n */\r\n public rootMesh: Nullable<AbstractMesh>;\r\n\r\n /**\r\n * constructs a new abstract motion controller\r\n * @param scene the scene to which the model of the controller will be added\r\n * @param layout The profile layout to load\r\n * @param gamepadObject The gamepad object correlating to this controller\r\n * @param handedness handedness (left/right/none) of this controller\r\n * @param _doNotLoadControllerMesh set this flag to ignore the mesh loading\r\n * @param _controllerCache a cache holding controller models already loaded in this session\r\n */\r\n constructor(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected scene: Scene,\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected layout: IMotionControllerLayout,\r\n /**\r\n * The gamepad object correlating to this controller\r\n */\r\n public gamepadObject: IMinimalMotionControllerObject,\r\n /**\r\n * handedness (left/right/none) of this controller\r\n */\r\n public handedness: MotionControllerHandedness,\r\n /**\r\n * @hidden\r\n */\r\n public _doNotLoadControllerMesh: boolean = false,\r\n private _controllerCache?: Array<{\r\n filename: string;\r\n path: string;\r\n meshes: AbstractMesh[];\r\n }>\r\n ) {\r\n // initialize the components\r\n if (layout.components) {\r\n Object.keys(layout.components).forEach(this._initComponent);\r\n }\r\n // Model is loaded in WebXRInput\r\n }\r\n\r\n /**\r\n * Dispose this controller, the model mesh and all its components\r\n */\r\n public dispose(): void {\r\n this.getComponentIds().forEach((id) => this.getComponent(id).dispose());\r\n if (this.rootMesh) {\r\n this.rootMesh.getChildren(undefined, true).forEach((node) => {\r\n node.setEnabled(false);\r\n });\r\n this.rootMesh.dispose(!!this._controllerCache, !this._controllerCache);\r\n }\r\n }\r\n\r\n /**\r\n * Returns all components of specific type\r\n * @param type the type to search for\r\n * @returns an array of components with this type\r\n */\r\n public getAllComponentsOfType(type: MotionControllerComponentType): WebXRControllerComponent[] {\r\n return this.getComponentIds()\r\n .map((id) => this.components[id])\r\n .filter((component) => component.type === type);\r\n }\r\n\r\n /**\r\n * get a component based an its component id as defined in layout.components\r\n * @param id the id of the component\r\n * @returns the component correlates to the id or undefined if not found\r\n */\r\n public getComponent(id: string): WebXRControllerComponent {\r\n return this.components[id];\r\n }\r\n\r\n /**\r\n * Get the list of components available in this motion controller\r\n * @returns an array of strings correlating to available components\r\n */\r\n public getComponentIds(): string[] {\r\n return Object.keys(this.components);\r\n }\r\n\r\n /**\r\n * Get the first component of specific type\r\n * @param type type of component to find\r\n * @returns a controller component or null if not found\r\n */\r\n public getComponentOfType(type: MotionControllerComponentType): Nullable<WebXRControllerComponent> {\r\n return this.getAllComponentsOfType(type)[0] || null;\r\n }\r\n\r\n /**\r\n * Get the main (Select) component of this controller as defined in the layout\r\n * @returns the main component of this controller\r\n */\r\n public getMainComponent(): WebXRControllerComponent {\r\n return this.getComponent(this.layout.selectComponentId);\r\n }\r\n\r\n /**\r\n * Loads the model correlating to this controller\r\n * When the mesh is loaded, the onModelLoadedObservable will be triggered\r\n * @returns A promise fulfilled with the result of the model loading\r\n */\r\n public async loadModel(): Promise<boolean> {\r\n const useGeneric = !this._getModelLoadingConstraints();\r\n let loadingParams = this._getGenericFilenameAndPath();\r\n // Checking if GLB loader is present\r\n if (useGeneric) {\r\n Logger.Warn(\"Falling back to generic models\");\r\n } else {\r\n loadingParams = this._getFilenameAndPath();\r\n }\r\n return new Promise((resolve, reject) => {\r\n const meshesLoaded = (meshes: AbstractMesh[]) => {\r\n if (useGeneric) {\r\n this._getGenericParentMesh(meshes);\r\n } else {\r\n this._setRootMesh(meshes);\r\n }\r\n this._processLoadedModel(meshes);\r\n this._modelReady = true;\r\n this.onModelLoadedObservable.notifyObservers(this);\r\n resolve(true);\r\n };\r\n if (this._controllerCache) {\r\n // look for it in the cache\r\n const found = this._controllerCache.filter((c) => {\r\n return c.filename === loadingParams.filename && c.path === loadingParams.path;\r\n });\r\n if (found[0]) {\r\n found[0].meshes.forEach((mesh) => mesh.setEnabled(true));\r\n meshesLoaded(found[0].meshes);\r\n return;\r\n // found, don't continue to load\r\n }\r\n }\r\n SceneLoader.ImportMesh(\r\n \"\",\r\n loadingParams.path,\r\n loadingParams.filename,\r\n this.scene,\r\n (meshes) => {\r\n if (this._controllerCache) {\r\n this._controllerCache.push({\r\n ...loadingParams,\r\n meshes,\r\n });\r\n }\r\n meshesLoaded(meshes);\r\n },\r\n null,\r\n (_scene: Scene, message: string) => {\r\n Logger.Log(message);\r\n Logger.Warn(`Failed to retrieve controller model of type ${this.profileId} from the remote server: ${loadingParams.path}${loadingParams.filename}`);\r\n reject(message);\r\n }\r\n );\r\n });\r\n }\r\n\r\n /**\r\n * Update this model using the current XRFrame\r\n * @param xrFrame the current xr frame to use and update the model\r\n */\r\n public updateFromXRFrame(xrFrame: XRFrame): void {\r\n this.getComponentIds().forEach((id) => this.getComponent(id).update(this.gamepadObject));\r\n this.updateModel(xrFrame);\r\n }\r\n\r\n /**\r\n * Backwards compatibility due to a deeply-integrated typo\r\n */\r\n public get handness() {\r\n return this.handedness;\r\n }\r\n\r\n /**\r\n * Pulse (vibrate) this controller\r\n * If the controller does not support pulses, this function will fail silently and return Promise<false> directly after called\r\n * Consecutive calls to this function will cancel the last pulse call\r\n *\r\n * @param value the strength of the pulse in 0.0...1.0 range\r\n * @param duration Duration of the pulse in milliseconds\r\n * @param hapticActuatorIndex optional index of actuator (will usually be 0)\r\n * @returns a promise that will send true when the pulse has ended and false if the device doesn't support pulse or an error accrued\r\n */\r\n public pulse(value: number, duration: number, hapticActuatorIndex: number = 0): Promise<boolean> {\r\n if (this.gamepadObject.hapticActuators && this.gamepadObject.hapticActuators[hapticActuatorIndex]) {\r\n return this.gamepadObject.hapticActuators[hapticActuatorIndex].pulse(value, duration);\r\n } else {\r\n return Promise.resolve(false);\r\n }\r\n }\r\n\r\n // Look through all children recursively. This will return null if no mesh exists with the given name.\r\n protected _getChildByName(node: AbstractMesh, name: string): AbstractMesh | undefined {\r\n return <AbstractMesh | undefined>node.getChildren((n) => n.name === name, false)[0];\r\n }\r\n\r\n // Look through only immediate children. This will return null if no mesh exists with the given name.\r\n protected _getImmediateChildByName(node: AbstractMesh, name: string): AbstractMesh | undefined {\r\n return <AbstractMesh | undefined>node.getChildren((n) => n.name == name, true)[0];\r\n }\r\n\r\n /**\r\n * Moves the axis on the controller mesh based on its current state\r\n * @param axisMap\r\n * @param axisValue the value of the axis which determines the meshes new position\r\n * @param fixValueCoordinates\r\n * @hidden\r\n */\r\n protected _lerpTransform(axisMap: IMotionControllerMeshMap, axisValue: number, fixValueCoordinates?: boolean): void {\r\n if (!axisMap.minMesh || !axisMap.maxMesh || !axisMap.valueMesh) {\r\n return;\r\n }\r\n\r\n if (!axisMap.minMesh.rotationQuaternion || !axisMap.maxMesh.rotationQuaternion || !axisMap.valueMesh.rotationQuaternion) {\r\n return;\r\n }\r\n\r\n // Convert from gamepad value range (-1 to +1) to lerp range (0 to 1)\r\n const lerpValue = fixValueCoordinates ? axisValue * 0.5 + 0.5 : axisValue;\r\n Quaternion.SlerpToRef(axisMap.minMesh.rotationQuaternion, axisMap.maxMesh.rotationQuaternion, lerpValue, axisMap.valueMesh.rotationQuaternion);\r\n Vector3.LerpToRef(axisMap.minMesh.position, axisMap.maxMesh.position, lerpValue, axisMap.valueMesh.position);\r\n }\r\n\r\n /**\r\n * Update the model itself with the current frame data\r\n * @param xrFrame the frame to use for updating the model mesh\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n protected updateModel(xrFrame: XRFrame): void {\r\n if (!this._modelReady) {\r\n return;\r\n }\r\n this._updateModel(xrFrame);\r\n }\r\n\r\n /**\r\n * Get the filename and path for this controller's model\r\n * @returns a map of filename and path\r\n */\r\n protected abstract _getFilenameAndPath(): { filename: string; path: string };\r\n /**\r\n * This function is called before the mesh is loaded. It checks for loading constraints.\r\n * For example, this function can check if the GLB loader is available\r\n * If this function returns false, the generic controller will be loaded instead\r\n * @returns Is the client ready to load the mesh\r\n */\r\n protected abstract _getModelLoadingConstraints(): boolean;\r\n /**\r\n * This function will be called after the model was successfully loaded and can be used\r\n * for mesh transformations before it is available for the user\r\n * @param meshes the loaded meshes\r\n */\r\n protected abstract _processLoadedModel(meshes: AbstractMesh[]): void;\r\n /**\r\n * Set the root mesh for this controller. Important for the WebXR controller class\r\n * @param meshes the loaded meshes\r\n */\r\n protected abstract _setRootMesh(meshes: AbstractMesh[]): void;\r\n /**\r\n * A function executed each frame that updates the mesh (if needed)\r\n * @param xrFrame the current xrFrame\r\n */\r\n protected abstract _updateModel(xrFrame: XRFrame): void;\r\n\r\n private _getGenericFilenameAndPath(): { filename: string; path: string } {\r\n return {\r\n filename: \"generic.babylon\",\r\n path: \"https://controllers.babylonjs.com/generic/\",\r\n };\r\n }\r\n\r\n private _getGenericParentMesh(meshes: AbstractMesh[]): void {\r\n this.rootMesh = new Mesh(this.profileId + \" \" + this.handedness, this.scene);\r\n\r\n meshes.forEach((mesh) => {\r\n if (!mesh.parent) {\r\n mesh.isPickable = false;\r\n mesh.setParent(this.rootMesh);\r\n }\r\n });\r\n\r\n this.rootMesh.rotationQuaternion = Quaternion.FromEulerAngles(0, Math.PI, 0);\r\n }\r\n}\r\n"]}
|
|
@@ -149,7 +149,7 @@ export declare class WebXRControllerComponent implements IDisposable {
|
|
|
149
149
|
dispose(): void;
|
|
150
150
|
/**
|
|
151
151
|
* Are there axes correlating to this component
|
|
152
|
-
* @
|
|
152
|
+
* @returns true is axes data is available
|
|
153
153
|
*/
|
|
154
154
|
isAxes(): boolean;
|
|
155
155
|
/**
|