@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
|
@@ -5,11 +5,27 @@ import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
|
5
5
|
import { Behaviour } from "./Component.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* GridHelper
|
|
8
|
+
* The [GridHelper](https://engine.needle.tools/docs/api/GridHelper) displays a flat grid in the scene for visual reference.
|
|
9
|
+
* Useful for debugging, level design, or providing spatial context.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
+
* 
|
|
12
|
+
*
|
|
13
|
+
* **Properties:**
|
|
14
|
+
* - `color0` / `color1` - Alternating grid line colors
|
|
15
|
+
* - `isGizmo` - When true, only shows when gizmos are enabled
|
|
16
|
+
*
|
|
17
|
+
* @example Add a grid to the scene
|
|
18
|
+
* ```ts
|
|
19
|
+
* const grid = myObject.addComponent(GridHelper);
|
|
20
|
+
* grid.color0 = new Color(0.3, 0.3, 0.3);
|
|
21
|
+
* grid.color1 = new Color(0.5, 0.5, 0.5);
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
11
24
|
* @category Helpers
|
|
12
25
|
* @group Components
|
|
26
|
+
* @see {@link Gizmos} for debug visualization
|
|
27
|
+
*
|
|
28
|
+
* 
|
|
13
29
|
*/
|
|
14
30
|
export class GridHelper extends Behaviour {
|
|
15
31
|
|
|
@@ -10,13 +10,35 @@ import { Behaviour } from "./Component.js";
|
|
|
10
10
|
const debug = getParam("debuggroundprojection");
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* GroundProjectedEnv
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* The [GroundProjectedEnv](https://engine.needle.tools/docs/api/GroundProjectedEnv) projects the environment map onto a virtual ground plane.
|
|
14
|
+
* Creates a realistic floor from 360° panoramas/HDRIs by deforming the skybox
|
|
15
|
+
* into a hemisphere with a beveled floor.
|
|
16
|
+
*
|
|
16
17
|
*
|
|
18
|
+
* [](https://engine.needle.tools/samples/ground-projection)
|
|
19
|
+
*
|
|
20
|
+
* **Key properties:**
|
|
21
|
+
* - `radius` - Size of the projection sphere (keep camera inside)
|
|
22
|
+
* - `height` - How high the original photo was taken (affects floor magnification)
|
|
23
|
+
* - `autoFit` - Automatically center and position at ground level
|
|
24
|
+
* - `arBlending` - Blend with real-world in AR (0=hidden, 1=visible)
|
|
25
|
+
*
|
|
26
|
+
* **Debug:** Use `?debuggroundprojection` URL parameter.
|
|
27
|
+
*
|
|
28
|
+
* @example Apply ground projection
|
|
29
|
+
* ```ts
|
|
30
|
+
* const ground = myObject.getComponent(GroundProjectedEnv);
|
|
31
|
+
* ground.radius = 100;
|
|
32
|
+
* ground.height = 2;
|
|
33
|
+
* ground.apply();
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
17
36
|
* @summary Projects the environment map onto the ground
|
|
18
37
|
* @category Rendering
|
|
19
38
|
* @group Components
|
|
39
|
+
* @see {@link Camera} for environment/skybox settings
|
|
40
|
+
* @see {@link ContactShadows} for ground shadows
|
|
41
|
+
* @link https://engine.needle.tools/samples/ground-projection for a demo of ground projection
|
|
20
42
|
*/
|
|
21
43
|
export class GroundProjectedEnv extends Behaviour {
|
|
22
44
|
|
|
@@ -1,8 +1,23 @@
|
|
|
1
1
|
import { Behaviour } from "./Component.js";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* UsageMarker indicates an object is currently being interacted with.
|
|
5
|
+
* Components like {@link DragControls} add this to prevent accidental deletion
|
|
6
|
+
* by {@link DeleteBox} while the user is dragging.
|
|
7
|
+
*
|
|
8
|
+
* @example Check if object is in use
|
|
9
|
+
* ```ts
|
|
10
|
+
* const marker = object.getComponent(UsageMarker);
|
|
11
|
+
* if (marker?.isUsed) {
|
|
12
|
+
* console.log("Object is being used by:", marker.usedBy);
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @summary Marks object as currently being interacted with
|
|
17
|
+
* @category Interactivity
|
|
18
|
+
* @group Components
|
|
19
|
+
* @see {@link DeleteBox} respects this marker
|
|
20
|
+
* @see {@link DragControls} adds this during drag
|
|
6
21
|
*/
|
|
7
22
|
export class UsageMarker extends Behaviour
|
|
8
23
|
{
|
|
@@ -5,12 +5,22 @@ import { Behaviour } from "./Component.js";
|
|
|
5
5
|
import { Rigidbody } from "./RigidBody.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Base class for physics joints
|
|
9
|
-
*
|
|
8
|
+
* Base class for physics joints that connect two {@link Rigidbody} components.
|
|
9
|
+
* Joints constrain how two bodies can move relative to each other.
|
|
10
|
+
*
|
|
11
|
+
* The joint is created between:
|
|
12
|
+
* - The {@link Rigidbody} on this GameObject (automatically found)
|
|
13
|
+
* - The {@link connectedBody} Rigidbody you specify
|
|
14
|
+
*
|
|
15
|
+
* @summary Connect two Rigidbodies with physics constraints
|
|
10
16
|
* @category Physics
|
|
11
17
|
* @group Components
|
|
18
|
+
* @see {@link FixedJoint} for rigid connections
|
|
19
|
+
* @see {@link HingeJoint} for rotating connections
|
|
20
|
+
* @see {@link Rigidbody} for physics bodies
|
|
12
21
|
*/
|
|
13
22
|
export abstract class Joint extends Behaviour {
|
|
23
|
+
/** The other Rigidbody to connect to */
|
|
14
24
|
@serializable(Rigidbody)
|
|
15
25
|
connectedBody?: Rigidbody;
|
|
16
26
|
|
|
@@ -37,10 +47,25 @@ export abstract class Joint extends Behaviour {
|
|
|
37
47
|
}
|
|
38
48
|
|
|
39
49
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
50
|
+
* FixedJoint locks two {@link Rigidbody} components together, making them move as one rigid unit.
|
|
51
|
+
* The bodies maintain their relative position and rotation at the time the joint is created.
|
|
52
|
+
*
|
|
53
|
+
* Use this for:
|
|
54
|
+
* - Attaching objects together permanently
|
|
55
|
+
* - Creating compound rigid bodies
|
|
56
|
+
* - Welding broken pieces back together
|
|
57
|
+
*
|
|
58
|
+
* @example Attach a weapon to a character
|
|
59
|
+
* ```ts
|
|
60
|
+
* const joint = weapon.addComponent(FixedJoint);
|
|
61
|
+
* joint.connectedBody = characterRigidbody;
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @summary Lock two Rigidbodies together rigidly
|
|
42
65
|
* @category Physics
|
|
43
66
|
* @group Components
|
|
67
|
+
* @see {@link Joint} base class
|
|
68
|
+
* @see {@link HingeJoint} for rotating connections
|
|
44
69
|
*/
|
|
45
70
|
export class FixedJoint extends Joint {
|
|
46
71
|
|
|
@@ -50,18 +75,36 @@ export class FixedJoint extends Joint {
|
|
|
50
75
|
}
|
|
51
76
|
|
|
52
77
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
78
|
+
* HingeJoint connects two {@link Rigidbody} components with a rotating constraint,
|
|
79
|
+
* like a door hinge or wheel axle. Bodies can only rotate around the specified axis.
|
|
80
|
+
*
|
|
81
|
+
* Use this for:
|
|
82
|
+
* - Doors and gates
|
|
83
|
+
* - Wheels and axles
|
|
84
|
+
* - Pendulums
|
|
85
|
+
* - Any rotating mechanical connection
|
|
86
|
+
*
|
|
87
|
+
* @example Create a door hinge
|
|
88
|
+
* ```ts
|
|
89
|
+
* const hinge = door.addComponent(HingeJoint);
|
|
90
|
+
* hinge.connectedBody = doorFrameRigidbody;
|
|
91
|
+
* hinge.anchor = new Vector3(0, 0, 0); // Hinge position
|
|
92
|
+
* hinge.axis = new Vector3(0, 1, 0); // Rotate around Y axis
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* @summary Connect two Rigidbodies with a rotating hinge
|
|
57
96
|
* @category Physics
|
|
58
97
|
* @group Components
|
|
98
|
+
* @see {@link Joint} base class
|
|
99
|
+
* @see {@link FixedJoint} for rigid connections
|
|
59
100
|
*/
|
|
60
101
|
export class HingeJoint extends Joint {
|
|
61
102
|
|
|
103
|
+
/** Local position of the hinge pivot point */
|
|
62
104
|
@serializable(Vector3)
|
|
63
105
|
anchor?: Vector3;
|
|
64
106
|
|
|
107
|
+
/** Axis of rotation for the hinge (e.g., Vector3(0,1,0) for vertical axis) */
|
|
65
108
|
@serializable(Vector3)
|
|
66
109
|
axis?: Vector3;
|
|
67
110
|
|
|
@@ -8,17 +8,32 @@ import { Renderer } from "./Renderer.js";
|
|
|
8
8
|
const debug = getParam("debuglods");
|
|
9
9
|
const noLods = getParam("nolods");
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Defines how LOD levels transition between each other
|
|
13
|
+
*/
|
|
11
14
|
enum LODFadeMode {
|
|
15
|
+
/** Instant switch between LOD levels */
|
|
12
16
|
None = 0,
|
|
17
|
+
/** Smooth cross-fade transition between levels */
|
|
13
18
|
CrossFade = 1,
|
|
19
|
+
/** SpeedTree-style blending for vegetation */
|
|
14
20
|
SpeedTree = 2,
|
|
15
21
|
}
|
|
16
22
|
|
|
23
|
+
/**
|
|
24
|
+
* Defines a single LOD level with its transition distance and associated renderers.
|
|
25
|
+
* Used by {@link LODGroup} to configure level of detail switching.
|
|
26
|
+
*/
|
|
17
27
|
export class LODModel {
|
|
28
|
+
/** Screen height ratio (0-1) at which this LOD becomes active */
|
|
18
29
|
@serializable()
|
|
19
30
|
screenRelativeTransitionHeight!: number;
|
|
31
|
+
|
|
32
|
+
/** Distance from camera at which this LOD becomes active */
|
|
20
33
|
@serializable()
|
|
21
34
|
distance!: number;
|
|
35
|
+
|
|
36
|
+
/** Renderers to show at this LOD level */
|
|
22
37
|
@serializable(Renderer)
|
|
23
38
|
renderers!: Renderer[];
|
|
24
39
|
}
|
|
@@ -39,23 +54,36 @@ declare class LODSetting {
|
|
|
39
54
|
}
|
|
40
55
|
|
|
41
56
|
/**
|
|
42
|
-
* LODGroup
|
|
43
|
-
*
|
|
57
|
+
* LODGroup manages multiple levels of detail for optimized rendering.
|
|
58
|
+
* Objects switch between different detail levels based on distance from camera.
|
|
59
|
+
*
|
|
60
|
+
* LOD levels are defined in {@link LODModel} objects, each specifying:
|
|
61
|
+
* - The distance at which that level becomes active
|
|
62
|
+
* - The {@link Renderer} components to show at that level
|
|
63
|
+
*
|
|
64
|
+
* This is useful for performance optimization - showing high-detail models up close
|
|
65
|
+
* and lower-detail versions at distance where the difference isn't visible.
|
|
66
|
+
*
|
|
67
|
+
* **Progressive Loading:**
|
|
68
|
+
* For automatic texture/mesh LOD streaming, see the `@needle-tools/gltf-progressive` package
|
|
69
|
+
* which provides progressive loading capabilities independent of this component.
|
|
70
|
+
*
|
|
71
|
+
* **Debug options:**
|
|
72
|
+
* - `?debuglods` - Log LOD switching information
|
|
73
|
+
* - `?nolods` - Disable LOD system entirely
|
|
74
|
+
*
|
|
44
75
|
* @summary Level of Detail Group for optimizing rendering
|
|
45
76
|
* @category Rendering
|
|
46
77
|
* @group Components
|
|
78
|
+
* @see {@link LODModel} for configuring individual LOD levels
|
|
79
|
+
* @see {@link Renderer} for the renderers controlled by LOD
|
|
80
|
+
* @see {@link LODsManager} for programmatic control of progressive LODs
|
|
81
|
+
* @link https://npmjs.com/package/@needle-tools/gltf-progressive
|
|
47
82
|
*/
|
|
48
83
|
export class LODGroup extends Behaviour {
|
|
49
|
-
|
|
50
|
-
fadeMode: LODFadeMode = LODFadeMode.None;
|
|
51
|
-
@serializable(Vector3)
|
|
52
|
-
localReferencePoint: Vector3 | undefined = undefined;
|
|
53
|
-
lodCount: number = 0;
|
|
54
|
-
size: number = 0;
|
|
55
|
-
animateCrossFading: boolean = false;
|
|
56
|
-
|
|
84
|
+
/** Array of LOD level configurations */
|
|
57
85
|
@serializable(LODModel)
|
|
58
|
-
lodModels
|
|
86
|
+
readonly lodModels: LODModel[] = []
|
|
59
87
|
|
|
60
88
|
private _lods: LOD[] = [];
|
|
61
89
|
private _settings: LODSetting[] = [];
|
|
@@ -145,6 +173,12 @@ export class LODGroup extends Behaviour {
|
|
|
145
173
|
|
|
146
174
|
private _distanceFactor = 1;
|
|
147
175
|
|
|
176
|
+
/**
|
|
177
|
+
* Adjusts all LOD transition distances by a multiplier.
|
|
178
|
+
* Values > 1 push LOD transitions further away (higher quality at distance).
|
|
179
|
+
* Values < 1 bring transitions closer (better performance).
|
|
180
|
+
* @param factor Multiplier to apply to all LOD distances
|
|
181
|
+
*/
|
|
148
182
|
distanceFactor(factor: number) {
|
|
149
183
|
if (factor === this._distanceFactor) return;
|
|
150
184
|
this._distanceFactor = factor;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { CameraHelper, Color, DirectionalLight, DirectionalLightHelper, Light as ThreeLight, OrthographicCamera, PointLight, SpotLight, Vector3 } from "three";
|
|
2
|
-
import { get } from "three-mesh-ui/build/types/core/DefaultValues.js";
|
|
3
2
|
|
|
4
3
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
5
4
|
import { FrameEvent } from "../engine/engine_setup.js";
|
|
6
5
|
import { setWorldPositionXYZ } from "../engine/engine_three_utils.js";
|
|
7
6
|
import type { ILight } from "../engine/engine_types.js";
|
|
8
7
|
import { getParam } from "../engine/engine_utils.js";
|
|
9
|
-
import { type NeedleXREventArgs } from "../engine/xr/api.js";
|
|
10
8
|
import { Behaviour, GameObject } from "./Component.js";
|
|
11
|
-
import { WebARSessionRoot } from "./webxr/WebARSessionRoot.js";
|
|
12
9
|
|
|
13
10
|
// https://threejs.org/examples/webgl_shadowmap_csm.html
|
|
14
11
|
|
|
@@ -26,7 +23,8 @@ const debug = getParam("debuglights");
|
|
|
26
23
|
|
|
27
24
|
|
|
28
25
|
/**
|
|
29
|
-
* Defines the type of light in a scene.
|
|
26
|
+
* Defines the type of light in a scene.
|
|
27
|
+
* @see {@link Light} for configuring light properties and behavior
|
|
30
28
|
*/
|
|
31
29
|
export enum LightType {
|
|
32
30
|
/** Spot light that emits light in a cone shape */
|
|
@@ -44,7 +42,8 @@ export enum LightType {
|
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
/**
|
|
47
|
-
* Defines how a light contributes to the scene lighting.
|
|
45
|
+
* Defines how a light contributes to the scene lighting.
|
|
46
|
+
* @see {@link Light} for configuring light properties and behavior
|
|
48
47
|
*/
|
|
49
48
|
export enum LightmapBakeType {
|
|
50
49
|
/** Light affects the scene in real-time with no baking */
|
|
@@ -58,6 +57,7 @@ export enum LightmapBakeType {
|
|
|
58
57
|
/**
|
|
59
58
|
* Defines the shadow casting options for a Light.
|
|
60
59
|
* @enum {number}
|
|
60
|
+
* @see {@link Light} for configuring shadow settings
|
|
61
61
|
*/
|
|
62
62
|
enum LightShadows {
|
|
63
63
|
/** No shadows are cast */
|
|
@@ -68,17 +68,39 @@ enum LightShadows {
|
|
|
68
68
|
Soft = 2,
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
71
|
+
/**
|
|
72
|
+
* [Light](https://engine.needle.tools/docs/api/Light) creates a light source in the scene for illuminating 3D objects.
|
|
73
|
+
*
|
|
74
|
+
* **Light types:**
|
|
75
|
+
* - `Directional` - Sun-like parallel rays (best for outdoor scenes)
|
|
76
|
+
* - `Point` - Omnidirectional from a point (bulbs, candles)
|
|
77
|
+
* - `Spot` - Cone-shaped (flashlights, stage lights)
|
|
78
|
+
*
|
|
79
|
+
* **Shadows:**
|
|
80
|
+
* Enable shadows via `shadows` property. Configure quality with shadow resolution
|
|
81
|
+
* settings. Directional lights support adaptive shadow cascades.
|
|
82
|
+
*
|
|
83
|
+
* **Performance tips:**
|
|
84
|
+
* - Use baked lighting (`lightmapBakeType = Baked`) when possible
|
|
85
|
+
* - Limit shadow-casting lights (1-2 recommended)
|
|
86
|
+
* - Reduce shadow resolution for mobile
|
|
87
|
+
*
|
|
88
|
+
* **Debug:** Use `?debuglights` URL parameter for visual helpers.
|
|
89
|
+
*
|
|
90
|
+
* @example Configure a directional light
|
|
91
|
+
* ```ts
|
|
92
|
+
* const light = myLight.getComponent(Light);
|
|
93
|
+
* light.intensity = 1.5;
|
|
94
|
+
* light.color = new Color(1, 0.95, 0.9); // Warm white
|
|
95
|
+
* light.shadows = LightShadows.Soft;
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
79
98
|
* @summary Light component for various light types and shadow settings
|
|
80
99
|
* @category Rendering
|
|
81
100
|
* @group Components
|
|
101
|
+
* @see {@link LightType} for available light types
|
|
102
|
+
* @see {@link ReflectionProbe} for environment reflections
|
|
103
|
+
* @see {@link Camera} for rendering configuration
|
|
82
104
|
*/
|
|
83
105
|
export class Light extends Behaviour implements ILight {
|
|
84
106
|
|
|
@@ -1,37 +1,55 @@
|
|
|
1
1
|
import { Object3D, Vector3 } from "three";
|
|
2
2
|
|
|
3
3
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
4
|
+
import type { LookAt } from "./api.js";
|
|
4
5
|
import { Behaviour } from "./Component.js";
|
|
5
6
|
import type { OrbitControls } from "./OrbitControls.js";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* The [LookAtConstraint](https://engine.needle.tools/docs/api/LookAtConstraint) component is primarely used by {@link OrbitControls} to set the camera's focus point.
|
|
10
|
+
* It does not have its own logic to update the look-at position.
|
|
11
|
+
*
|
|
12
|
+
* The constraint uses a list of source objects - the look-at target is
|
|
13
|
+
* calculated from the first source in the `sources` array.
|
|
14
|
+
*
|
|
15
|
+
* **Integration with OrbitControls:**
|
|
16
|
+
* When attached to the same GameObject as OrbitControls, this constraint
|
|
17
|
+
* controls where the camera orbits around and looks at.
|
|
18
|
+
*
|
|
19
|
+
* @summary Look At Constraint for camera targeting
|
|
12
20
|
* @category Camera and Controls
|
|
13
21
|
* @group Components
|
|
22
|
+
* @see {@link OrbitControls} for camera orbit controls
|
|
23
|
+
* @see {@link SmoothFollow} for smooth position/rotation following
|
|
24
|
+
* @see {@link LookAt} for directly making an object look at a target without using a constraint
|
|
14
25
|
*/
|
|
15
26
|
export class LookAtConstraint extends Behaviour {
|
|
16
27
|
|
|
17
28
|
/**
|
|
18
|
-
* When true the constraint is active.
|
|
29
|
+
* When true, the constraint is active and affects the target.
|
|
30
|
+
* Set to false to temporarily disable without removing sources.
|
|
19
31
|
*/
|
|
20
32
|
@serializable()
|
|
21
33
|
constraintActive: boolean = true;
|
|
34
|
+
|
|
22
35
|
/**
|
|
23
|
-
* When true the look
|
|
36
|
+
* When true, the look-at position is locked and won't update
|
|
37
|
+
* even if source objects move.
|
|
24
38
|
*/
|
|
25
39
|
@serializable()
|
|
26
40
|
locked: boolean = false;
|
|
41
|
+
|
|
27
42
|
/**
|
|
28
|
-
*
|
|
43
|
+
* Objects to look at. The first object in the array is used
|
|
44
|
+
* as the primary look-at target.
|
|
29
45
|
*/
|
|
30
46
|
@serializable(Object3D)
|
|
31
47
|
sources: Object3D[] = [];
|
|
32
48
|
|
|
33
49
|
/**
|
|
34
|
-
*
|
|
50
|
+
* Sets the world position that the constraint should look at.
|
|
51
|
+
* Updates the first source object's position.
|
|
52
|
+
* @param worldPosition The world-space position to look at
|
|
35
53
|
*/
|
|
36
54
|
setConstraintPosition(worldPosition: Vector3) {
|
|
37
55
|
const source = this.sources[0];
|
|
@@ -3,16 +3,38 @@ import { serializable } from '../engine/engine_serialization.js';
|
|
|
3
3
|
import { DeviceUtilities } from '../engine/engine_utils.js';
|
|
4
4
|
import { Behaviour } from './Component.js';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
/**
|
|
7
|
+
* [NeedleMenu](https://engine.needle.tools/docs/api/NeedleMenu) provides configuration for the built-in UI menu.
|
|
8
|
+
* The menu renders as HTML overlay in browser mode and automatically
|
|
9
|
+
* switches to a 3D spatial menu in VR/AR.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
11
|
+
* 
|
|
12
|
+
*
|
|
13
|
+
* **Features:**
|
|
14
|
+
* - Fullscreen toggle button
|
|
15
|
+
* - Audio mute/unmute button
|
|
16
|
+
* - QR code sharing (desktop only)
|
|
17
|
+
* - Spatial menu in XR (appears when looking up)
|
|
18
|
+
* - Custom positioning (top/bottom)
|
|
19
|
+
*
|
|
20
|
+
* **Programmatic access:**
|
|
21
|
+
* Access the menu API via `this.context.menu` to add custom buttons,
|
|
22
|
+
* show/hide elements, or modify behavior at runtime.
|
|
23
|
+
*
|
|
24
|
+
* @example Configure menu from code
|
|
25
|
+
* ```ts
|
|
26
|
+
* // Access the menu API
|
|
27
|
+
* this.context.menu.appendChild(myCustomButton);
|
|
28
|
+
* this.context.menu.setPosition("top");
|
|
29
|
+
* this.context.menu.showFullscreenOption(true);
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @summary Configuration component for the Needle Menu overlay
|
|
14
33
|
* @category User Interface
|
|
15
34
|
* @group Components
|
|
35
|
+
* @see {@link Context.menu} for programmatic menu control
|
|
36
|
+
* @see {@link Voip} adds a microphone button to the menu
|
|
37
|
+
* @see {@link ScreenCapture} adds a screen sharing button
|
|
16
38
|
**/
|
|
17
39
|
export class NeedleMenu extends Behaviour {
|
|
18
40
|
|
|
@@ -8,26 +8,62 @@ import { EventList } from "./EventList.js";
|
|
|
8
8
|
|
|
9
9
|
const debug = getParam("debugnestedgltf");
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
11
|
+
/**
|
|
12
|
+
* NestedGltf loads and instantiates a glTF file when the component starts.
|
|
13
|
+
* NestedGltf components are created by the Unity exporter when nesting Objects with the GltfObject component (in Unity).
|
|
14
|
+
* Use this for lazy-loading content, modular scene composition, or dynamic asset loading.
|
|
13
15
|
*
|
|
16
|
+
* 
|
|
17
|
+
*
|
|
18
|
+
* The loaded glTF is instantiated as a sibling (child of parent) by default,
|
|
19
|
+
* inheriting the transform of the GameObject with this component.
|
|
20
|
+
*
|
|
21
|
+
* **Features:**
|
|
22
|
+
* - Automatic loading on start
|
|
23
|
+
* - Progress callbacks for loading UI
|
|
24
|
+
* - Preloading support for faster display
|
|
25
|
+
* - Event callback when loading completes
|
|
26
|
+
*
|
|
27
|
+
* @example Load a glTF when object becomes active
|
|
28
|
+
* ```ts
|
|
29
|
+
* const nested = myPlaceholder.addComponent(NestedGltf);
|
|
30
|
+
* nested.filePath = new AssetReference("models/furniture.glb");
|
|
31
|
+
* nested.loaded.addEventListener(({ instance }) => {
|
|
32
|
+
* console.log("Loaded:", instance.name);
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example Preload for instant display
|
|
37
|
+
* ```ts
|
|
38
|
+
* // Preload during loading screen
|
|
39
|
+
* await nested.preload();
|
|
40
|
+
* // Later, when object becomes active, it displays instantly
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
14
43
|
* @summary Loads and instantiates a nested glTF file
|
|
15
44
|
* @category Asset Management
|
|
16
45
|
* @group Components
|
|
46
|
+
* @see {@link AssetReference} for asset loading utilities
|
|
47
|
+
* @see {@link SceneSwitcher} for scene-level loading
|
|
48
|
+
* @link https://engine.needle.tools/samples/hotspots
|
|
17
49
|
*/
|
|
18
50
|
export class NestedGltf extends Behaviour {
|
|
19
51
|
|
|
20
|
-
/**
|
|
52
|
+
/** Reference to the glTF file to load. Can be a URL or asset path. */
|
|
21
53
|
@serializable(AssetReference)
|
|
22
54
|
filePath?: AssetReference;
|
|
23
55
|
|
|
24
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Event fired when the glTF has been loaded and instantiated.
|
|
58
|
+
* Provides the component, loaded instance, and asset reference.
|
|
59
|
+
*/
|
|
25
60
|
@serializable(EventList)
|
|
26
61
|
loaded: EventList<{ component: NestedGltf, instance: any, asset: AssetReference }> = new EventList();
|
|
27
62
|
|
|
28
63
|
/**
|
|
29
64
|
* EXPERIMENTAL for cloud asset loading
|
|
30
65
|
*/
|
|
66
|
+
@serializable()
|
|
31
67
|
loadAssetInParent = true;
|
|
32
68
|
|
|
33
69
|
|
|
@@ -5,11 +5,35 @@ import * as utils from "./../engine/engine_three_utils.js";
|
|
|
5
5
|
import { Behaviour, GameObject } from "./Component.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* OffsetConstraint
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* The [OffsetConstraint](https://engine.needle.tools/docs/api/OffsetConstraint) maintains a fixed positional and rotational offset relative to a target object.
|
|
9
|
+
* Useful for attaching objects to moving targets while preserving a specific spatial relationship.
|
|
10
|
+
*
|
|
11
|
+
* **Use cases:**
|
|
12
|
+
* - Camera following a player with offset
|
|
13
|
+
* - UI elements attached to characters
|
|
14
|
+
* - Weapons attached to hands
|
|
15
|
+
* - Objects orbiting around a target
|
|
16
|
+
*
|
|
17
|
+
* **Options:**
|
|
18
|
+
* - `affectPosition` - Apply position offset
|
|
19
|
+
* - `affectRotation` - Apply rotation offset
|
|
20
|
+
* - `alignLookDirection` - Make object face same direction as target
|
|
21
|
+
* - `levelLookDirection` - Keep look direction horizontal (ignore pitch)
|
|
22
|
+
* - `levelPosition` - Project position onto horizontal plane
|
|
23
|
+
* - `referenceSpace` - Transform offset in this object's coordinate space
|
|
24
|
+
*
|
|
25
|
+
* @example Attach camera offset to player
|
|
26
|
+
* ```ts
|
|
27
|
+
* const constraint = camera.addComponent(OffsetConstraint);
|
|
28
|
+
* // Configure via serialized properties in editor
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @summary Maintains positional/rotational offset relative to target
|
|
11
32
|
* @category Constraints
|
|
12
33
|
* @group Components
|
|
34
|
+
* @see {@link SmoothFollow} for smoothed following
|
|
35
|
+
* @see {@link LookAtConstraint} for aim constraints
|
|
36
|
+
* @see {@link AlignmentConstraint} for alignment between two objects
|
|
13
37
|
*/
|
|
14
38
|
export class OffsetConstraint extends Behaviour {
|
|
15
39
|
|
|
@@ -60,12 +60,50 @@ declare module 'three/examples/jsm/controls/OrbitControls.js' {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
/**
|
|
64
|
+
* [OrbitControls](https://engine.needle.tools/docs/api/OrbitControls) provides interactive camera control using three.js OrbitControls.
|
|
65
|
+
* Users can rotate, pan, and zoom the camera to explore 3D scenes.
|
|
66
|
+
*
|
|
67
|
+
* **Features:**
|
|
68
|
+
* - Rotation around a target point (orbit)
|
|
69
|
+
* - Panning to move the view
|
|
70
|
+
* - Zooming via scroll or pinch
|
|
71
|
+
* - Auto-rotation for showcases
|
|
72
|
+
* - Configurable angle and distance limits
|
|
73
|
+
* - Smooth damping for natural feel
|
|
74
|
+
*
|
|
75
|
+
* 
|
|
76
|
+
*
|
|
77
|
+
* **Access underlying controls:**
|
|
78
|
+
* - `controls` - The three.js OrbitControls instance
|
|
79
|
+
* - `controllerObject` - The object being controlled (usually the camera)
|
|
80
|
+
*
|
|
81
|
+
* **Debug options:**
|
|
82
|
+
* - `?debugorbit` - Log orbit control events
|
|
83
|
+
* - `?freecam` - Enable unrestricted camera movement
|
|
84
|
+
*
|
|
85
|
+
* @example Basic setup
|
|
86
|
+
* ```ts
|
|
87
|
+
* const orbitControls = camera.getComponent(OrbitControls);
|
|
88
|
+
* orbitControls.autoRotate = true;
|
|
89
|
+
* orbitControls.autoRotateSpeed = 2;
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* @example Set look-at target
|
|
93
|
+
* ```ts
|
|
94
|
+
* orbitControls.setLookTargetPosition(new Vector3(0, 1, 0), true);
|
|
95
|
+
* // Or move both camera and target
|
|
96
|
+
* orbitControls.setCameraTargetPosition(new Vector3(5, 2, 5), new Vector3(0, 0, 0));
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
66
99
|
* @summary Camera controller using three.js OrbitControls
|
|
67
100
|
* @category Camera and Controls
|
|
68
101
|
* @group Components
|
|
102
|
+
* @see {@link LookAtConstraint} for setting the look-at target
|
|
103
|
+
* @see {@link SmoothFollow} for smooth camera following
|
|
104
|
+
* @see {@link Camera} for camera configuration
|
|
105
|
+
* @link https://threejs.org/docs/#examples/en/controls/OrbitControls
|
|
106
|
+
* @link https://engine.needle.tools/samples/panorama-controls alternative controls in samples
|
|
69
107
|
*/
|
|
70
108
|
export class OrbitControls extends Behaviour implements ICameraController {
|
|
71
109
|
|
|
@@ -7,7 +7,7 @@ import { Behaviour, GameObject } from "./Component.js";
|
|
|
7
7
|
import { AvatarMarker } from "./webxr/WebXRAvatar.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* PlayerColor
|
|
10
|
+
* [PlayerColor](https://engine.needle.tools/docs/api/PlayerColor) Assigns a unique color for each user in the room to the object it is attached to.
|
|
11
11
|
* The color is generated based on the user's ID.
|
|
12
12
|
*
|
|
13
13
|
* @summary Assigns a unique color to the player object
|