@needle-tools/engine 4.13.0 → 4.13.1-next.6cb1b73
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 +8 -1
- package/README.md +37 -0
- package/components.needle.json +1 -1
- package/custom-elements.json +138 -4
- package/dist/gltf-progressive-BTd714P0.min.js +9 -0
- package/dist/gltf-progressive-CrHduHPm.umd.cjs +9 -0
- package/dist/{gltf-progressive-eiJCrjLb.js → gltf-progressive-CsyU_5lc.js} +364 -287
- package/dist/{needle-engine.bundle-CxaKFQVS.min.js → needle-engine.bundle-DRSn34Va.min.js} +109 -109
- package/dist/{needle-engine.bundle-J4k4znv8.umd.cjs → needle-engine.bundle-qTjHpin6.umd.cjs} +110 -110
- package/dist/{needle-engine.bundle-Dl3TFYyv.js → needle-engine.bundle-wB3o8RB6.js} +2655 -2130
- package/dist/needle-engine.d.ts +4202 -423
- package/dist/needle-engine.js +3 -3
- 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 +28 -2
- 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 +37 -1
- package/lib/engine/engine_physics.js +37 -1
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +78 -0
- package/lib/engine/engine_physics_rapier.js +78 -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 +22 -5
- package/lib/engine/engine_utils.js +22 -5
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.d.ts +171 -14
- package/lib/engine/engine_utils_screenshot.js +65 -0
- package/lib/engine/engine_utils_screenshot.js.map +1 -1
- package/lib/engine/engine_utils_screenshot.xr.d.ts +1 -1
- package/lib/engine/engine_utils_screenshot.xr.js +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/NEEDLE_techniques_webgl.js +3 -0
- package/lib/engine/extensions/NEEDLE_techniques_webgl.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/xr/NeedleXRSession.d.ts +5 -0
- package/lib/engine/xr/NeedleXRSession.js +5 -0
- package/lib/engine/xr/NeedleXRSession.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 +28 -6
- package/lib/engine-components/ContactShadows.js +33 -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 +40 -12
- 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 +35 -0
- package/lib/engine-components/Renderer.js +36 -2
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +57 -5
- package/lib/engine-components/RigidBody.js +57 -5
- package/lib/engine-components/RigidBody.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 +39 -6
- package/lib/engine-components/ScreenCapture.js +39 -6
- package/lib/engine-components/ScreenCapture.js.map +1 -1
- package/lib/engine-components/SeeThrough.d.ts +70 -5
- package/lib/engine-components/SeeThrough.js +70 -5
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/ShadowCatcher.d.ts +56 -4
- package/lib/engine-components/ShadowCatcher.js +56 -4
- package/lib/engine-components/ShadowCatcher.js.map +1 -1
- package/lib/engine-components/Skybox.d.ts +43 -7
- package/lib/engine-components/Skybox.js +43 -7
- package/lib/engine-components/Skybox.js.map +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 +51 -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 +103 -14
- package/lib/engine-components/timeline/PlayableDirector.js +95 -25
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/TimelineModels.d.ts +14 -0
- package/lib/engine-components/timeline/TimelineModels.js +4 -0
- package/lib/engine-components/timeline/TimelineModels.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 +2 -1
- package/lib/engine-components/utils/OpenURL.js +2 -1
- package/lib/engine-components/utils/OpenURL.js.map +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 +172 -7
- package/lib/engine-components/web/CursorFollow.js +172 -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 +5 -1
- package/lib/engine-components/web/ScrollFollow.js +5 -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/WebARCameraBackground.d.ts +9 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js +9 -0
- package/lib/engine-components/webxr/WebARCameraBackground.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +11 -2
- package/lib/engine-components/webxr/WebXR.js +11 -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 +3 -3
- package/plugins/vite/custom-element-data.js +128 -19
- package/src/engine/engine_context.ts +33 -3
- 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 +41 -1
- package/src/engine/engine_physics_rapier.ts +81 -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 +22 -5
- package/src/engine/engine_utils_screenshot.ts +241 -17
- package/src/engine/engine_utils_screenshot.xr.ts +1 -1
- package/src/engine/extensions/NEEDLE_materialx.ts +5 -4
- package/src/engine/extensions/NEEDLE_techniques_webgl.ts +3 -0
- package/src/engine/extensions/index.ts +2 -2
- package/src/engine/xr/NeedleXRSession.ts +5 -0
- 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 +41 -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 +43 -15
- 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 +35 -1
- package/src/engine-components/RigidBody.ts +64 -8
- package/src/engine-components/SceneSwitcher.ts +11 -0
- package/src/engine-components/ScreenCapture.ts +42 -9
- package/src/engine-components/SeeThrough.ts +76 -9
- package/src/engine-components/ShadowCatcher.ts +61 -6
- package/src/engine-components/Skybox.ts +48 -12
- 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 +54 -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 +108 -27
- package/src/engine-components/timeline/SignalAsset.ts +1 -1
- package/src/engine-components/timeline/TimelineModels.ts +18 -2
- 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 +2 -1
- package/src/engine-components/web/Clickthrough.ts +119 -10
- package/src/engine-components/web/CursorFollow.ts +175 -9
- package/src/engine-components/web/HoverAnimation.ts +142 -13
- package/src/engine-components/web/ScrollFollow.ts +5 -1
- package/src/engine-components/web/ViewBox.ts +118 -18
- package/src/engine-components/webxr/TeleportTarget.ts +23 -4
- package/src/engine-components/webxr/WebARCameraBackground.ts +12 -3
- package/src/engine-components/webxr/WebXR.ts +12 -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
- package/dist/gltf-progressive-BURrJW0U.umd.cjs +0 -8
- package/dist/gltf-progressive-DHLDFNvQ.min.js +0 -8
|
@@ -4,6 +4,9 @@ import { ObjectUtils, PrimitiveType } from "../engine/engine_create_objects.js";
|
|
|
4
4
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
5
5
|
import { RGBAColor } from "../engine/js-extensions/index.js";
|
|
6
6
|
import { Behaviour } from "./Component.js";
|
|
7
|
+
import type { ContactShadows } from "./ContactShadows.js";
|
|
8
|
+
import type { Light } from "./Light.js";
|
|
9
|
+
import type { Renderer } from "./Renderer.js";
|
|
7
10
|
|
|
8
11
|
/**
|
|
9
12
|
* The mode of the ShadowCatcher.
|
|
@@ -18,14 +21,66 @@ enum ShadowMode {
|
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
|
-
* ShadowCatcher
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
24
|
+
* ShadowCatcher renders real-time shadows cast by lights onto a mesh surface.
|
|
25
|
+
* Captures actual shadow data from the scene's lighting system (directional lights, point lights, spot lights).
|
|
26
|
+
*
|
|
27
|
+
* If the GameObject is a Mesh, it applies a shadow-catching material to it.
|
|
28
|
+
* Otherwise, it creates a quad mesh with the shadow-catching material automatically.
|
|
29
|
+
*
|
|
30
|
+
* [](https://engine.needle.tools/samples/shadow-catcher/)
|
|
31
|
+
* *Additive ShadowCatcher mode with point light shadows*
|
|
32
|
+
*
|
|
33
|
+
* [](https://engine.needle.tools/samples/transmission/)
|
|
34
|
+
* *ShadowCatcher with directional light shadows*
|
|
35
|
+
*
|
|
36
|
+
* **Shadow Modes:**
|
|
37
|
+
* - `ShadowMask` - Only renders shadows (works best with directional lights)
|
|
38
|
+
* - `Additive` - Renders light additively (works best with point/spot lights)
|
|
39
|
+
* - `Occluder` - Occludes light without rendering shadows
|
|
40
|
+
*
|
|
41
|
+
* **ShadowCatcher vs ContactShadows:**
|
|
42
|
+
* - **ShadowCatcher**: Real-time shadows from actual lights. Accurate directional shadows that match light sources. Requires lights with shadows enabled. Updates every frame.
|
|
43
|
+
* - **{@link ContactShadows}**: Proximity-based ambient occlusion-style shadows. Extremely soft and diffuse, ideal for subtle grounding. Better performance, works without lights.
|
|
44
|
+
*
|
|
45
|
+
* **When to use ShadowCatcher:**
|
|
46
|
+
* - You need accurate shadows that match specific light directions
|
|
47
|
+
* - Scene has real-time lighting with shadow-casting lights
|
|
48
|
+
* - Shadows need to follow light attenuation and angles
|
|
49
|
+
* - AR/VR scenarios where light estimation is available
|
|
50
|
+
* - Hard or semi-hard shadow edges are desired
|
|
51
|
+
*
|
|
52
|
+
* **When to use ContactShadows instead:**
|
|
53
|
+
* - You want very soft, ambient occlusion-style ground shadows
|
|
54
|
+
* - Performance is critical (no per-frame shadow rendering)
|
|
55
|
+
* - Scene doesn't have shadow-casting lights
|
|
56
|
+
* - Product visualization or configurators (subtle grounding effect)
|
|
57
|
+
* - Soft, diffuse shadows are more visually appealing than accurate ones
|
|
58
|
+
*
|
|
59
|
+
* **Note:** ShadowCatcher meshes are not raycastable by default (layer 2). Change layers in `onEnable()` if raycasting is needed.
|
|
60
|
+
*
|
|
61
|
+
* @example Basic shadow catcher plane
|
|
62
|
+
* ```ts
|
|
63
|
+
* const plane = new Object3D();
|
|
64
|
+
* const catcher = addComponent(plane, ShadowCatcher);
|
|
65
|
+
* catcher.mode = ShadowMode.ShadowMask;
|
|
66
|
+
* catcher.shadowColor = new RGBAColor(0, 0, 0, 0.8);
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example Apply to existing mesh
|
|
70
|
+
* ```ts
|
|
71
|
+
* const mesh = this.gameObject.getComponent(Mesh);
|
|
72
|
+
* const catcher = addComponent(mesh, ShadowCatcher);
|
|
73
|
+
* // The mesh will now catch shadows from scene lights
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* @summary Renders real-time shadows from lights onto surfaces
|
|
27
77
|
* @category Rendering
|
|
28
78
|
* @group Components
|
|
79
|
+
* @see {@link ContactShadows} for proximity-based fake shadows (better performance)
|
|
80
|
+
* @see {@link Light} for shadow-casting light configuration
|
|
81
|
+
* @see {@link Renderer} for shadow receiving settings
|
|
82
|
+
* @link https://engine.needle.tools/samples/shadow-catcher/
|
|
83
|
+
* @link https://engine.needle.tools/samples/transmission/
|
|
29
84
|
*/
|
|
30
85
|
export class ShadowCatcher extends Behaviour {
|
|
31
86
|
|
|
@@ -114,20 +114,52 @@ ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, () => {
|
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
/**
|
|
117
|
-
* RemoteSkybox
|
|
118
|
-
* It supports .hdr, .exr, .jpg, .png files.
|
|
119
|
-
*
|
|
117
|
+
* The [RemoteSkybox](https://engine.needle.tools/docs/api/RemoteSkybox) component allows you to set the skybox or environment texture of a scene from a URL, a local file or a static skybox name.
|
|
118
|
+
* It supports .hdr, .exr, .jpg, .png, and .ktx2 files.
|
|
119
|
+
*
|
|
120
|
+
* **HTML Attributes:**
|
|
121
|
+
* You can control skybox and environment from HTML using `<needle-engine>` attributes:
|
|
122
|
+
* - `background-image`: Sets the scene background/skybox image
|
|
123
|
+
* - `environment-image`: Sets the scene environment map (for reflections and lighting)
|
|
124
|
+
*
|
|
125
|
+
* These attributes accept URLs or magic skybox names (see examples below).
|
|
126
|
+
*
|
|
127
|
+
* **Magic Skybox Names:**
|
|
128
|
+
* Built-in optimized skyboxes hosted on Needle CDN:
|
|
129
|
+
* - `"studio"` - Neutral studio lighting (default)
|
|
130
|
+
* - `"blurred-skybox"` - Blurred environment
|
|
131
|
+
* - `"quicklook"` - Apple QuickLook object mode style
|
|
132
|
+
* - `"quicklook-ar"` - Apple QuickLook AR mode style
|
|
133
|
+
*
|
|
120
134
|
* ### Events
|
|
121
135
|
* - `dropped-unknown-url`: Emitted when a file is dropped on the scene. The event detail contains the sender, the url and a function to apply the url.
|
|
122
|
-
*
|
|
123
|
-
* @example
|
|
136
|
+
*
|
|
137
|
+
* @example Using HTML attributes
|
|
138
|
+
* ```html
|
|
139
|
+
* <needle-engine
|
|
140
|
+
* background-image="https://example.com/skybox.hdr"
|
|
141
|
+
* environment-image="studio">
|
|
142
|
+
* </needle-engine>
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
145
|
+
* @example Using magic skybox names
|
|
146
|
+
* ```html
|
|
147
|
+
* <needle-engine background-image="studio"></needle-engine>
|
|
148
|
+
* <needle-engine environment-image="quicklook"></needle-engine>
|
|
149
|
+
* ```
|
|
150
|
+
*
|
|
151
|
+
* @example Adding via code
|
|
124
152
|
* ```ts
|
|
125
|
-
* GameObject.addComponent(gameObject,
|
|
153
|
+
* GameObject.addComponent(gameObject, RemoteSkybox, {
|
|
154
|
+
* url: "https://example.com/skybox.hdr",
|
|
155
|
+
* background: true,
|
|
156
|
+
* environment: true
|
|
157
|
+
* });
|
|
126
158
|
* ```
|
|
127
|
-
*
|
|
128
|
-
* @example
|
|
159
|
+
*
|
|
160
|
+
* @example Handle custom dropped URL
|
|
129
161
|
* ```ts
|
|
130
|
-
* const skybox = GameObject.addComponent(gameObject,
|
|
162
|
+
* const skybox = GameObject.addComponent(gameObject, RemoteSkybox);
|
|
131
163
|
* skybox.addEventListener("dropped-unknown-url", (evt) => {
|
|
132
164
|
* let url = evt.detail.url;
|
|
133
165
|
* console.log("User dropped file", url);
|
|
@@ -137,15 +169,19 @@ ContextRegistry.registerCallback(ContextEvent.ContextCreationStart, () => {
|
|
|
137
169
|
* evt.detail.apply(url);
|
|
138
170
|
* });
|
|
139
171
|
* ```
|
|
140
|
-
*
|
|
141
|
-
* @example
|
|
172
|
+
*
|
|
173
|
+
* @example Update skybox at runtime
|
|
142
174
|
* ```ts
|
|
143
175
|
* skybox.setSkybox("https://example.com/skybox.hdr");
|
|
176
|
+
* // Or use a magic name:
|
|
177
|
+
* skybox.setSkybox("studio");
|
|
144
178
|
* ```
|
|
145
|
-
*
|
|
179
|
+
*
|
|
146
180
|
* @summary Sets the skybox or environment texture of a scene
|
|
147
181
|
* @category Rendering
|
|
148
182
|
* @group Components
|
|
183
|
+
* @see {@link Camera} for clearFlags and background control
|
|
184
|
+
* @link https://engine.needle.tools/docs/html.html#needle-engine-element
|
|
149
185
|
*/
|
|
150
186
|
export class RemoteSkybox extends Behaviour {
|
|
151
187
|
|
|
@@ -4,14 +4,58 @@ import { Mathf } from "../engine/engine_math.js";
|
|
|
4
4
|
import { Axes } from "../engine/engine_physics.types.js";
|
|
5
5
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
6
6
|
import { getWorldPosition, getWorldQuaternion } from "../engine/engine_three_utils.js";
|
|
7
|
+
import type { LookAt } from "./api.js";
|
|
7
8
|
import { Behaviour } from "./Component.js";
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
|
-
* SmoothFollow makes
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* [SmoothFollow](https://engine.needle.tools/docs/api/SmoothFollow) makes this GameObject smoothly follow another target object's position and/or rotation.
|
|
12
|
+
*
|
|
13
|
+
* **Position Following:**
|
|
14
|
+
* When enabled (`followFactor > 0`), this object will move towards the target's world position.
|
|
15
|
+
* The object interpolates from its current position to the target's position each frame.
|
|
16
|
+
* Use `positionAxes` to restrict following to specific axes (e.g., only horizontal movement).
|
|
17
|
+
*
|
|
18
|
+
* **Rotation Following:**
|
|
19
|
+
* When enabled (`rotateFactor > 0`), this object will rotate to match the target's world rotation.
|
|
20
|
+
* The object smoothly interpolates from its current rotation to the target's rotation each frame.
|
|
21
|
+
* This makes the object face the same direction as the target, not look at it (use {@link LookAt} for that).
|
|
22
|
+
*
|
|
23
|
+
* **Smoothing:**
|
|
24
|
+
* Both position and rotation use time-based interpolation (lerp/slerp).
|
|
25
|
+
* Higher factor values = faster following (less lag), lower values = slower following (more lag).
|
|
26
|
+
* Set a factor to 0 to disable that type of following entirely.
|
|
27
|
+
*
|
|
28
|
+
* **Common Use Cases:**
|
|
29
|
+
* - Camera following a player character
|
|
30
|
+
* - UI elements tracking world objects
|
|
31
|
+
* - Delayed motion effects (ghost trails, spring arms)
|
|
32
|
+
* - Smoothed object attachment
|
|
33
|
+
*
|
|
34
|
+
* @example Follow a target with smooth position
|
|
35
|
+
* ```ts
|
|
36
|
+
* const follower = myObject.addComponent(SmoothFollow);
|
|
37
|
+
* follower.target = playerObject;
|
|
38
|
+
* follower.followFactor = 5; // Higher = faster following
|
|
39
|
+
* follower.rotateFactor = 0; // Don't follow rotation
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @example Follow only on horizontal plane
|
|
43
|
+
* ```ts
|
|
44
|
+
* follower.positionAxes = Axes.X | Axes.Z; // Follow X and Z only (no vertical)
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example Follow both position and rotation
|
|
48
|
+
* ```ts
|
|
49
|
+
* follower.target = targetObject;
|
|
50
|
+
* follower.followFactor = 3; // Smooth position following
|
|
51
|
+
* follower.rotateFactor = 2; // Smooth rotation following
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
54
|
+
* @summary Smoothly follows a target object's position and/or rotation
|
|
13
55
|
* @category Interactivity
|
|
14
56
|
* @group Components
|
|
57
|
+
* @see {@link LookAtConstraint} for making an object look at a target (different from rotation following)
|
|
58
|
+
* @see {@link Mathf} for the interpolation used
|
|
15
59
|
*/
|
|
16
60
|
export class SmoothFollow extends Behaviour {
|
|
17
61
|
|
|
@@ -22,21 +66,34 @@ export class SmoothFollow extends Behaviour {
|
|
|
22
66
|
target: Object3D | null = null;
|
|
23
67
|
|
|
24
68
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
69
|
+
* Speed factor for position following.
|
|
70
|
+
* Controls how quickly this object moves to match the target's position.
|
|
71
|
+
* Higher values = faster/tighter following (less lag), lower = slower/looser (more lag).
|
|
72
|
+
* Set to 0 to disable position following entirely.
|
|
73
|
+
* @default 0.1
|
|
27
74
|
*/
|
|
28
75
|
@serializable()
|
|
29
76
|
followFactor = .1;
|
|
77
|
+
|
|
30
78
|
/**
|
|
31
|
-
*
|
|
32
|
-
*
|
|
79
|
+
* Speed factor for rotation following.
|
|
80
|
+
* Controls how quickly this object rotates to match the target's rotation.
|
|
81
|
+
* Higher values = faster/tighter following (less lag), lower = slower/looser (more lag).
|
|
82
|
+
* Set to 0 to disable rotation following entirely.
|
|
83
|
+
* @default 0.1
|
|
33
84
|
*/
|
|
34
85
|
@serializable()
|
|
35
86
|
rotateFactor = .1;
|
|
36
87
|
|
|
88
|
+
/**
|
|
89
|
+
* Which position axes to follow. Use bitwise OR to combine:
|
|
90
|
+
* `Axes.X | Axes.Y` follows only X and Y axes.
|
|
91
|
+
* @default Axes.All
|
|
92
|
+
*/
|
|
37
93
|
@serializable()
|
|
38
94
|
positionAxes: Axes = Axes.All;
|
|
39
95
|
|
|
96
|
+
/** When true, rotates 180° around Y axis (useful for mirrored setups) */
|
|
40
97
|
flipForward: boolean = false;
|
|
41
98
|
|
|
42
99
|
private static _invertForward: Quaternion = new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), Math.PI);
|
|
@@ -49,6 +106,10 @@ export class SmoothFollow extends Behaviour {
|
|
|
49
106
|
this.updateNow(false);
|
|
50
107
|
}
|
|
51
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Manually update the position/rotation to follow the target.
|
|
111
|
+
* @param hard If true, snaps instantly to target without smoothing
|
|
112
|
+
*/
|
|
52
113
|
updateNow(hard: boolean) {
|
|
53
114
|
if (!this.target || this.target === this.gameObject) return;
|
|
54
115
|
if (this.followFactor > 0) {
|
|
@@ -24,11 +24,34 @@ function testMask(mask1, mask2) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
|
-
* Component that receives and responds to spatial events, like entering or exiting a trigger zone.
|
|
28
|
-
* Used in conjunction with {@link SpatialTrigger} to create interactive spatial events.
|
|
27
|
+
* Component that receives and responds to spatial events, like entering or exiting a trigger zone.
|
|
28
|
+
* Used in conjunction with {@link SpatialTrigger} to create interactive spatial events.
|
|
29
|
+
*
|
|
30
|
+
* Place this on objects that should react when entering trigger zones. The receiver checks
|
|
31
|
+
* against all active SpatialTriggers each frame and fires events when intersections change.
|
|
32
|
+
*
|
|
33
|
+
* Events can be connected via {@link EventList} in the editor or listened to in code.
|
|
34
|
+
*
|
|
35
|
+
* @example Listen to trigger events
|
|
36
|
+
* ```ts
|
|
37
|
+
* export class DoorTrigger extends Behaviour {
|
|
38
|
+
* @serializable(SpatialTriggerReceiver)
|
|
39
|
+
* receiver?: SpatialTriggerReceiver;
|
|
40
|
+
*
|
|
41
|
+
* start() {
|
|
42
|
+
* this.receiver?.onEnter?.addEventListener(() => {
|
|
43
|
+
* console.log("Player entered door zone");
|
|
44
|
+
* });
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
29
49
|
* @summary Receives spatial trigger events
|
|
30
50
|
* @category Interactivity
|
|
31
51
|
* @group Components
|
|
52
|
+
* @see {@link SpatialTrigger} for defining trigger zones
|
|
53
|
+
* @see {@link EventList} for event handling
|
|
54
|
+
* @link https://engine.needle.tools/samples/spatial-triggers/
|
|
32
55
|
*/
|
|
33
56
|
export class SpatialTriggerReceiver extends Behaviour {
|
|
34
57
|
|
|
@@ -126,10 +149,34 @@ export class SpatialTriggerReceiver extends Behaviour {
|
|
|
126
149
|
}
|
|
127
150
|
|
|
128
151
|
/**
|
|
129
|
-
* A spatial trigger component that detects objects within a box-shaped area.
|
|
130
|
-
* Used to trigger events when objects enter, stay in, or exit the defined area
|
|
152
|
+
* A spatial trigger component that detects objects within a box-shaped area.
|
|
153
|
+
* Used to trigger events when objects enter, stay in, or exit the defined area.
|
|
154
|
+
*
|
|
155
|
+
* The trigger area is defined by the GameObject's bounding box (uses {@link BoxHelperComponent}).
|
|
156
|
+
* Objects with {@link SpatialTriggerReceiver} components are tested against this area.
|
|
157
|
+
*
|
|
158
|
+
* **Mask system:** Both trigger and receiver have a `triggerMask` - they only interact
|
|
159
|
+
* when their masks have overlapping bits set. This allows selective triggering.
|
|
160
|
+
*
|
|
161
|
+
* **Debug:** Use `?debugspatialtrigger` URL parameter to visualize trigger zones.
|
|
162
|
+
*
|
|
163
|
+
* @example Create a pickup zone
|
|
164
|
+
* ```ts
|
|
165
|
+
* // On the pickup zone object
|
|
166
|
+
* const trigger = pickupZone.addComponent(SpatialTrigger);
|
|
167
|
+
* trigger.triggerMask = 1; // Layer 1 for pickups
|
|
168
|
+
*
|
|
169
|
+
* // On the player
|
|
170
|
+
* const receiver = player.addComponent(SpatialTriggerReceiver);
|
|
171
|
+
* receiver.triggerMask = 1; // Match the pickup layer
|
|
172
|
+
* ```
|
|
173
|
+
*
|
|
174
|
+
* @summary Define a trigger zone that detects entering objects
|
|
131
175
|
* @category Interactivity
|
|
132
176
|
* @group Components
|
|
177
|
+
* @see {@link SpatialTriggerReceiver} for objects that respond to triggers
|
|
178
|
+
* @see {@link BoxHelperComponent} for the underlying box used to define the trigger area
|
|
179
|
+
* @link https://engine.needle.tools/samples/spatial-triggers/
|
|
133
180
|
*/
|
|
134
181
|
export class SpatialTrigger extends Behaviour {
|
|
135
182
|
|
|
@@ -31,14 +31,32 @@ export enum SpectatorMode {
|
|
|
31
31
|
const debug = getParam("debugspectator");
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
34
|
+
* SpectatorCamera enables following and spectating other users in networked sessions.
|
|
35
|
+
* Switch between first-person (see what they see) and third-person (orbit around them) views.
|
|
36
|
+
*
|
|
37
|
+
* **Keyboard controls** (when `useKeys = true`):
|
|
38
|
+
* - `F` - Request all users to follow the local player
|
|
39
|
+
* - `ESC` - Stop spectating
|
|
40
|
+
*
|
|
41
|
+
* **Spectator modes:**
|
|
42
|
+
* - `FirstPerson` - View from the followed player's perspective
|
|
43
|
+
* - `ThirdPerson` - Freely orbit around the followed player
|
|
44
|
+
*
|
|
45
|
+
* **Debug:** Use `?debugspectator` URL parameter for logging.
|
|
46
|
+
*
|
|
47
|
+
* @example Start spectating a user
|
|
48
|
+
* ```ts
|
|
49
|
+
* const spectator = camera.getComponent(SpectatorCamera);
|
|
50
|
+
* spectator.follow(targetUserId);
|
|
51
|
+
* spectator.mode = SpectatorMode.ThirdPerson;
|
|
52
|
+
* ```
|
|
53
|
+
*
|
|
39
54
|
* @summary Spectator camera for following other users
|
|
40
55
|
* @category Networking
|
|
41
56
|
* @group Components
|
|
57
|
+
* @see {@link SpectatorMode} for view options
|
|
58
|
+
* @see {@link SyncedRoom} for networked sessions
|
|
59
|
+
* @see {@link OrbitControls} for third-person orbit
|
|
42
60
|
*/
|
|
43
61
|
export class SpectatorCamera extends Behaviour {
|
|
44
62
|
|
|
@@ -11,8 +11,8 @@ const viewParamName = "view";
|
|
|
11
11
|
const debug = utils.getParam("debugsyncedroom");
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* SyncedRoom is a behaviour that will attempt to join a networked room based on the URL parameters or a random room.
|
|
15
|
-
* It will also create a button in the menu to join or leave the room.
|
|
14
|
+
* [SyncedRoom](https://engine.needle.tools/docs/api/SyncedRoom) is a behaviour that will attempt to join a networked room based on the URL parameters or a random room.
|
|
15
|
+
* It will also create a button in the menu to join or leave the room.
|
|
16
16
|
* You can also join a networked room by calling the core methods like `this.context.connection.joinRoom("roomName")`.
|
|
17
17
|
*
|
|
18
18
|
* @example Join a networked room
|
|
@@ -33,9 +33,15 @@ const debug = utils.getParam("debugsyncedroom");
|
|
|
33
33
|
* myObject.addComponent(SyncedRoom, { joinRandomRoom: true, roomPrefix: "myApp_" });
|
|
34
34
|
* ```
|
|
35
35
|
*
|
|
36
|
+
* **Debug:** Use `?debugsyncedroom` URL parameter for logging.
|
|
37
|
+
*
|
|
36
38
|
* @summary Joins a networked room based on URL parameters or a random room
|
|
37
39
|
* @category Networking
|
|
38
40
|
* @group Components
|
|
41
|
+
* @see {@link SyncedTransform} for synchronizing object transforms
|
|
42
|
+
* @see {@link Voip} for voice communication in rooms
|
|
43
|
+
* @see {@link ScreenCapture} for screen/video sharing
|
|
44
|
+
* @link https://engine.needle.tools/docs/networking.html
|
|
39
45
|
*/
|
|
40
46
|
export class SyncedRoom extends Behaviour {
|
|
41
47
|
|
|
@@ -55,12 +55,48 @@ onUpdate((ctx) => {
|
|
|
55
55
|
})
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
|
-
* SyncedTransform synchronizes
|
|
59
|
-
*
|
|
60
|
-
*
|
|
58
|
+
* SyncedTransform synchronizes position and rotation of a GameObject across the network.
|
|
59
|
+
* When users interact with an object (e.g., via {@link DragControls}), they automatically
|
|
60
|
+
* take ownership and their changes are broadcast to other users.
|
|
61
|
+
*
|
|
62
|
+
* **Features:**
|
|
63
|
+
* - Automatic ownership transfer when interacting
|
|
64
|
+
* - Smooth interpolation of remote updates
|
|
65
|
+
* - Physics integration (can override kinematic state)
|
|
66
|
+
* - Fast mode for rapidly moving objects
|
|
67
|
+
*
|
|
68
|
+
* **Requirements:**
|
|
69
|
+
* - Active network connection via {@link SyncedRoom}
|
|
70
|
+
* - Objects must have unique GUIDs (set automatically in Unity/Blender export)
|
|
71
|
+
*
|
|
72
|
+
* **Ownership:**
|
|
73
|
+
* This component uses {@link OwnershipModel} internally to manage object ownership.
|
|
74
|
+
* Only the client that owns an object can send transform updates. Use `requestOwnership()`
|
|
75
|
+
* before modifying the transform, or check `hasOwnership()` to see if you can modify it.
|
|
76
|
+
*
|
|
77
|
+
* **Debug:** Use `?debugsync` URL parameter for logging.
|
|
78
|
+
*
|
|
79
|
+
* @example Basic networked object
|
|
80
|
+
* ```ts
|
|
81
|
+
* // Add to any object you want synced
|
|
82
|
+
* const sync = myObject.addComponent(SyncedTransform);
|
|
83
|
+
* sync.fastMode = true; // For fast-moving objects
|
|
84
|
+
*
|
|
85
|
+
* // Request ownership before modifying
|
|
86
|
+
* sync.requestOwnership();
|
|
87
|
+
* myObject.position.x += 1;
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* - Example: https://engine.needle.tools/samples/collaborative-sandbox
|
|
91
|
+
*
|
|
61
92
|
* @summary Synchronizes object transform over the network with ownership management
|
|
62
93
|
* @category Networking
|
|
63
94
|
* @group Components
|
|
95
|
+
* @see {@link SyncedRoom} for room/session management
|
|
96
|
+
* @see {@link OwnershipModel} for ownership management details
|
|
97
|
+
* @see {@link DragControls} for interactive dragging with sync
|
|
98
|
+
* @see {@link Duplicatable} for networked object spawning
|
|
99
|
+
* @link https://engine.needle.tools/docs/networking.html
|
|
64
100
|
*/
|
|
65
101
|
export class SyncedTransform extends Behaviour {
|
|
66
102
|
|
|
@@ -94,9 +130,18 @@ export class SyncedTransform extends Behaviour {
|
|
|
94
130
|
private _receivedFastUpdate: boolean = false;
|
|
95
131
|
private _shouldRequestOwnership: boolean = false;
|
|
96
132
|
|
|
97
|
-
/**
|
|
133
|
+
/**
|
|
98
134
|
* Requests ownership of this object on the network.
|
|
99
135
|
* You need to be connected to a room for this to work.
|
|
136
|
+
* Call this before modifying the object's transform to ensure your changes are synchronized.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* // Request ownership before modifying
|
|
141
|
+
* syncedTransform.requestOwnership();
|
|
142
|
+
* this.gameObject.position.y += 1;
|
|
143
|
+
* ```
|
|
144
|
+
* @see {@link OwnershipModel.requestOwnership} for more details
|
|
100
145
|
*/
|
|
101
146
|
public requestOwnership() {
|
|
102
147
|
if (debug)
|
|
@@ -110,25 +155,29 @@ export class SyncedTransform extends Behaviour {
|
|
|
110
155
|
}
|
|
111
156
|
|
|
112
157
|
/**
|
|
113
|
-
* Free ownership of this object on the network.
|
|
114
|
-
* You need to be connected to a room for this to work.
|
|
158
|
+
* Free ownership of this object on the network.
|
|
159
|
+
* You need to be connected to a room for this to work.
|
|
115
160
|
* This will also be called automatically when the component is disabled.
|
|
161
|
+
* Call this when you're done modifying an object to allow other users to interact with it.
|
|
162
|
+
* @see {@link OwnershipModel.freeOwnership} for more details
|
|
116
163
|
*/
|
|
117
164
|
public freeOwnership() {
|
|
118
165
|
this._model?.freeOwnership();
|
|
119
166
|
}
|
|
120
167
|
|
|
121
168
|
/**
|
|
122
|
-
* Checks if this client has ownership of the object
|
|
123
|
-
* @returns true if this client has ownership, false if not, undefined if ownership state is unknown
|
|
169
|
+
* Checks if this client has ownership of the object.
|
|
170
|
+
* @returns `true` if this client has ownership, `false` if not, `undefined` if ownership state is unknown
|
|
171
|
+
* @see {@link OwnershipModel.hasOwnership} for more details
|
|
124
172
|
*/
|
|
125
173
|
public hasOwnership(): boolean | undefined {
|
|
126
174
|
return this._model?.hasOwnership ?? undefined;
|
|
127
175
|
}
|
|
128
176
|
|
|
129
177
|
/**
|
|
130
|
-
* Checks if the object is owned by any client
|
|
131
|
-
* @returns true if the object is owned, false if not, undefined if ownership state is unknown
|
|
178
|
+
* Checks if the object is owned by any client (local or remote).
|
|
179
|
+
* @returns `true` if the object is owned, `false` if not, `undefined` if ownership state is unknown
|
|
180
|
+
* @see {@link OwnershipModel.isOwned} for more details
|
|
132
181
|
*/
|
|
133
182
|
public isOwned(): boolean | undefined {
|
|
134
183
|
return this._model?.isOwned;
|
|
@@ -8,12 +8,39 @@ import { OrbitControls } from "./OrbitControls.js";
|
|
|
8
8
|
import { SyncedTransform } from "./SyncedTransform.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* TransformGizmo displays manipulation controls for translating, rotating, and scaling objects
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
11
|
+
* The [TransformGizmo](https://engine.needle.tools/docs/api/TransformGizmo) displays manipulation controls for translating, rotating, and scaling objects.
|
|
12
|
+
* Wraps three.js {@link TransformControls} with keyboard shortcuts and snapping support.
|
|
13
|
+
*
|
|
14
|
+
* **Keyboard shortcuts:**
|
|
15
|
+
* - `W` - Translate mode
|
|
16
|
+
* - `E` - Rotate mode
|
|
17
|
+
* - `R` - Scale mode
|
|
18
|
+
* - `Q` - Toggle local/world space
|
|
19
|
+
* - `Shift` (hold) - Enable grid snapping
|
|
20
|
+
* - `+/-` - Adjust gizmo size
|
|
21
|
+
* - `X/Y/Z` - Toggle axis visibility
|
|
22
|
+
* - `Space` - Toggle controls enabled
|
|
23
|
+
*
|
|
24
|
+
* **Snapping:**
|
|
25
|
+
* Configure grid snapping with `translationSnap`, `rotationSnapAngle`, and `scaleSnap`.
|
|
26
|
+
*
|
|
27
|
+
* **Networking:**
|
|
28
|
+
* Automatically works with {@link SyncedTransform} for multiplayer editing.
|
|
29
|
+
*
|
|
30
|
+
* @example Add transform gizmo to an object
|
|
31
|
+
* ```ts
|
|
32
|
+
* const gizmo = editableObject.addComponent(TransformGizmo);
|
|
33
|
+
* gizmo.translationSnap = 0.5; // Snap to 0.5 unit grid
|
|
34
|
+
* gizmo.rotationSnapAngle = 45; // Snap to 45° increments
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @summary Object manipulation gizmo for translate/rotate/scale
|
|
15
38
|
* @category Helpers
|
|
16
39
|
* @group Components
|
|
40
|
+
* @see {@link DragControls} for simpler drag-only interaction
|
|
41
|
+
* @see {@link SyncedTransform} for network synchronization
|
|
42
|
+
* @see {@link OrbitControls} - automatically disabled during gizmo drag
|
|
43
|
+
* @link https://threejs.org/docs/index.html#examples/en/controls/TransformControls for underlying three.js controls and additional features
|
|
17
44
|
*/
|
|
18
45
|
export class TransformGizmo extends Behaviour {
|
|
19
46
|
|