@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
|
@@ -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
|
|
@@ -15,13 +15,28 @@ const $reflectionProbeKey = Symbol("reflectionProbeKey");
|
|
|
15
15
|
const $originalMaterial = Symbol("original material");
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* The [ReflectionProbe](https://engine.needle.tools/docs/api/ReflectionProbe) provides environment reflection data to materials within its defined area.
|
|
19
|
+
* Use for chrome-like materials that need accurate environment reflections.
|
|
20
|
+
*
|
|
21
|
+
* **Setup:**
|
|
22
|
+
* 1. Add ReflectionProbe component to an object
|
|
23
|
+
* 2. Assign a cubemap or HDR texture
|
|
24
|
+
* 3. In Renderer components, assign the probe as anchor override
|
|
25
|
+
*
|
|
26
|
+
* **Note:** Volume-based automatic assignment is not fully supported yet.
|
|
27
|
+
* Objects (Renderer components) can explicitly reference their reflection probe.
|
|
28
|
+
*
|
|
29
|
+
* **Debug options:**
|
|
30
|
+
* - `?debugreflectionprobe` - Log probe info
|
|
31
|
+
* - `?noreflectionprobe` - Disable all reflection probes
|
|
32
|
+
*
|
|
33
|
+
* - Example: https://engine.needle.tools/samples/reflection-probes
|
|
34
|
+
*
|
|
22
35
|
* @summary Provides reflection data to materials
|
|
23
36
|
* @category Rendering
|
|
24
37
|
* @group Components
|
|
38
|
+
* @see {@link Renderer} for material and rendering control
|
|
39
|
+
* @see {@link Light} for scene lighting
|
|
25
40
|
*/
|
|
26
41
|
export class ReflectionProbe extends Behaviour {
|
|
27
42
|
|
|
@@ -45,7 +60,6 @@ export class ReflectionProbe extends Behaviour {
|
|
|
45
60
|
return probe;
|
|
46
61
|
}
|
|
47
62
|
}
|
|
48
|
-
// TODO not supported right now, as we'd have to pass the ReflectionProbe scale through as well.
|
|
49
63
|
else if (probe.isInBox(object)) {
|
|
50
64
|
if (debug) console.log("Found reflection probe", object.name, probe.name);
|
|
51
65
|
return probe;
|
|
@@ -200,8 +200,43 @@ class SharedMaterialArray implements ISharedMaterials {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
+
* The [Renderer](https://engine.needle.tools/docs/api/Renderer) component controls rendering properties of meshes including materials,
|
|
204
|
+
* lightmaps, reflection probes, and GPU instancing.
|
|
205
|
+
*
|
|
206
|
+
* **Materials:**
|
|
207
|
+
* Access materials via `sharedMaterials` array. Changes affect all instances.
|
|
208
|
+
* Use material cloning for per-instance variations.
|
|
209
|
+
*
|
|
210
|
+
* **Instancing:**
|
|
211
|
+
* Enable GPU instancing for improved performance with many identical objects.
|
|
212
|
+
* Use `Renderer.setInstanced(obj, true)` or `enableInstancing` property.
|
|
213
|
+
*
|
|
214
|
+
* **Lightmaps:**
|
|
215
|
+
* Baked lighting is automatically applied when exported from Unity or Blender.
|
|
216
|
+
* Access via the associated {@link RendererLightmap} component.
|
|
217
|
+
*
|
|
218
|
+
* [](https://engine.needle.tools/samples/multiple-lightmaps/)
|
|
219
|
+
*
|
|
220
|
+
* **Debug options:**
|
|
221
|
+
* - `?debugrenderer` - Log renderer info
|
|
222
|
+
* - `?wireframe` - Show wireframe rendering
|
|
223
|
+
* - `?noinstancing` - Disable GPU instancing
|
|
224
|
+
*
|
|
225
|
+
* @example Change material at runtime
|
|
226
|
+
* ```ts
|
|
227
|
+
* const renderer = myObject.getComponent(Renderer);
|
|
228
|
+
* renderer.sharedMaterials[0] = newMaterial;
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @example Enable instancing
|
|
232
|
+
* ```ts
|
|
233
|
+
* Renderer.setInstanced(myObject, true);
|
|
234
|
+
* ```
|
|
235
|
+
*
|
|
203
236
|
* @category Rendering
|
|
204
237
|
* @group Components
|
|
238
|
+
* @see {@link ReflectionProbe} for environment reflections
|
|
239
|
+
* @see {@link Light} for scene lighting
|
|
205
240
|
*/
|
|
206
241
|
export class Renderer extends Behaviour implements IRenderer {
|
|
207
242
|
|
|
@@ -691,7 +726,6 @@ export class Renderer extends Behaviour implements IRenderer {
|
|
|
691
726
|
}
|
|
692
727
|
|
|
693
728
|
if (this.reflectionProbeUsage !== ReflectionProbeUsage.Off && this._reflectionProbe) {
|
|
694
|
-
if (!this._lightmaps?.length) // Currently reflectionprobes cant be used with lightmaps
|
|
695
729
|
this._reflectionProbe.onSet(this);
|
|
696
730
|
}
|
|
697
731
|
// since three 163 we need to set the envMap to the scene envMap if it is not set
|
|
@@ -2,14 +2,18 @@ import { Matrix4, Object3D, Quaternion, Vector3, Vector3Like } from "three";
|
|
|
2
2
|
|
|
3
3
|
import { isDevEnvironment } from "../engine/debug/index.js";
|
|
4
4
|
import { MODULES } from "../engine/engine_modules.js";
|
|
5
|
+
import type { Physics } from "../engine/engine_physics.js";
|
|
5
6
|
import { CollisionDetectionMode, RigidbodyConstraints } from "../engine/engine_physics.types.js";
|
|
7
|
+
import type { RapierPhysics } from "../engine/engine_physics_rapier.js";
|
|
6
8
|
import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
7
9
|
import { Context, FrameEvent } from "../engine/engine_setup.js";
|
|
8
|
-
import { getWorldPosition } from "../engine/engine_three_utils.js";
|
|
9
10
|
import type { IRigidbody, Vec3 } from "../engine/engine_types.js";
|
|
10
11
|
import { validate } from "../engine/engine_util_decorator.js";
|
|
11
12
|
import { delayForFrames, Watch } from "../engine/engine_utils.js";
|
|
13
|
+
import type { CharacterController } from "./CharacterController.js";
|
|
14
|
+
import type { BoxCollider, CapsuleCollider, Collider,MeshCollider, SphereCollider } from "./Collider.js";
|
|
12
15
|
import { Behaviour } from "./Component.js";
|
|
16
|
+
import type { Joint } from "./Joints.js";
|
|
13
17
|
|
|
14
18
|
class TransformWatch {
|
|
15
19
|
|
|
@@ -134,15 +138,67 @@ class TransformWatch {
|
|
|
134
138
|
}
|
|
135
139
|
|
|
136
140
|
/**
|
|
137
|
-
*
|
|
141
|
+
* Rigidbody component for realistic physics simulation and dynamic interactions.
|
|
142
|
+
* Used together with a {@link Collider} to enable physical behavior like gravity, collisions,
|
|
143
|
+
* forces, and constraints. Powered by the Rapier physics engine.
|
|
138
144
|
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
+
* 
|
|
146
|
+
*
|
|
147
|
+
* **Key features:**
|
|
148
|
+
* - Dynamic, kinematic, or static body types
|
|
149
|
+
* - Automatic or manual mass calculation
|
|
150
|
+
* - Gravity, drag, and angular drag control
|
|
151
|
+
* - Position and rotation constraints (locking axes)
|
|
152
|
+
* - Force, impulse, and velocity manipulation
|
|
153
|
+
* - Sleep/wake optimization for performance
|
|
154
|
+
* - Continuous collision detection (CCD) support
|
|
155
|
+
*
|
|
156
|
+
* @example Basic dynamic rigidbody
|
|
157
|
+
* ```ts
|
|
158
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
159
|
+
* rb.useGravity = true;
|
|
160
|
+
* rb.mass = 2.0;
|
|
161
|
+
* rb.drag = 0.5;
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @example Apply force to move object
|
|
165
|
+
* ```ts
|
|
166
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
167
|
+
* rb.applyForce(new Vector3(0, 10, 0)); // Upward force
|
|
168
|
+
* rb.applyImpulse(new Vector3(5, 0, 0)); // Instant velocity change
|
|
169
|
+
* ```
|
|
170
|
+
*
|
|
171
|
+
* @example Kinematic rigidbody (manually controlled)
|
|
172
|
+
* ```ts
|
|
173
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
174
|
+
* rb.isKinematic = true; // Not affected by forces
|
|
175
|
+
* rb.teleport({ x: 0, y: 5, z: 0 }); // Move without physics
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @example Lock rotation on Y axis (useful for characters)
|
|
179
|
+
* ```ts
|
|
180
|
+
* const rb = this.gameObject.getComponent(Rigidbody);
|
|
181
|
+
* rb.lockRotationY = true;
|
|
182
|
+
* // Or use constraints for multiple axes:
|
|
183
|
+
* rb.constraints = RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezePositionZ;
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @summary Enables physics simulation with forces, gravity, and collisions
|
|
187
|
+
* @category Physics
|
|
145
188
|
* @group Components
|
|
189
|
+
* @see {@link BoxCollider} for box-shaped colliders
|
|
190
|
+
* @see {@link SphereCollider} for sphere-shaped colliders
|
|
191
|
+
* @see {@link CapsuleCollider} for capsule-shaped colliders
|
|
192
|
+
* @see {@link MeshCollider} for mesh-based colliders
|
|
193
|
+
* @see {@link Collider} for collider base class
|
|
194
|
+
* @see {@link CharacterController} for character movement
|
|
195
|
+
* @see {@link Joint} for connecting bodies
|
|
196
|
+
* @see {@link RapierPhysics} for physics engine implementation
|
|
197
|
+
* @see {@link Physics} for raycasting and physics utilities
|
|
198
|
+
* @link https://engine.needle.tools/samples/physics-basic/
|
|
199
|
+
* @link https://engine.needle.tools/samples/physics-playground/
|
|
200
|
+
* @link https://engine.needle.tools/samples/physics-&-animation/
|
|
201
|
+
* @link https://rapier.rs/docs/user_guides/javascript/rigid_bodies
|
|
146
202
|
*/
|
|
147
203
|
export class Rigidbody extends Behaviour implements IRigidbody {
|
|
148
204
|
|
|
@@ -84,6 +84,13 @@ export interface ISceneEventListener {
|
|
|
84
84
|
* - [Needle Website](https://needle.tools)
|
|
85
85
|
* - [Songs Of Cultures](https://app.songsofcultures.com)
|
|
86
86
|
*
|
|
87
|
+
* 
|
|
88
|
+
* *Replace entire scenes with the SceneSwitcher.*
|
|
89
|
+
*
|
|
90
|
+
* 
|
|
91
|
+
* *Multiple SceneSwitcher components can be used at the same time and they can also be nested
|
|
92
|
+
* (a scene loaded by a SceneSwitcher can also have a SceneSwitcher to load sub-scenes).*
|
|
93
|
+
*
|
|
87
94
|
* ### Interfaces
|
|
88
95
|
* Use the {@link ISceneEventListener} interface to listen to scene open and closing events with the ability to modify transitions and stall the scene loading process.
|
|
89
96
|
*
|
|
@@ -111,6 +118,10 @@ export interface ISceneEventListener {
|
|
|
111
118
|
* @summary Dynamically loads and switches between multiple scenes
|
|
112
119
|
* @category Asset Management
|
|
113
120
|
* @group Components
|
|
121
|
+
* @see {@link ISceneEventListener} for scene transition callbacks
|
|
122
|
+
* @see {@link AssetReference} for loading individual assets
|
|
123
|
+
* @see {@link NestedGltf} for embedding static glTF content
|
|
124
|
+
* @link https://engine.needle.tools/docs/how-to-guides/components/scene-switcher.html
|
|
114
125
|
*/
|
|
115
126
|
export class SceneSwitcher extends Behaviour {
|
|
116
127
|
|
|
@@ -61,19 +61,52 @@ export declare type ScreenCaptureOptions = {
|
|
|
61
61
|
deviceFilter?: (device: MediaDeviceInfo) => boolean,
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
64
|
+
/**
|
|
65
|
+
* ScreenCapture enables sharing screen, camera, or microphone with users in a networked room.
|
|
66
|
+
* The stream is displayed via a {@link VideoPlayer} component on the same GameObject.
|
|
67
|
+
*
|
|
68
|
+
* **Supported capture devices:**
|
|
69
|
+
* - `Screen` - Share desktop/window/tab
|
|
70
|
+
* - `Camera` - Share webcam feed
|
|
71
|
+
* - `Microphone` - Audio only
|
|
72
|
+
* - `Canvas` - Share the 3D canvas (experimental)
|
|
72
73
|
*
|
|
74
|
+
* 
|
|
75
|
+
*
|
|
76
|
+
* **How it works:**
|
|
77
|
+
* - Click the object to start/stop sharing (if `allowStartOnClick` is true)
|
|
78
|
+
* - Or call `share()` / `close()` programmatically
|
|
79
|
+
* - Stream is sent to all users in the same room via WebRTC
|
|
80
|
+
* - Receiving clients see the video on their VideoPlayer
|
|
81
|
+
*
|
|
82
|
+
* **Debug:** Append `?debugscreensharing` to the URL for console logging.
|
|
83
|
+
*
|
|
84
|
+
* @example Start screen sharing programmatically
|
|
85
|
+
* ```ts
|
|
86
|
+
* const capture = myScreen.getComponent(ScreenCapture);
|
|
87
|
+
* await capture?.share({ device: "Screen" });
|
|
88
|
+
*
|
|
89
|
+
* // Later, stop sharing
|
|
90
|
+
* capture?.close();
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* @example Share webcam with constraints
|
|
94
|
+
* ```ts
|
|
95
|
+
* await capture?.share({
|
|
96
|
+
* device: "Camera",
|
|
97
|
+
* constraints: { width: 1280, height: 720 }
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
73
101
|
* @summary Share screen, camera or microphone in a networked room
|
|
74
102
|
* @category Networking
|
|
103
|
+
* @category Multimedia
|
|
75
104
|
* @group Components
|
|
76
|
-
|
|
105
|
+
* @see {@link VideoPlayer} for displaying the received stream
|
|
106
|
+
* @see {@link Voip} for voice-only communication
|
|
107
|
+
* @see {@link SyncedRoom} for room management
|
|
108
|
+
* @link https://engine.needle.tools/docs/networking.html
|
|
109
|
+
*/
|
|
77
110
|
export class ScreenCapture extends Behaviour implements IPointerClickHandler {
|
|
78
111
|
|
|
79
112
|
/**
|
|
@@ -6,9 +6,11 @@ import { serializable } from "../engine/engine_serialization_decorator.js";
|
|
|
6
6
|
import { getTempVector } from "../engine/engine_three_utils.js";
|
|
7
7
|
import { getParam } from "../engine/engine_utils.js";
|
|
8
8
|
import { USDObject, USDZExporterContext } from "./api.js";
|
|
9
|
+
import type { Camera } from "./Camera.js";
|
|
9
10
|
import { Behaviour } from "./Component.js";
|
|
10
11
|
import { IUSDExporterExtension } from "./export/usdz/Extension.js";
|
|
11
12
|
import { USDZExporter } from "./export/usdz/USDZExporter.js";
|
|
13
|
+
import type { OrbitControls } from "./OrbitControls.js";
|
|
12
14
|
import { Renderer } from "./Renderer.js";
|
|
13
15
|
|
|
14
16
|
const debugSeeThrough = getParam("debugseethrough");
|
|
@@ -32,17 +34,82 @@ let i = 0;
|
|
|
32
34
|
|
|
33
35
|
|
|
34
36
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
37
|
+
* Automatically fades objects to transparent when they obscure a reference point from the camera's view.
|
|
38
|
+
* Perfect for architectural visualization, third-person games, or any scenario where objects should
|
|
39
|
+
* become see-through when blocking the view of important content.
|
|
40
|
+
*
|
|
41
|
+
* [](https://engine.needle.tools/samples/see-through)
|
|
42
|
+
*
|
|
43
|
+
* **How it works:**
|
|
44
|
+
* - Monitors the angle between the camera, this object, and a reference point
|
|
45
|
+
* - When the object blocks the view to the reference point, it fades out
|
|
46
|
+
* - Automatically affects all {@link Renderer} components on this object and children
|
|
47
|
+
* - Supports both transparent fading and alpha hash (dithered) fading
|
|
48
|
+
*
|
|
49
|
+
* **Key Features:**
|
|
50
|
+
* - Smooth fade transitions with configurable duration
|
|
51
|
+
* - Optional alpha hash for maintaining opaque rendering (better performance)
|
|
52
|
+
* - Automatic or manual update modes
|
|
53
|
+
* - Disables raycasting when faded (objects become click-through)
|
|
54
|
+
* - Preserves original material properties when re-enabled
|
|
55
|
+
*
|
|
56
|
+
* **Configuration:**
|
|
57
|
+
* - `referencePoint` - Object to keep visible (defaults to scene root)
|
|
58
|
+
* - `fadeDuration` - Transition speed (default: 0.05 seconds)
|
|
59
|
+
* - `minAlpha` - Minimum opacity when faded (default: 0 = fully transparent)
|
|
60
|
+
* - `useAlphaHash` - Use dithered transparency instead of true transparency (default: true)
|
|
61
|
+
*
|
|
62
|
+
* **Performance:**
|
|
63
|
+
* - Materials are cloned once per renderer to avoid affecting shared materials
|
|
64
|
+
* - Updates direction calculation every 20 frames by default (configurable via `autoUpdate`)
|
|
65
|
+
* - Use `needsUpdate = true` to force immediate recalculation
|
|
66
|
+
*
|
|
67
|
+
* **Requirements:**
|
|
68
|
+
* Requires at least one {@link Renderer} component on the same object or child objects.
|
|
69
|
+
*
|
|
70
|
+
* @example Make walls transparent when blocking view
|
|
71
|
+
* ```ts
|
|
72
|
+
* // Add to walls or obstacles
|
|
73
|
+
* const seeThrough = wall.addComponent(SeeThrough);
|
|
74
|
+
* seeThrough.referencePoint = player; // Keep player visible
|
|
75
|
+
* seeThrough.fadeDuration = 0.2; // Smooth fade
|
|
76
|
+
* seeThrough.minAlpha = 0.2; // Slightly visible when faded
|
|
77
|
+
* ```
|
|
78
|
+
*
|
|
79
|
+
* @example Third-person camera with see-through objects
|
|
80
|
+
* ```ts
|
|
81
|
+
* const character = GameObject.findByName("Character");
|
|
82
|
+
* const obstacles = GameObject.findByTag("Obstacle");
|
|
83
|
+
*
|
|
84
|
+
* for (const obstacle of obstacles) {
|
|
85
|
+
* const st = obstacle.addComponent(SeeThrough);
|
|
86
|
+
* st.referencePoint = character;
|
|
87
|
+
* st.useAlphaHash = true; // Better performance
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*
|
|
91
|
+
* @example Manual control of see-through effect
|
|
92
|
+
* ```ts
|
|
93
|
+
* const seeThrough = this.gameObject.getComponent(SeeThrough);
|
|
94
|
+
* if (seeThrough) {
|
|
95
|
+
* seeThrough.autoUpdate = false; // Disable automatic fading
|
|
96
|
+
*
|
|
97
|
+
* // Manually control transparency
|
|
98
|
+
* seeThrough.updateAlpha(0.5, 0.3); // Fade to 50% over 0.3 seconds
|
|
99
|
+
*
|
|
100
|
+
* // Or use override for precise control
|
|
101
|
+
* seeThrough.overrideAlpha = 0.8; // Force 80% opacity
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @summary Fades objects when they obscure the camera's view of a reference point
|
|
44
106
|
* @category Rendering
|
|
45
107
|
* @group Components
|
|
108
|
+
* @see {@link Renderer} for material/rendering control (required)
|
|
109
|
+
* @see {@link Camera} for camera setup and configuration
|
|
110
|
+
* @see {@link OrbitControls} for camera controls in similar use cases
|
|
111
|
+
* @link https://see-through-walls-z23hmxbz1kjfjn.needle.run/ for live demo
|
|
112
|
+
* @link https://engine.needle.tools/samples/see-through for sample project
|
|
46
113
|
*/
|
|
47
114
|
export class SeeThrough extends Behaviour {
|
|
48
115
|
|