@needle-tools/engine 4.13.0 → 4.13.1-beta
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/CHANGELOG.md +2 -1
- package/README.md +37 -0
- package/components.needle.json +1 -1
- package/custom-elements.json +138 -4
- package/dist/{needle-engine.bundle-CxaKFQVS.min.js → needle-engine.bundle-6774fXoY.min.js} +107 -107
- package/dist/{needle-engine.bundle-Dl3TFYyv.js → needle-engine.bundle-CGtsEhyJ.js} +2346 -1844
- package/dist/{needle-engine.bundle-J4k4znv8.umd.cjs → needle-engine.bundle-fbFZTOKP.umd.cjs} +108 -108
- package/dist/needle-engine.d.ts +3769 -397
- package/dist/needle-engine.js +2 -2
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/lib/engine/engine_context.d.ts +16 -0
- package/lib/engine/engine_context.js +16 -0
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_gameobject.d.ts +72 -0
- package/lib/engine/engine_gameobject.js +38 -0
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_input.d.ts +80 -4
- package/lib/engine/engine_input.js +78 -2
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_math.d.ts +81 -2
- package/lib/engine/engine_math.js +68 -2
- package/lib/engine/engine_math.js.map +1 -1
- package/lib/engine/engine_networking.d.ts +181 -14
- package/lib/engine/engine_networking.js +181 -14
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking_auto.d.ts +35 -8
- package/lib/engine/engine_networking_auto.js +35 -8
- package/lib/engine/engine_networking_auto.js.map +1 -1
- package/lib/engine/engine_physics.d.ts +35 -1
- package/lib/engine/engine_physics.js +35 -1
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +76 -0
- package/lib/engine/engine_physics_rapier.js +76 -0
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_serialization_decorator.d.ts +28 -2
- package/lib/engine/engine_serialization_decorator.js +28 -2
- package/lib/engine/engine_serialization_decorator.js.map +1 -1
- package/lib/engine/engine_time.d.ts +23 -3
- package/lib/engine/engine_time.js +23 -3
- package/lib/engine/engine_time.js.map +1 -1
- package/lib/engine/engine_util_decorator.d.ts +31 -1
- package/lib/engine/engine_util_decorator.js +31 -1
- package/lib/engine/engine_util_decorator.js.map +1 -1
- package/lib/engine/engine_utils.d.ts +21 -5
- package/lib/engine/engine_utils.js +21 -5
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_materialx.d.ts +2 -2
- package/lib/engine/extensions/NEEDLE_materialx.js +2 -2
- package/lib/engine/extensions/NEEDLE_materialx.js.map +1 -1
- package/lib/engine/extensions/index.d.ts +1 -1
- package/lib/engine/extensions/index.js +1 -1
- package/lib/engine/extensions/index.js.map +1 -1
- package/lib/engine-components/AlignmentConstraint.d.ts +23 -3
- package/lib/engine-components/AlignmentConstraint.js +23 -3
- package/lib/engine-components/AlignmentConstraint.js.map +1 -1
- package/lib/engine-components/Animation.d.ts +42 -0
- package/lib/engine-components/Animation.js +36 -0
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/Animator.d.ts +37 -4
- package/lib/engine-components/Animator.js +37 -4
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AudioListener.d.ts +1 -1
- package/lib/engine-components/AudioListener.js +1 -1
- package/lib/engine-components/AudioSource.d.ts +32 -10
- package/lib/engine-components/AudioSource.js +32 -10
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/AxesHelper.d.ts +22 -3
- package/lib/engine-components/AxesHelper.js +22 -3
- package/lib/engine-components/AxesHelper.js.map +1 -1
- package/lib/engine-components/BasicIKConstraint.d.ts +27 -4
- package/lib/engine-components/BasicIKConstraint.js +27 -4
- package/lib/engine-components/BasicIKConstraint.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +32 -2
- package/lib/engine-components/Camera.js +32 -2
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CharacterController.d.ts +68 -4
- package/lib/engine-components/CharacterController.js +68 -4
- package/lib/engine-components/CharacterController.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +69 -12
- package/lib/engine-components/Collider.js +69 -12
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/ContactShadows.d.ts +26 -6
- package/lib/engine-components/ContactShadows.js +31 -8
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/DeleteBox.d.ts +43 -2
- package/lib/engine-components/DeleteBox.js +43 -2
- package/lib/engine-components/DeleteBox.js.map +1 -1
- package/lib/engine-components/DeviceFlag.d.ts +21 -2
- package/lib/engine-components/DeviceFlag.js +21 -2
- package/lib/engine-components/DeviceFlag.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +32 -2
- package/lib/engine-components/DragControls.js +32 -2
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DropListener.d.ts +33 -21
- package/lib/engine-components/DropListener.js +33 -21
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/Duplicatable.d.ts +36 -5
- package/lib/engine-components/Duplicatable.js +36 -5
- package/lib/engine-components/Duplicatable.js.map +1 -1
- package/lib/engine-components/EventList.d.ts +38 -10
- package/lib/engine-components/EventList.js +38 -10
- package/lib/engine-components/EventList.js.map +1 -1
- package/lib/engine-components/EventTrigger.d.ts +1 -1
- package/lib/engine-components/EventTrigger.js +1 -1
- package/lib/engine-components/Fog.d.ts +23 -1
- package/lib/engine-components/Fog.js +23 -1
- package/lib/engine-components/Fog.js.map +1 -1
- package/lib/engine-components/GridHelper.d.ts +18 -2
- package/lib/engine-components/GridHelper.js +18 -2
- package/lib/engine-components/GridHelper.js.map +1 -1
- package/lib/engine-components/GroundProjection.d.ts +24 -2
- package/lib/engine-components/GroundProjection.js +24 -2
- package/lib/engine-components/GroundProjection.js.map +1 -1
- package/lib/engine-components/Interactable.d.ts +17 -2
- package/lib/engine-components/Interactable.js +17 -2
- package/lib/engine-components/Interactable.js.map +1 -1
- package/lib/engine-components/Joints.d.ts +50 -7
- package/lib/engine-components/Joints.js +50 -7
- package/lib/engine-components/Joints.js.map +1 -1
- package/lib/engine-components/LODGroup.d.ts +36 -14
- package/lib/engine-components/LODGroup.js +43 -11
- package/lib/engine-components/LODGroup.js.map +1 -1
- package/lib/engine-components/Light.d.ts +30 -5
- package/lib/engine-components/Light.js +30 -5
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/LookAtConstraint.d.ts +22 -7
- package/lib/engine-components/LookAtConstraint.js +22 -7
- package/lib/engine-components/LookAtConstraint.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +27 -5
- package/lib/engine-components/NeedleMenu.js +27 -5
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/NestedGltf.d.ts +39 -4
- package/lib/engine-components/NestedGltf.js +42 -4
- package/lib/engine-components/NestedGltf.js.map +1 -1
- package/lib/engine-components/OffsetConstraint.d.ts +27 -3
- package/lib/engine-components/OffsetConstraint.js +27 -3
- package/lib/engine-components/OffsetConstraint.js.map +1 -1
- package/lib/engine-components/OrbitControls.d.ts +41 -3
- package/lib/engine-components/OrbitControls.js +41 -3
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/PlayerColor.d.ts +1 -1
- package/lib/engine-components/PlayerColor.js +1 -1
- package/lib/engine-components/ReflectionProbe.d.ts +17 -2
- package/lib/engine-components/ReflectionProbe.js +17 -3
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.d.ts +34 -0
- package/lib/engine-components/Renderer.js +35 -2
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.d.ts +11 -0
- package/lib/engine-components/SceneSwitcher.js +11 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/ScreenCapture.d.ts +38 -6
- package/lib/engine-components/ScreenCapture.js +38 -6
- package/lib/engine-components/ScreenCapture.js.map +1 -1
- package/lib/engine-components/Skybox.d.ts +1 -1
- package/lib/engine-components/Skybox.js +1 -1
- package/lib/engine-components/SmoothFollow.d.ts +66 -7
- package/lib/engine-components/SmoothFollow.js +66 -7
- package/lib/engine-components/SmoothFollow.js.map +1 -1
- package/lib/engine-components/SpatialTrigger.d.ts +48 -1
- package/lib/engine-components/SpatialTrigger.js +48 -1
- package/lib/engine-components/SpatialTrigger.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.d.ts +21 -3
- package/lib/engine-components/SpectatorCamera.js +21 -3
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SyncedRoom.d.ts +7 -1
- package/lib/engine-components/SyncedRoom.js +7 -1
- package/lib/engine-components/SyncedRoom.js.map +1 -1
- package/lib/engine-components/SyncedTransform.d.ts +55 -6
- package/lib/engine-components/SyncedTransform.js +55 -6
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/TransformGizmo.d.ts +30 -3
- package/lib/engine-components/TransformGizmo.js +30 -3
- package/lib/engine-components/TransformGizmo.js.map +1 -1
- package/lib/engine-components/VideoPlayer.d.ts +33 -6
- package/lib/engine-components/VideoPlayer.js +45 -6
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/Voip.d.ts +33 -2
- package/lib/engine-components/Voip.js +33 -2
- package/lib/engine-components/Voip.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.d.ts +47 -13
- package/lib/engine-components/export/usdz/USDZExporter.js +47 -13
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/particlesystem/ParticleSystem.d.ts +82 -3
- package/lib/engine-components/particlesystem/ParticleSystem.js +82 -3
- package/lib/engine-components/particlesystem/ParticleSystem.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Antialiasing.d.ts +1 -0
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js +1 -0
- package/lib/engine-components/postprocessing/Effects/Antialiasing.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/BloomEffect.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ChromaticAberration.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ColorAdjustments.js +1 -1
- package/lib/engine-components/postprocessing/Effects/DepthOfField.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/DepthOfField.js +1 -1
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.d.ts +1 -0
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.js +1 -0
- package/lib/engine-components/postprocessing/Effects/EffectWrapper.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Pixelation.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Pixelation.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.js +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.js +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Sharpening.js +1 -1
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/TiltShiftEffect.js +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.js +1 -1
- package/lib/engine-components/postprocessing/Effects/Vignette.d.ts +1 -1
- package/lib/engine-components/postprocessing/Effects/Vignette.js +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.d.ts +1 -1
- package/lib/engine-components/postprocessing/PostProcessingHandler.js +1 -1
- package/lib/engine-components/postprocessing/Volume.d.ts +1 -1
- package/lib/engine-components/postprocessing/Volume.js +1 -1
- package/lib/engine-components/splines/Spline.d.ts +409 -12
- package/lib/engine-components/splines/Spline.js +409 -12
- package/lib/engine-components/splines/Spline.js.map +1 -1
- package/lib/engine-components/splines/SplineUtils.d.ts +1 -0
- package/lib/engine-components/splines/SplineUtils.js +1 -0
- package/lib/engine-components/splines/SplineUtils.js.map +1 -1
- package/lib/engine-components/splines/SplineWalker.d.ts +3 -1
- package/lib/engine-components/splines/SplineWalker.js +3 -1
- package/lib/engine-components/splines/SplineWalker.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.d.ts +99 -14
- package/lib/engine-components/timeline/PlayableDirector.js +91 -25
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/ui/Button.d.ts +29 -3
- package/lib/engine-components/ui/Button.js +29 -3
- package/lib/engine-components/ui/Button.js.map +1 -1
- package/lib/engine-components/ui/Canvas.d.ts +29 -4
- package/lib/engine-components/ui/Canvas.js +29 -4
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/CanvasGroup.d.ts +1 -1
- package/lib/engine-components/ui/CanvasGroup.js +1 -1
- package/lib/engine-components/ui/EventSystem.d.ts +1 -1
- package/lib/engine-components/ui/EventSystem.js +1 -1
- package/lib/engine-components/ui/Graphic.d.ts +1 -0
- package/lib/engine-components/ui/Graphic.js +1 -0
- package/lib/engine-components/ui/Graphic.js.map +1 -1
- package/lib/engine-components/ui/Image.d.ts +22 -3
- package/lib/engine-components/ui/Image.js +22 -3
- package/lib/engine-components/ui/Image.js.map +1 -1
- package/lib/engine-components/ui/InputField.d.ts +1 -1
- package/lib/engine-components/ui/InputField.js +1 -1
- package/lib/engine-components/ui/Layout.d.ts +3 -0
- package/lib/engine-components/ui/Layout.js +3 -0
- package/lib/engine-components/ui/Layout.js.map +1 -1
- package/lib/engine-components/ui/Outline.d.ts +1 -1
- package/lib/engine-components/ui/Outline.js +1 -1
- package/lib/engine-components/ui/PointerEvents.d.ts +1 -1
- package/lib/engine-components/ui/PointerEvents.js +1 -1
- package/lib/engine-components/ui/Raycaster.d.ts +55 -6
- package/lib/engine-components/ui/Raycaster.js +55 -6
- package/lib/engine-components/ui/Raycaster.js.map +1 -1
- package/lib/engine-components/ui/RectTransform.d.ts +1 -1
- package/lib/engine-components/ui/RectTransform.js +1 -1
- package/lib/engine-components/ui/SpatialHtml.d.ts +1 -1
- package/lib/engine-components/ui/SpatialHtml.js +1 -1
- package/lib/engine-components/ui/Text.d.ts +23 -1
- package/lib/engine-components/ui/Text.js +23 -1
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/utils/LookAt.d.ts +1 -1
- package/lib/engine-components/utils/LookAt.js +1 -1
- package/lib/engine-components/utils/OpenURL.d.ts +1 -1
- package/lib/engine-components/utils/OpenURL.js +1 -1
- package/lib/engine-components/web/Clickthrough.d.ts +116 -7
- package/lib/engine-components/web/Clickthrough.js +116 -7
- package/lib/engine-components/web/Clickthrough.js.map +1 -1
- package/lib/engine-components/web/CursorFollow.d.ts +171 -7
- package/lib/engine-components/web/CursorFollow.js +171 -7
- package/lib/engine-components/web/CursorFollow.js.map +1 -1
- package/lib/engine-components/web/HoverAnimation.d.ts +140 -11
- package/lib/engine-components/web/HoverAnimation.js +140 -11
- package/lib/engine-components/web/HoverAnimation.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +4 -1
- package/lib/engine-components/web/ScrollFollow.js +4 -1
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/engine-components/web/ViewBox.d.ts +116 -16
- package/lib/engine-components/web/ViewBox.js +110 -16
- package/lib/engine-components/web/ViewBox.js.map +1 -1
- package/lib/engine-components/webxr/TeleportTarget.d.ts +21 -2
- package/lib/engine-components/webxr/TeleportTarget.js +21 -2
- package/lib/engine-components/webxr/TeleportTarget.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +10 -2
- package/lib/engine-components/webxr/WebXR.js +10 -2
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components/webxr/WebXRAvatar.d.ts +39 -2
- package/lib/engine-components/webxr/WebXRAvatar.js +35 -3
- package/lib/engine-components/webxr/WebXRAvatar.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +266 -30
- package/lib/engine-components/webxr/WebXRImageTracking.js +266 -30
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/lib/engine-components/webxr/WebXRPlaneTracking.d.ts +1 -1
- package/lib/engine-components/webxr/WebXRPlaneTracking.js +1 -1
- package/lib/engine-components/webxr/XRFlag.d.ts +29 -2
- package/lib/engine-components/webxr/XRFlag.js +29 -2
- package/lib/engine-components/webxr/XRFlag.js.map +1 -1
- package/package.json +1 -1
- package/plugins/vite/custom-element-data.js +128 -19
- package/src/engine/engine_context.ts +16 -0
- package/src/engine/engine_gameobject.ts +73 -0
- package/src/engine/engine_input.ts +83 -7
- package/src/engine/engine_math.ts +81 -2
- package/src/engine/engine_networking.ts +186 -17
- package/src/engine/engine_networking_auto.ts +36 -9
- package/src/engine/engine_physics.ts +37 -1
- package/src/engine/engine_physics_rapier.ts +77 -0
- package/src/engine/engine_serialization_decorator.ts +28 -2
- package/src/engine/engine_time.ts +23 -3
- package/src/engine/engine_util_decorator.ts +31 -1
- package/src/engine/engine_utils.ts +21 -5
- package/src/engine/extensions/NEEDLE_materialx.ts +5 -4
- package/src/engine/extensions/index.ts +2 -2
- package/src/engine-components/AlignmentConstraint.ts +24 -4
- package/src/engine-components/Animation.ts +44 -2
- package/src/engine-components/Animator.ts +40 -7
- package/src/engine-components/AudioListener.ts +1 -1
- package/src/engine-components/AudioSource.ts +37 -15
- package/src/engine-components/AxesHelper.ts +23 -4
- package/src/engine-components/BasicIKConstraint.ts +28 -5
- package/src/engine-components/Camera.ts +33 -3
- package/src/engine-components/CharacterController.ts +74 -7
- package/src/engine-components/Collider.ts +78 -21
- package/src/engine-components/ContactShadows.ts +36 -11
- package/src/engine-components/DeleteBox.ts +43 -2
- package/src/engine-components/DeviceFlag.ts +22 -3
- package/src/engine-components/DragControls.ts +32 -2
- package/src/engine-components/DropListener.ts +41 -29
- package/src/engine-components/Duplicatable.ts +37 -6
- package/src/engine-components/EventList.ts +41 -13
- package/src/engine-components/EventTrigger.ts +1 -1
- package/src/engine-components/Fog.ts +23 -1
- package/src/engine-components/GridHelper.ts +18 -2
- package/src/engine-components/GroundProjection.ts +25 -3
- package/src/engine-components/Interactable.ts +17 -2
- package/src/engine-components/Joints.ts +51 -8
- package/src/engine-components/LODGroup.ts +45 -11
- package/src/engine-components/Light.ts +35 -13
- package/src/engine-components/LookAtConstraint.ts +26 -8
- package/src/engine-components/NeedleMenu.ts +29 -7
- package/src/engine-components/NestedGltf.ts +40 -4
- package/src/engine-components/OffsetConstraint.ts +27 -3
- package/src/engine-components/OrbitControls.ts +41 -3
- package/src/engine-components/PlayerColor.ts +1 -1
- package/src/engine-components/ReflectionProbe.ts +19 -5
- package/src/engine-components/Renderer.ts +34 -1
- package/src/engine-components/SceneSwitcher.ts +11 -0
- package/src/engine-components/ScreenCapture.ts +41 -9
- package/src/engine-components/Skybox.ts +1 -1
- package/src/engine-components/SmoothFollow.ts +68 -7
- package/src/engine-components/SpatialTrigger.ts +51 -4
- package/src/engine-components/SpectatorCamera.ts +23 -5
- package/src/engine-components/SyncedRoom.ts +8 -2
- package/src/engine-components/SyncedTransform.ts +59 -10
- package/src/engine-components/TransformGizmo.ts +31 -4
- package/src/engine-components/VideoPlayer.ts +48 -6
- package/src/engine-components/Voip.ts +33 -2
- package/src/engine-components/export/usdz/USDZExporter.ts +47 -13
- package/src/engine-components/particlesystem/ParticleSystem.ts +84 -5
- package/src/engine-components/postprocessing/Effects/Antialiasing.ts +1 -0
- package/src/engine-components/postprocessing/Effects/BloomEffect.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ChromaticAberration.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ColorAdjustments.ts +1 -1
- package/src/engine-components/postprocessing/Effects/DepthOfField.ts +1 -1
- package/src/engine-components/postprocessing/Effects/EffectWrapper.ts +1 -0
- package/src/engine-components/postprocessing/Effects/Pixelation.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusion.ts +1 -1
- package/src/engine-components/postprocessing/Effects/ScreenspaceAmbientOcclusionN8.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Sharpening.ts +1 -1
- package/src/engine-components/postprocessing/Effects/TiltShiftEffect.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Tonemapping.ts +1 -1
- package/src/engine-components/postprocessing/Effects/Vignette.ts +1 -1
- package/src/engine-components/postprocessing/PostProcessingHandler.ts +1 -1
- package/src/engine-components/postprocessing/Volume.ts +1 -1
- package/src/engine-components/splines/Spline.ts +412 -14
- package/src/engine-components/splines/SplineUtils.ts +1 -0
- package/src/engine-components/splines/SplineWalker.ts +4 -2
- package/src/engine-components/timeline/PlayableDirector.ts +104 -27
- package/src/engine-components/ui/Button.ts +29 -3
- package/src/engine-components/ui/Canvas.ts +29 -4
- package/src/engine-components/ui/CanvasGroup.ts +2 -2
- package/src/engine-components/ui/EventSystem.ts +1 -1
- package/src/engine-components/ui/Graphic.ts +1 -0
- package/src/engine-components/ui/Image.ts +22 -3
- package/src/engine-components/ui/InputField.ts +2 -2
- package/src/engine-components/ui/Layout.ts +3 -0
- package/src/engine-components/ui/Outline.ts +1 -1
- package/src/engine-components/ui/PointerEvents.ts +1 -1
- package/src/engine-components/ui/Raycaster.ts +57 -8
- package/src/engine-components/ui/RectTransform.ts +2 -2
- package/src/engine-components/ui/SpatialHtml.ts +1 -1
- package/src/engine-components/ui/Text.ts +24 -2
- package/src/engine-components/utils/LookAt.ts +1 -1
- package/src/engine-components/utils/OpenURL.ts +1 -1
- package/src/engine-components/web/Clickthrough.ts +119 -10
- package/src/engine-components/web/CursorFollow.ts +174 -9
- package/src/engine-components/web/HoverAnimation.ts +142 -13
- package/src/engine-components/web/ScrollFollow.ts +4 -1
- package/src/engine-components/web/ViewBox.ts +118 -18
- package/src/engine-components/webxr/TeleportTarget.ts +23 -4
- package/src/engine-components/webxr/WebXR.ts +11 -3
- package/src/engine-components/webxr/WebXRAvatar.ts +41 -4
- package/src/engine-components/webxr/WebXRImageTracking.ts +282 -38
- package/src/engine-components/webxr/WebXRPlaneTracking.ts +1 -1
- package/src/engine-components/webxr/XRFlag.ts +30 -3
|
@@ -20,29 +20,70 @@ const debug = getParam("debugimagetracking");
|
|
|
20
20
|
|
|
21
21
|
// #region WebXRTrackedImage
|
|
22
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Represents a tracked image detected during a WebXR session.
|
|
25
|
+
* Contains position, rotation, and tracking state information for a detected marker image.
|
|
26
|
+
*
|
|
27
|
+
* **Properties:**
|
|
28
|
+
* - Access image URL and physical dimensions
|
|
29
|
+
* - Get current position and rotation in world space
|
|
30
|
+
* - Check tracking state (tracked vs emulated)
|
|
31
|
+
* - Apply transform to 3D objects
|
|
32
|
+
*
|
|
33
|
+
* @summary Runtime data for a detected marker image in WebXR
|
|
34
|
+
* @category XR
|
|
35
|
+
*/
|
|
23
36
|
export class WebXRTrackedImage {
|
|
24
37
|
|
|
38
|
+
/** URL of the tracked marker image */
|
|
25
39
|
get url(): string { return this._trackedImage.image ?? ""; }
|
|
40
|
+
/** Physical width of the marker in meters */
|
|
26
41
|
get widthInMeters() { return this._trackedImage.widthInMeters ?? undefined; }
|
|
42
|
+
/** The ImageBitmap used for tracking */
|
|
27
43
|
get bitmap(): ImageBitmap { return this._bitmap; }
|
|
44
|
+
/** The {@link WebXRImageTrackingModel} configuration for this tracked image */
|
|
28
45
|
get model(): WebXRImageTrackingModel { return this._trackedImage; }
|
|
46
|
+
/**
|
|
47
|
+
* The measured size of the detected image in the real world.
|
|
48
|
+
* May differ from `widthInMeters` if the physical marker doesn't match the configured size.
|
|
49
|
+
*/
|
|
29
50
|
readonly measuredSize: number;
|
|
51
|
+
/**
|
|
52
|
+
* Current tracking state of the image:
|
|
53
|
+
* - `tracked` - Image is currently being tracked by the system
|
|
54
|
+
* - `emulated` - Tracking is being emulated (less accurate)
|
|
55
|
+
*/
|
|
30
56
|
readonly state: "tracked" | "emulated";
|
|
31
57
|
|
|
32
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Copy the current world position of the tracked image to a Vector3.
|
|
60
|
+
* @param vec The vector to store the position in
|
|
61
|
+
* @returns The input vector with the position copied to it
|
|
62
|
+
*/
|
|
33
63
|
getPosition(vec: Vector3) {
|
|
34
64
|
this.ensureTransformData();
|
|
35
65
|
vec.copy(this._position);
|
|
36
66
|
return vec;
|
|
37
67
|
}
|
|
38
68
|
|
|
39
|
-
/**
|
|
69
|
+
/**
|
|
70
|
+
* Copy the current world rotation of the tracked image to a Quaternion.
|
|
71
|
+
* @param quat The quaternion to store the rotation in
|
|
72
|
+
* @returns The input quaternion with the rotation copied to it
|
|
73
|
+
*/
|
|
40
74
|
getQuaternion(quat: Quaternion) {
|
|
41
75
|
this.ensureTransformData();
|
|
42
76
|
quat.copy(this._rotation);
|
|
43
77
|
return quat;
|
|
44
78
|
}
|
|
45
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Apply the tracked image's position and rotation to a 3D object.
|
|
82
|
+
* Optionally applies smoothing to reduce jitter.
|
|
83
|
+
*
|
|
84
|
+
* @param object The 3D object to update
|
|
85
|
+
* @param t01 Interpolation factor (0-1) for smoothing. If undefined or >= 1, no smoothing is applied. When smoothing is enabled, larger position/rotation changes will automatically reduce the smoothing to prevent lag.
|
|
86
|
+
*/
|
|
46
87
|
applyToObject(object: Object3D, t01: number | undefined = undefined) {
|
|
47
88
|
this.ensureTransformData();
|
|
48
89
|
// check if position/_position or rotation/_rotation changed more than just a little bit and adjust smoothing accordingly
|
|
@@ -92,14 +133,22 @@ export class WebXRTrackedImage {
|
|
|
92
133
|
|
|
93
134
|
}
|
|
94
135
|
|
|
136
|
+
/**
|
|
137
|
+
* Event callback type for image tracking updates.
|
|
138
|
+
* @param images Array of currently tracked images
|
|
139
|
+
*/
|
|
95
140
|
declare type WebXRImageTrackingEvent = (images: WebXRImageTrackingEvent[]) => void;
|
|
96
141
|
|
|
97
|
-
/**
|
|
98
|
-
*
|
|
142
|
+
/**
|
|
143
|
+
* Initial state of tracked image objects before entering an XR session.
|
|
144
|
+
* Used to restore objects to their original state when the WebXR session ends.
|
|
99
145
|
*/
|
|
100
146
|
declare type InitialTrackedObjectState = {
|
|
147
|
+
/** Original visibility state */
|
|
101
148
|
visible: boolean;
|
|
149
|
+
/** Original parent object in the scene hierarchy */
|
|
102
150
|
parent: Object3D | undefined | null;
|
|
151
|
+
/** Original transformation matrix */
|
|
103
152
|
matrix: Matrix4;
|
|
104
153
|
}
|
|
105
154
|
|
|
@@ -107,13 +156,37 @@ declare type InitialTrackedObjectState = {
|
|
|
107
156
|
// #region Model
|
|
108
157
|
|
|
109
158
|
/**
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
159
|
+
* Configuration model for a tracked image marker.
|
|
160
|
+
* Defines which image to track, its physical size, and which 3D content to display when detected.
|
|
161
|
+
*
|
|
162
|
+
* **Important:** The physical size (`widthInMeters`) must match your printed marker size for accurate tracking.
|
|
163
|
+
* Mismatched sizes cause the tracked object to appear to "float" above or below the marker.
|
|
164
|
+
*
|
|
165
|
+
* **Best practices for marker images:**
|
|
166
|
+
* - Use high-contrast images with distinct features
|
|
167
|
+
* - Avoid repetitive patterns or solid colors
|
|
168
|
+
* - Test images at intended viewing distances
|
|
169
|
+
* - Ensure good lighting conditions
|
|
170
|
+
*
|
|
171
|
+
* @summary Configuration for a single trackable image marker
|
|
172
|
+
* @category XR
|
|
173
|
+
* @see {@link WebXRImageTracking} for the component that uses these models
|
|
174
|
+
* @link https://engine.needle.tools/docs/xr.html#image-tracking
|
|
175
|
+
* @link https://engine.needle.tools/samples/image-tracking
|
|
114
176
|
*/
|
|
115
177
|
export class WebXRImageTrackingModel {
|
|
116
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Creates a new image tracking configuration.
|
|
181
|
+
*
|
|
182
|
+
* @param params Configuration parameters
|
|
183
|
+
* @param params.url URL to the marker image to track
|
|
184
|
+
* @param params.widthInMeters Physical width of the printed marker in meters (must match real size!)
|
|
185
|
+
* @param params.object The 3D object or AssetReference to display when this image is detected
|
|
186
|
+
* @param params.createObjectInstance If true, creates a new instance for each detection (useful for tracking multiple instances of the same marker)
|
|
187
|
+
* @param params.imageDoesNotMove Enable for static markers (floor/wall mounted) to improve tracking stability
|
|
188
|
+
* @param params.hideWhenTrackingIsLost If true, hides the object when tracking is lost; if false, leaves it at the last known position
|
|
189
|
+
*/
|
|
117
190
|
constructor(params: { url: string, widthInMeters: number, /** Object to track */ object: AssetReference | Object3D, createObjectInstance?: boolean, imageDoesNotMove?: boolean, hideWhenTrackingIsLost?: boolean }) {
|
|
118
191
|
this.image = params.url;
|
|
119
192
|
this.widthInMeters = params.widthInMeters;
|
|
@@ -121,44 +194,81 @@ export class WebXRImageTrackingModel {
|
|
|
121
194
|
this.object = new AssetReference({ asset: params.object });
|
|
122
195
|
}
|
|
123
196
|
else this.object = params.object;
|
|
124
|
-
|
|
197
|
+
|
|
125
198
|
if (params.createObjectInstance !== undefined) this.createObjectInstance = params.createObjectInstance;
|
|
126
199
|
if (params.imageDoesNotMove !== undefined) this.imageDoesNotMove = params.imageDoesNotMove;
|
|
127
200
|
if (params.hideWhenTrackingIsLost !== undefined) this.hideWhenTrackingIsLost = params.hideWhenTrackingIsLost;
|
|
128
201
|
}
|
|
129
202
|
|
|
130
203
|
/**
|
|
131
|
-
*
|
|
204
|
+
* URL to the marker image to track.
|
|
205
|
+
* **Important:** Use images with high contrast and unique features to improve tracking quality.
|
|
206
|
+
* Avoid repetitive patterns, solid colors, or low-contrast images.
|
|
132
207
|
*/
|
|
133
208
|
@serializable(URL)
|
|
134
209
|
image?: string;
|
|
135
210
|
|
|
136
|
-
/**
|
|
137
|
-
*
|
|
211
|
+
/**
|
|
212
|
+
* Physical width of the printed marker in meters.
|
|
213
|
+
* **Critical:** This must match your actual printed marker size!
|
|
214
|
+
* If mismatched, the tracked object will appear to "float" above or below the marker.
|
|
215
|
+
*
|
|
216
|
+
* @default 0.25 (25cm)
|
|
217
|
+
* @example
|
|
218
|
+
* ```ts
|
|
219
|
+
* // For a business card sized marker (9cm wide)
|
|
220
|
+
* widthInMeters = 0.09;
|
|
221
|
+
*
|
|
222
|
+
* // For an A4 page width (21cm)
|
|
223
|
+
* widthInMeters = 0.21;
|
|
224
|
+
* ```
|
|
138
225
|
*/
|
|
139
226
|
@serializable()
|
|
140
227
|
widthInMeters: number = .25;
|
|
141
228
|
|
|
142
229
|
/**
|
|
143
|
-
* The object
|
|
230
|
+
* The 3D object or prefab to display when this marker is detected.
|
|
231
|
+
* The object will be positioned and rotated to match the tracked image in the real world.
|
|
232
|
+
*
|
|
233
|
+
* **Note:** Scale your 3D content appropriately relative to `widthInMeters`.
|
|
144
234
|
*/
|
|
145
235
|
@serializable(AssetReference)
|
|
146
236
|
object?: AssetReference;
|
|
147
237
|
|
|
148
238
|
/**
|
|
149
|
-
*
|
|
239
|
+
* When enabled, creates a new instance of the referenced object each time this image is detected.
|
|
240
|
+
* Enable this if you want to track multiple instances of the same marker simultaneously,
|
|
241
|
+
* or if the same object is used for multiple different markers.
|
|
242
|
+
*
|
|
243
|
+
* @default false
|
|
150
244
|
*/
|
|
151
245
|
@serializable()
|
|
152
246
|
createObjectInstance: boolean = false;
|
|
153
247
|
|
|
154
|
-
/**
|
|
248
|
+
/**
|
|
249
|
+
* Enable for static markers that don't move (e.g., posters on walls or markers on the floor).
|
|
250
|
+
* When enabled, only the first few tracking frames are used to position the object,
|
|
251
|
+
* resulting in more stable tracking by ignoring subsequent minor position changes.
|
|
252
|
+
*
|
|
253
|
+
* **Use cases:**
|
|
254
|
+
* - Wall-mounted posters or artwork
|
|
255
|
+
* - Floor markers for persistent AR content
|
|
256
|
+
* - Product packaging on shelves
|
|
257
|
+
*
|
|
258
|
+
* **Don't use for:**
|
|
259
|
+
* - Handheld cards or objects
|
|
260
|
+
* - Moving markers
|
|
261
|
+
*
|
|
155
262
|
* @default false
|
|
156
263
|
*/
|
|
157
264
|
@serializable()
|
|
158
265
|
imageDoesNotMove: boolean = false;
|
|
159
266
|
|
|
160
267
|
/**
|
|
161
|
-
*
|
|
268
|
+
* Controls visibility behavior when tracking is lost.
|
|
269
|
+
* - When `true`: Object is hidden when the marker is no longer visible
|
|
270
|
+
* - When `false`: Object remains visible at its last tracked position
|
|
271
|
+
*
|
|
162
272
|
* @default true
|
|
163
273
|
*/
|
|
164
274
|
@serializable()
|
|
@@ -166,7 +276,13 @@ export class WebXRImageTrackingModel {
|
|
|
166
276
|
|
|
167
277
|
|
|
168
278
|
/**
|
|
169
|
-
*
|
|
279
|
+
* Extracts the filename from the marker image URL.
|
|
280
|
+
* @returns The filename (last part of the URL path), or null if no image URL is set
|
|
281
|
+
* @example
|
|
282
|
+
* ```ts
|
|
283
|
+
* // URL: "https://example.com/markers/business-card.png"
|
|
284
|
+
* // Returns: "business-card.png"
|
|
285
|
+
* ```
|
|
170
286
|
*/
|
|
171
287
|
getNameFromUrl() {
|
|
172
288
|
if (this.image) {
|
|
@@ -299,24 +415,121 @@ class ImageTrackingExtension implements IUSDExporterExtension {
|
|
|
299
415
|
|
|
300
416
|
// #region Tracking Component
|
|
301
417
|
/**
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
418
|
+
* Create powerful AR image tracking experiences with just a few lines of code!
|
|
419
|
+
* WebXRImageTracking makes it incredibly easy to detect marker images in the real world and anchor 3D content to them.
|
|
420
|
+
* Needle Engine automatically handles all the complexity across different platforms and fallback modes for you.
|
|
421
|
+
*
|
|
422
|
+
* [](https://engine.needle.tools/samples/image-tracking)
|
|
423
|
+
*
|
|
424
|
+
* **What makes Needle Engine special:**
|
|
425
|
+
* - **Write once, run everywhere**: The same code works across iOS, Android, and visionOS
|
|
426
|
+
* - **Automatic platform optimization**: Seamlessly switches between WebXR, ARKit, and QuickLook
|
|
427
|
+
* - **Flexible deployment options**: From full WebXR with unlimited markers to QuickLook fallback
|
|
428
|
+
* - **Production ready**: Battle-tested tracking with adaptive smoothing and stability features
|
|
429
|
+
*
|
|
430
|
+
* **Platform Support & Options:**
|
|
431
|
+
* - **iOS (WebXR via AppClip)**: Full WebXR support - track unlimited markers simultaneously via native ARKit!
|
|
432
|
+
* - **iOS (QuickLook mode)**: Instant AR without app installation - perfect for quick demos (tracks first marker)
|
|
433
|
+
* - **Android (WebXR)**: Native WebXR Image Tracking API - unlimited markers (requires browser flag during early access)
|
|
434
|
+
* - **visionOS (QuickLook)**: Spatial image anchoring with Apple's AR QuickLook
|
|
435
|
+
*
|
|
436
|
+
* **Simple 3-Step Setup:**
|
|
437
|
+
* 1. Add this component to any GameObject in your scene
|
|
438
|
+
* 2. Configure your markers in the `trackedImages` array:
|
|
439
|
+
* - `image`: URL to your marker image
|
|
440
|
+
* - `widthInMeters`: Physical size of your printed marker
|
|
441
|
+
* - `object`: The 3D content to display
|
|
442
|
+
* 3. Export and test - Needle handles the rest!
|
|
443
|
+
*
|
|
444
|
+
* **Pro Tips for Best Results:**
|
|
445
|
+
* - Use high-contrast markers with unique features for reliable tracking
|
|
446
|
+
* - Match `widthInMeters` to your actual physical marker size for accurate positioning
|
|
447
|
+
* - Enable `imageDoesNotMove` for wall posters or floor markers - significantly improves stability
|
|
448
|
+
* - Use `smooth` (enabled by default) for professional-looking, jitter-free tracking
|
|
449
|
+
* - Test with different marker sizes and lighting - Needle's adaptive tracking handles various conditions
|
|
305
450
|
*
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
* **NOTE:** For iOS only one image can be tracked at a time. If you have multiple images in the `trackedImages` array, only the first one will be tracked. You can use the {@link setPrimaryImage} method to change which image is tracked before entering the XR session.
|
|
309
|
-
*
|
|
310
|
-
* - Example: https://samples.needle.tools/image-tracking
|
|
451
|
+
* 
|
|
452
|
+
* *WebXRImageTracking component in Unity Editor*
|
|
311
453
|
*
|
|
454
|
+
* 
|
|
455
|
+
* *WebXRImageTracking panel/component in Blender*
|
|
456
|
+
*
|
|
457
|
+
* @example Getting started - it's this easy!
|
|
458
|
+
* ```ts
|
|
459
|
+
* // Just add markers and Needle handles everything else
|
|
460
|
+
* const imageTracking = myObject.addComponent(WebXRImageTracking);
|
|
461
|
+
* const marker = new WebXRImageTrackingModel({
|
|
462
|
+
* url: "https://example.com/my-poster.png",
|
|
463
|
+
* widthInMeters: 0.3, // 30cm poster
|
|
464
|
+
* object: my3DContent
|
|
465
|
+
* });
|
|
466
|
+
* imageTracking.addImage(marker);
|
|
467
|
+
* // Done! Works on iOS, Android, and visionOS automatically
|
|
468
|
+
* ```
|
|
469
|
+
*
|
|
470
|
+
* @example Track multiple markers (WebXR mode)
|
|
471
|
+
* ```ts
|
|
472
|
+
* const imageTracking = myObject.addComponent(WebXRImageTracking);
|
|
473
|
+
*
|
|
474
|
+
* // In WebXR mode (iOS AppClip, Android), all markers work simultaneously!
|
|
475
|
+
* const productBox = new WebXRImageTrackingModel({ url: "product-box.png", widthInMeters: 0.15, object: productInfo });
|
|
476
|
+
* const businessCard = new WebXRImageTrackingModel({ url: "business-card.png", widthInMeters: 0.09, object: contactCard });
|
|
477
|
+
* const poster = new WebXRImageTrackingModel({ url: "poster.png", widthInMeters: 0.5, object: videoPlayer });
|
|
478
|
+
*
|
|
479
|
+
* imageTracking.addImage(productBox);
|
|
480
|
+
* imageTracking.addImage(businessCard);
|
|
481
|
+
* imageTracking.addImage(poster);
|
|
482
|
+
*
|
|
483
|
+
* // For QuickLook fallback mode, optionally set which marker is primary
|
|
484
|
+
* imageTracking.setPrimaryImage(poster); // This will be used in QuickLook
|
|
485
|
+
* ```
|
|
486
|
+
*
|
|
487
|
+
* @example Professional setup for static markers
|
|
488
|
+
* ```ts
|
|
489
|
+
* // Perfect for museums, retail displays, or permanent installations
|
|
490
|
+
* const wallArt = new WebXRImageTrackingModel({
|
|
491
|
+
* url: "gallery-painting.png",
|
|
492
|
+
* widthInMeters: 0.6,
|
|
493
|
+
* object: interactiveExplanation,
|
|
494
|
+
* imageDoesNotMove: true, // Rock-solid tracking for static markers!
|
|
495
|
+
* hideWhenTrackingIsLost: false // Content stays visible even if temporarily occluded
|
|
496
|
+
* });
|
|
497
|
+
* ```
|
|
498
|
+
*
|
|
499
|
+
* **Why developers love Needle's image tracking:**
|
|
500
|
+
* - Zero platform-specific code required
|
|
501
|
+
* - Automatic graceful degradation across deployment modes
|
|
502
|
+
* - Built-in jitter reduction and stability features
|
|
503
|
+
* - Works with any image - posters, packaging, business cards, artwork
|
|
504
|
+
* - Export once, deploy everywhere
|
|
505
|
+
*
|
|
506
|
+
* @summary The easiest way to create cross-platform AR image tracking experiences
|
|
312
507
|
* @category XR
|
|
313
508
|
* @group Components
|
|
509
|
+
* @see {@link WebXRImageTrackingModel} for marker configuration options
|
|
510
|
+
* @see {@link WebXRTrackedImage} for runtime tracking data and events
|
|
511
|
+
* @see {@link WebXR} for general WebXR setup and session management
|
|
512
|
+
* @link https://engine.needle.tools/docs/xr.html#image-tracking - Full Documentation
|
|
513
|
+
* @link https://engine.needle.tools/samples/image-tracking - Try Live Demo
|
|
514
|
+
* @link https://github.com/immersive-web/marker-tracking/blob/main/explainer.md - WebXR Marker Tracking Specification
|
|
314
515
|
*/
|
|
315
516
|
export class WebXRImageTracking extends Behaviour {
|
|
316
517
|
|
|
317
518
|
/**
|
|
318
|
-
*
|
|
319
|
-
*
|
|
519
|
+
* Set which marker should be primary (first in the list).
|
|
520
|
+
* Useful when deploying to QuickLook mode where one marker is tracked at a time.
|
|
521
|
+
* In full WebXR mode (iOS AppClip, Android), all markers track simultaneously regardless of order.
|
|
522
|
+
*
|
|
523
|
+
* **Note:** Needle Engine automatically adapts - in WebXR all markers work, in QuickLook the primary is used.
|
|
524
|
+
*
|
|
525
|
+
* @param image The marker model to set as primary
|
|
526
|
+
*
|
|
527
|
+
* @example
|
|
528
|
+
* ```ts
|
|
529
|
+
* // Great for offering different AR experiences from one deployment
|
|
530
|
+
* imageTracking.setPrimaryImage(businessCardMarker); // Use this for QuickLook
|
|
531
|
+
* // In WebXR mode, all markers still work simultaneously!
|
|
532
|
+
* ```
|
|
320
533
|
*/
|
|
321
534
|
setPrimaryImage(image: WebXRImageTrackingModel) {
|
|
322
535
|
const index = this.trackedImages.indexOf(image);
|
|
@@ -331,14 +544,25 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
331
544
|
}
|
|
332
545
|
|
|
333
546
|
/**
|
|
334
|
-
* Add
|
|
335
|
-
*
|
|
336
|
-
*
|
|
547
|
+
* Add a marker to track - it's that simple!
|
|
548
|
+
* Needle Engine handles all the platform differences automatically.
|
|
549
|
+
*
|
|
550
|
+
* **Tip:** Add all your markers upfront. In WebXR mode they all work simultaneously.
|
|
551
|
+
* In QuickLook mode, the first (primary) marker is used.
|
|
552
|
+
*
|
|
553
|
+
* @param image The marker configuration to add
|
|
554
|
+
* @param asPrimary Set to true to make this the primary marker (for QuickLook fallback)
|
|
555
|
+
*
|
|
337
556
|
* @example
|
|
338
557
|
* ```ts
|
|
339
|
-
*
|
|
340
|
-
* const
|
|
341
|
-
*
|
|
558
|
+
* // Super simple - works across all platforms
|
|
559
|
+
* const marker = new WebXRImageTrackingModel({
|
|
560
|
+
* url: "https://mysite.com/poster.png",
|
|
561
|
+
* widthInMeters: 0.42, // A3 poster width
|
|
562
|
+
* object: cool3DModel
|
|
563
|
+
* });
|
|
564
|
+
* imageTracking.addImage(marker);
|
|
565
|
+
* // That's it! Needle does the rest.
|
|
342
566
|
* ```
|
|
343
567
|
*/
|
|
344
568
|
addImage(image: WebXRImageTrackingModel, asPrimary: boolean = false) {
|
|
@@ -351,20 +575,40 @@ export class WebXRImageTracking extends Behaviour {
|
|
|
351
575
|
|
|
352
576
|
|
|
353
577
|
/**
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
578
|
+
* Your list of markers to track. Add as many as you need!
|
|
579
|
+
*
|
|
580
|
+
* **How it works across platforms:**
|
|
581
|
+
* - **WebXR mode** (iOS AppClip, Android): All markers are tracked simultaneously - amazing for multi-marker experiences!
|
|
582
|
+
* - **QuickLook mode** (iOS fallback, visionOS): First marker is used - perfect for quick demos without app installation
|
|
583
|
+
*
|
|
584
|
+
* **Needle's smart deployment:** Configure all your markers once, and Needle automatically uses the best
|
|
585
|
+
* tracking mode available on each platform. No platform-specific code needed!
|
|
586
|
+
*
|
|
587
|
+
* @see {@link WebXRImageTrackingModel} for marker configuration
|
|
588
|
+
* @see {@link addImage} and {@link setPrimaryImage} for runtime management
|
|
357
589
|
*/
|
|
358
590
|
@serializable(WebXRImageTrackingModel)
|
|
359
591
|
readonly trackedImages: WebXRImageTrackingModel[] = [];
|
|
360
592
|
|
|
361
|
-
/**
|
|
593
|
+
/**
|
|
594
|
+
* Enable Needle's professional-grade adaptive smoothing for rock-solid tracking.
|
|
595
|
+
* Automatically reduces jitter while staying responsive to real movement.
|
|
596
|
+
*
|
|
597
|
+
* **Pro tip:** Keep this enabled (default) for production experiences!
|
|
598
|
+
*
|
|
599
|
+
* @default true
|
|
600
|
+
*/
|
|
362
601
|
@serializable()
|
|
363
602
|
smooth: boolean = true;
|
|
364
603
|
|
|
365
604
|
private readonly trackedImageIndexMap: Map<number, WebXRImageTrackingModel> = new Map();
|
|
366
605
|
|
|
367
|
-
/**
|
|
606
|
+
/**
|
|
607
|
+
* Check if image tracking is available on this device right now.
|
|
608
|
+
*
|
|
609
|
+
* **Note:** On Android Chrome, WebXR Image Tracking is currently behind a flag during the early access period.
|
|
610
|
+
* Needle automatically falls back to other modes when needed, so your experience keeps working!
|
|
611
|
+
*/
|
|
368
612
|
get supported() { return this._supported; }
|
|
369
613
|
|
|
370
614
|
private _supported: boolean = true;
|
|
@@ -48,7 +48,7 @@ export declare type WebXRPlaneTrackingEvent = {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
*
|
|
51
|
+
* [WebXRPlaneTracking](https://engine.needle.tools/docs/api/WebXRPlaneTracking) tracks planes and meshes in the real world when in immersive-ar (e.g. on Oculus Quest).
|
|
52
52
|
* @category XR
|
|
53
53
|
* @group Components
|
|
54
54
|
*/
|
|
@@ -61,12 +61,39 @@ export class XRState {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
64
|
+
* XRFlag shows or hides GameObjects based on the current XR state or session.
|
|
65
|
+
* Use for XR-responsive content that should only appear in specific modes.
|
|
66
|
+
*
|
|
67
|
+
* **XR states:**
|
|
68
|
+
* - `Browser` - Normal web browsing (no XR)
|
|
69
|
+
* - `AR` - Augmented reality session
|
|
70
|
+
* - `VR` - Virtual reality session
|
|
71
|
+
* - `FirstPerson` - First-person view mode
|
|
72
|
+
* - `ThirdPerson` - Third-person/spectator view mode
|
|
73
|
+
* - Combine with bitwise OR: `AR | VR`
|
|
74
|
+
*
|
|
75
|
+
* **Debug options:**
|
|
76
|
+
* - `?debugxrflags` - Log flag changes
|
|
77
|
+
* - `?disablexrflags` - Disable all XR flags
|
|
78
|
+
*
|
|
79
|
+
* @example Show only in VR
|
|
80
|
+
* ```ts
|
|
81
|
+
* const flag = myObject.addComponent(XRFlag);
|
|
82
|
+
* flag.visibleIn = XRStateFlag.VR;
|
|
83
|
+
* ```
|
|
84
|
+
*
|
|
85
|
+
* @example Show in AR and VR, hide in browser
|
|
86
|
+
* ```ts
|
|
87
|
+
* flag.visibleIn = XRStateFlag.AR | XRStateFlag.VR;
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
67
90
|
* @category XR
|
|
68
91
|
* @category Utilities
|
|
69
92
|
* @group Components
|
|
93
|
+
* @see {@link XRStateFlag} for state options
|
|
94
|
+
* @see {@link XRState} for global state management
|
|
95
|
+
* @see {@link DeviceFlag} for device-based visibility
|
|
96
|
+
* @see {@link WebXR} for XR session management
|
|
70
97
|
*/
|
|
71
98
|
export class XRFlag extends Behaviour {
|
|
72
99
|
|