@needle-tools/engine 5.1.0-canary.30cc545 → 5.1.0-canary.3264462
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/.needle/generated/needle-bindings.gen.d.ts +5 -0
- package/CHANGELOG.md +133 -1
- package/SKILL.md +4 -1
- package/components.needle.json +1 -1
- package/dist/{needle-engine.bundle-d_9mSxN4.js → needle-engine.bundle-BmJZJqDd.js} +13821 -12802
- package/dist/needle-engine.bundle-Cx1J8uiL.umd.cjs +1734 -0
- package/dist/needle-engine.bundle-X7kYk2XZ.min.js +1734 -0
- package/dist/needle-engine.d.ts +1622 -401
- package/dist/needle-engine.js +555 -550
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/three.js +1 -0
- package/dist/three.min.js +21 -21
- package/dist/three.umd.cjs +16 -16
- package/lib/engine/api.d.ts +9 -2
- package/lib/engine/api.js +7 -1
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/codegen/register_types.js +10 -18
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/debug/debug_spatial_console.d.ts +2 -0
- package/lib/engine/debug/debug_spatial_console.js +10 -7
- package/lib/engine/debug/debug_spatial_console.js.map +1 -1
- package/lib/engine/engine_addressables.d.ts +2 -0
- package/lib/engine/engine_addressables.js +6 -3
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_audio.d.ts +68 -0
- package/lib/engine/engine_audio.js +172 -0
- package/lib/engine/engine_audio.js.map +1 -1
- package/lib/engine/engine_camera.fit.js +16 -4
- package/lib/engine/engine_camera.fit.js.map +1 -1
- package/lib/engine/engine_components.js +1 -1
- package/lib/engine/engine_components.js.map +1 -1
- package/lib/engine/engine_context.d.ts +41 -27
- package/lib/engine/engine_context.js +64 -30
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_eventbus.d.ts +47 -0
- package/lib/engine/engine_context_eventbus.js +47 -0
- package/lib/engine/engine_context_eventbus.js.map +1 -0
- package/lib/engine/engine_disposable.d.ts +172 -0
- package/lib/engine/engine_disposable.js +136 -0
- package/lib/engine/engine_disposable.js.map +1 -0
- package/lib/engine/engine_gameobject.d.ts +1 -10
- package/lib/engine/engine_gameobject.js +22 -120
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_gltf_builtin_components.js +7 -69
- package/lib/engine/engine_gltf_builtin_components.js.map +1 -1
- package/lib/engine/engine_init.js +16 -1
- package/lib/engine/engine_init.js.map +1 -1
- package/lib/engine/engine_input.d.ts +24 -5
- package/lib/engine/engine_input.js +3 -2
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_instantiate_resolve.d.ts +42 -0
- package/lib/engine/engine_instantiate_resolve.js +372 -0
- package/lib/engine/engine_instantiate_resolve.js.map +1 -0
- package/lib/engine/engine_license.d.ts +8 -6
- package/lib/engine/engine_license.js +195 -59
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_lifecycle_functions_internal.js +5 -0
- package/lib/engine/engine_lifecycle_functions_internal.js.map +1 -1
- package/lib/engine/engine_mainloop_utils.js +7 -4
- package/lib/engine/engine_mainloop_utils.js.map +1 -1
- package/lib/engine/engine_networking.d.ts +51 -37
- package/lib/engine/engine_networking.js +132 -82
- package/lib/engine/engine_networking.js.map +1 -1
- package/lib/engine/engine_networking.transport.websocket.d.ts +15 -0
- package/lib/engine/engine_networking.transport.websocket.js +38 -0
- package/lib/engine/engine_networking.transport.websocket.js.map +1 -0
- package/lib/engine/engine_networking_blob.js +4 -4
- package/lib/engine/engine_networking_blob.js.map +1 -1
- package/lib/engine/engine_networking_instantiate.js +2 -2
- package/lib/engine/engine_networking_instantiate.js.map +1 -1
- package/lib/engine/engine_networking_types.d.ts +39 -1
- package/lib/engine/engine_networking_types.js +7 -0
- package/lib/engine/engine_networking_types.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +21 -3
- package/lib/engine/engine_physics_rapier.js +94 -25
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_pmrem.js +51 -3
- package/lib/engine/engine_pmrem.js.map +1 -1
- package/lib/engine/engine_scenedata.d.ts +13 -17
- package/lib/engine/engine_scenedata.js +58 -31
- package/lib/engine/engine_scenedata.js.map +1 -1
- package/lib/engine/engine_serialization_builtin_serializer.d.ts +10 -16
- package/lib/engine/engine_serialization_builtin_serializer.js +56 -46
- package/lib/engine/engine_serialization_builtin_serializer.js.map +1 -1
- package/lib/engine/engine_serialization_core.d.ts +1 -0
- package/lib/engine/engine_serialization_core.js +7 -0
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_ssr.d.ts +2 -0
- package/lib/engine/engine_ssr.js +2 -0
- package/lib/engine/engine_ssr.js.map +1 -1
- package/lib/engine/engine_types.d.ts +31 -11
- package/lib/engine/engine_types.js +1 -1
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/engine_util_decorator.js +7 -2
- package/lib/engine/engine_util_decorator.js.map +1 -1
- package/lib/engine/engine_utils.d.ts +1 -1
- package/lib/engine/engine_utils.js +19 -5
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/engine_utils_format.js +20 -14
- package/lib/engine/engine_utils_format.js.map +1 -1
- package/lib/engine/engine_utils_qrcode.js +2 -2
- package/lib/engine/engine_utils_qrcode.js.map +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
- package/lib/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js.map +1 -1
- package/lib/engine/webcomponents/jsx.d.ts +51 -0
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js +2 -2
- package/lib/engine/webcomponents/needle menu/needle-menu-spatial.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.d.ts +3 -4
- package/lib/engine/webcomponents/needle menu/needle-menu.js +6 -6
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-button.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.d.ts +10 -4
- package/lib/engine/webcomponents/needle-engine.js +3 -3
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +2 -2
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/NeedleXRSession.d.ts +3 -2
- package/lib/engine/xr/NeedleXRSession.js +50 -14
- package/lib/engine/xr/NeedleXRSession.js.map +1 -1
- package/lib/engine/xr/TempXRContext.js +2 -2
- package/lib/engine/xr/TempXRContext.js.map +1 -1
- package/lib/engine/xr/events.d.ts +1 -1
- package/lib/engine/xr/events.js.map +1 -1
- package/lib/engine-components/Animation.js +17 -16
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/AnimationBuilder.d.ts +158 -0
- package/lib/engine-components/AnimationBuilder.js +305 -0
- package/lib/engine-components/AnimationBuilder.js.map +1 -0
- package/lib/engine-components/Animator.d.ts +6 -0
- package/lib/engine-components/Animator.js +23 -13
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AnimatorController.builder.d.ts +191 -0
- package/lib/engine-components/AnimatorController.builder.js +263 -0
- package/lib/engine-components/AnimatorController.builder.js.map +1 -0
- package/lib/engine-components/AnimatorController.d.ts +4 -119
- package/lib/engine-components/AnimatorController.js +37 -233
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/AudioSource.d.ts +19 -3
- package/lib/engine-components/AudioSource.js +121 -68
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +18 -9
- package/lib/engine-components/Collider.js +61 -14
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Component.d.ts +72 -9
- package/lib/engine-components/Component.js +114 -10
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/ContactShadows.d.ts +1 -0
- package/lib/engine-components/ContactShadows.js +14 -1
- package/lib/engine-components/ContactShadows.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +7 -0
- package/lib/engine-components/DragControls.js +19 -7
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DropListener.js +4 -0
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/EventList.d.ts +31 -9
- package/lib/engine-components/EventList.js +37 -76
- package/lib/engine-components/EventList.js.map +1 -1
- package/lib/engine-components/Joints.d.ts +4 -2
- package/lib/engine-components/Joints.js +19 -3
- package/lib/engine-components/Joints.js.map +1 -1
- package/lib/engine-components/Light.d.ts +6 -8
- package/lib/engine-components/Light.js +48 -27
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +1 -1
- package/lib/engine-components/Networking.js +1 -1
- package/lib/engine-components/OrbitControls.d.ts +1 -2
- package/lib/engine-components/OrbitControls.js +37 -14
- package/lib/engine-components/OrbitControls.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.js +2 -0
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +12 -4
- package/lib/engine-components/RigidBody.js +18 -4
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.js +3 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SeeThrough.js +2 -2
- package/lib/engine-components/SeeThrough.js.map +1 -1
- package/lib/engine-components/VideoPlayer.d.ts +8 -2
- package/lib/engine-components/VideoPlayer.js +42 -19
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/Voip.d.ts +16 -7
- package/lib/engine-components/Voip.js +90 -53
- package/lib/engine-components/Voip.js.map +1 -1
- package/lib/engine-components/api.d.ts +3 -1
- package/lib/engine-components/api.js +3 -1
- package/lib/engine-components/api.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +7 -13
- package/lib/engine-components/codegen/components.js +7 -13
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/export/usdz/USDZExporter.js +4 -4
- package/lib/engine-components/export/usdz/USDZExporter.js.map +1 -1
- package/lib/engine-components/postprocessing/Effects/Tonemapping.utils.d.ts +1 -1
- package/lib/engine-components/postprocessing/VolumeParameter.d.ts +2 -0
- package/lib/engine-components/postprocessing/VolumeParameter.js +4 -1
- package/lib/engine-components/postprocessing/VolumeParameter.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.d.ts +21 -11
- package/lib/engine-components/timeline/PlayableDirector.js +75 -67
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/SignalAsset.d.ts +3 -1
- package/lib/engine-components/timeline/SignalAsset.js +1 -0
- package/lib/engine-components/timeline/SignalAsset.js.map +1 -1
- package/lib/engine-components/timeline/TimelineBuilder.d.ts +413 -0
- package/lib/engine-components/timeline/TimelineBuilder.js +506 -0
- package/lib/engine-components/timeline/TimelineBuilder.js.map +1 -0
- package/lib/engine-components/timeline/TimelineModels.d.ts +2 -1
- package/lib/engine-components/timeline/TimelineModels.js +3 -0
- package/lib/engine-components/timeline/TimelineModels.js.map +1 -1
- package/lib/engine-components/timeline/TimelineTracks.d.ts +37 -6
- package/lib/engine-components/timeline/TimelineTracks.js +92 -26
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
- package/lib/engine-components/timeline/index.d.ts +2 -1
- package/lib/engine-components/timeline/index.js +2 -0
- package/lib/engine-components/timeline/index.js.map +1 -1
- package/lib/engine-components/ui/Canvas.d.ts +1 -1
- package/lib/engine-components/ui/Canvas.js +2 -8
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/Text.d.ts +1 -0
- package/lib/engine-components/ui/Text.js +10 -7
- package/lib/engine-components/ui/Text.js.map +1 -1
- package/lib/engine-components/web/CursorFollow.d.ts +0 -1
- package/lib/engine-components/web/CursorFollow.js +21 -13
- package/lib/engine-components/web/CursorFollow.js.map +1 -1
- package/lib/engine-components/webxr/WebXRImageTracking.d.ts +62 -1
- package/lib/engine-components/webxr/WebXRImageTracking.js +59 -2
- package/lib/engine-components/webxr/WebXRImageTracking.js.map +1 -1
- package/lib/needle-engine.d.ts +2 -0
- package/lib/needle-engine.js +2 -0
- package/lib/needle-engine.js.map +1 -1
- package/package.json +3 -83
- package/plugins/common/cloud.js +6 -1
- package/plugins/common/license.js +55 -12
- package/plugins/common/worker.js +9 -4
- package/plugins/dts-generator/dts.codegen.js +255 -50
- package/plugins/dts-generator/dts.scan.js +37 -9
- package/plugins/dts-generator/dts.writer.js +1 -1
- package/plugins/dts-generator/glb.discovery.js +140 -23
- package/plugins/dts-generator/glb.extractor.js +48 -8
- package/plugins/dts-generator/glb.reader.js +80 -27
- package/plugins/dts-generator/index.js +1 -1
- package/plugins/types/needle-bindings.d.ts +25 -14
- package/plugins/types/userconfig.d.ts +16 -1
- package/plugins/vite/asap.js +18 -9
- package/plugins/vite/build-pipeline.js +57 -20
- package/plugins/vite/dependencies.js +29 -10
- package/plugins/vite/dependency-watcher.d.ts +2 -2
- package/plugins/vite/dependency-watcher.js +5 -6
- package/plugins/vite/drop.d.ts +2 -2
- package/plugins/vite/drop.js +3 -4
- package/plugins/vite/dts-generator.d.ts +2 -2
- package/plugins/vite/dts-generator.js +43 -9
- package/plugins/vite/editor-connection.js +3 -3
- package/plugins/vite/index.d.ts +9 -3
- package/plugins/vite/index.js +23 -10
- package/plugins/vite/license.js +42 -7
- package/plugins/vite/local-files-core.js +3 -3
- package/plugins/vite/local-files-utils.d.ts +3 -1
- package/plugins/vite/local-files-utils.js +29 -5
- package/plugins/vite/meta.js +4 -2
- package/plugins/vite/poster.d.ts +2 -2
- package/plugins/vite/poster.js +3 -5
- package/plugins/vite/reload.d.ts +2 -2
- package/plugins/vite/reload.js +23 -23
- package/plugins/vite/server.js +2 -1
- package/src/engine/api.ts +12 -2
- package/src/engine/codegen/register_types.ts +10 -18
- package/src/engine/debug/debug_spatial_console.ts +10 -7
- package/src/engine/engine_addressables.ts +6 -3
- package/src/engine/engine_audio.ts +184 -0
- package/src/engine/engine_camera.fit.ts +15 -4
- package/src/engine/engine_components.ts +1 -1
- package/src/engine/engine_context.ts +78 -38
- package/src/engine/engine_context_eventbus.ts +73 -0
- package/src/engine/engine_disposable.ts +214 -0
- package/src/engine/engine_gameobject.ts +54 -159
- package/src/engine/engine_gltf_builtin_components.ts +7 -76
- package/src/engine/engine_init.ts +15 -1
- package/src/engine/engine_input.ts +28 -7
- package/src/engine/engine_instantiate_resolve.ts +407 -0
- package/src/engine/engine_license.ts +209 -61
- package/src/engine/engine_lifecycle_functions_internal.ts +7 -0
- package/src/engine/engine_mainloop_utils.ts +7 -4
- package/src/engine/engine_networking.transport.websocket.ts +45 -0
- package/src/engine/engine_networking.ts +161 -137
- package/src/engine/engine_networking_blob.ts +4 -4
- package/src/engine/engine_networking_instantiate.ts +2 -2
- package/src/engine/engine_networking_types.ts +41 -1
- package/src/engine/engine_physics_rapier.ts +102 -33
- package/src/engine/engine_pmrem.ts +53 -3
- package/src/engine/engine_scenedata.ts +56 -30
- package/src/engine/engine_serialization_builtin_serializer.ts +64 -52
- package/src/engine/engine_serialization_core.ts +9 -0
- package/src/engine/engine_ssr.ts +3 -0
- package/src/engine/engine_types.ts +48 -27
- package/src/engine/engine_util_decorator.ts +7 -2
- package/src/engine/engine_utils.ts +16 -5
- package/src/engine/engine_utils_format.ts +20 -14
- package/src/engine/engine_utils_qrcode.ts +2 -2
- package/src/engine/physics/workers/mesh-bvh/GenerateMeshBVHWorker.js +1 -1
- package/src/engine/webcomponents/jsx.d.ts +51 -0
- package/src/engine/webcomponents/logo-element.ts +1 -0
- package/src/engine/webcomponents/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +8 -7
- package/src/engine/webcomponents/needle-button.ts +1 -0
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +13 -6
- package/src/engine/xr/NeedleXRSession.ts +48 -13
- package/src/engine/xr/TempXRContext.ts +2 -2
- package/src/engine/xr/events.ts +1 -1
- package/src/engine-components/Animation.ts +19 -16
- package/src/engine-components/AnimationBuilder.ts +472 -0
- package/src/engine-components/Animator.ts +24 -12
- package/src/engine-components/AnimatorController.builder.ts +387 -0
- package/src/engine-components/AnimatorController.ts +24 -292
- package/src/engine-components/AudioSource.ts +130 -79
- package/src/engine-components/Collider.ts +66 -18
- package/src/engine-components/Component.ts +118 -20
- package/src/engine-components/ContactShadows.ts +15 -1
- package/src/engine-components/DragControls.ts +18 -11
- package/src/engine-components/DropListener.ts +4 -0
- package/src/engine-components/EventList.ts +45 -83
- package/src/engine-components/Joints.ts +20 -4
- package/src/engine-components/Light.ts +49 -27
- package/src/engine-components/Networking.ts +1 -1
- package/src/engine-components/OrbitControls.ts +42 -16
- package/src/engine-components/ReflectionProbe.ts +2 -0
- package/src/engine-components/RigidBody.ts +18 -4
- package/src/engine-components/SceneSwitcher.ts +3 -0
- package/src/engine-components/SeeThrough.ts +2 -2
- package/src/engine-components/VideoPlayer.ts +40 -17
- package/src/engine-components/Voip.ts +88 -53
- package/src/engine-components/api.ts +3 -1
- package/src/engine-components/codegen/components.ts +7 -13
- package/src/engine-components/export/usdz/USDZExporter.ts +4 -4
- package/src/engine-components/postprocessing/VolumeParameter.ts +4 -1
- package/src/engine-components/timeline/PlayableDirector.ts +83 -81
- package/src/engine-components/timeline/SignalAsset.ts +4 -1
- package/src/engine-components/timeline/TimelineBuilder.ts +824 -0
- package/src/engine-components/timeline/TimelineModels.ts +5 -1
- package/src/engine-components/timeline/TimelineTracks.ts +96 -27
- package/src/engine-components/timeline/index.ts +2 -1
- package/src/engine-components/ui/Canvas.ts +2 -8
- package/src/engine-components/ui/Text.ts +12 -8
- package/src/engine-components/web/CursorFollow.ts +21 -14
- package/src/engine-components/webxr/WebXRImageTracking.ts +79 -7
- package/src/needle-engine.ts +3 -0
- package/dist/needle-engine.bundle-BMlLSACE.umd.cjs +0 -1732
- package/dist/needle-engine.bundle-BXPPQRer.min.js +0 -1732
- package/lib/engine-components/AvatarLoader.d.ts +0 -80
- package/lib/engine-components/AvatarLoader.js +0 -232
- package/lib/engine-components/AvatarLoader.js.map +0 -1
- package/lib/engine-components/avatar/AvatarBlink_Simple.d.ts +0 -11
- package/lib/engine-components/avatar/AvatarBlink_Simple.js +0 -77
- package/lib/engine-components/avatar/AvatarBlink_Simple.js.map +0 -1
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.d.ts +0 -14
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js +0 -69
- package/lib/engine-components/avatar/AvatarEyeLook_Rotation.js.map +0 -1
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.d.ts +0 -29
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js +0 -122
- package/lib/engine-components/avatar/Avatar_Brain_LookAt.js.map +0 -1
- package/lib/engine-components/avatar/Avatar_MouthShapes.d.ts +0 -15
- package/lib/engine-components/avatar/Avatar_MouthShapes.js +0 -80
- package/lib/engine-components/avatar/Avatar_MouthShapes.js.map +0 -1
- package/lib/engine-components/avatar/Avatar_MustacheShake.d.ts +0 -9
- package/lib/engine-components/avatar/Avatar_MustacheShake.js +0 -30
- package/lib/engine-components/avatar/Avatar_MustacheShake.js.map +0 -1
- package/src/engine-components/AvatarLoader.ts +0 -264
- package/src/engine-components/avatar/AvatarBlink_Simple.ts +0 -70
- package/src/engine-components/avatar/AvatarEyeLook_Rotation.ts +0 -64
- package/src/engine-components/avatar/Avatar_Brain_LookAt.ts +0 -140
- package/src/engine-components/avatar/Avatar_MouthShapes.ts +0 -84
- package/src/engine-components/avatar/Avatar_MustacheShake.ts +0 -32
- package/src/vite-env.d.ts +0 -16
package/dist/needle-engine.d.ts
CHANGED
|
@@ -40,11 +40,13 @@ import { GLTFLoader } from '../../../node_modules/@types/three/examples/jsm/load
|
|
|
40
40
|
import { GLTFLoaderPlugin } from '../../../node_modules/@types/three/examples/jsm/loaders/GLTFLoader.js';
|
|
41
41
|
import { GLTFParser } from '../../../node_modules/@types/three/examples/jsm/loaders/GLTFLoader.js';
|
|
42
42
|
import { Group } from 'three';
|
|
43
|
+
import { ImpulseJoint } from '@dimforge/rapier3d-compat';
|
|
43
44
|
import { InstancedMesh } from 'three';
|
|
44
45
|
import { Intersection } from 'three';
|
|
45
46
|
import { IParticleSystem as IParticleSystem_2 } from 'three.quarks';
|
|
46
47
|
import { KeyframeTrack } from 'three';
|
|
47
48
|
import { Layers } from 'three';
|
|
49
|
+
import { Light as Light_2 } from 'three';
|
|
48
50
|
import { LightProbe } from 'three';
|
|
49
51
|
import { Line2 } from '../../../../node_modules/@types/three/examples/jsm/lines/Line2.js';
|
|
50
52
|
import { Loader } from 'three';
|
|
@@ -113,8 +115,12 @@ import { XRControllerModelFactory } from '../../../../node_modules/@types/three/
|
|
|
113
115
|
import { XRHandMeshModel } from '../../../../node_modules/@types/three/examples/jsm/webxr/XRHandMeshModel.js';
|
|
114
116
|
import { XRHandSpace } from 'three';
|
|
115
117
|
|
|
118
|
+
/* Excluded from this release type: _$cKxJP */
|
|
119
|
+
|
|
116
120
|
export declare const $componentName: unique symbol;
|
|
117
121
|
|
|
122
|
+
/* Excluded from this release type: _$keYFy */
|
|
123
|
+
|
|
118
124
|
export declare const $physicsKey: unique symbol;
|
|
119
125
|
|
|
120
126
|
export declare class __Ignore {
|
|
@@ -254,6 +260,31 @@ export declare class ActionModel implements IBehaviorElement {
|
|
|
254
260
|
writeTo(document: USDDocument, writer: USDWriter): void;
|
|
255
261
|
}
|
|
256
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Options for an activation clip in the timeline builder
|
|
265
|
+
*/
|
|
266
|
+
export declare type ActivationClipOptions = {
|
|
267
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
268
|
+
start?: number;
|
|
269
|
+
/** Duration of the clip in seconds (required) */
|
|
270
|
+
duration: number;
|
|
271
|
+
/** Ease-in duration in seconds (default: 0) */
|
|
272
|
+
easeIn?: number;
|
|
273
|
+
/** Ease-out duration in seconds (default: 0) */
|
|
274
|
+
easeOut?: number;
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Builder for activation tracks. Provides `.clip()` for defining activation windows.
|
|
279
|
+
* @category Animation and Sequencing
|
|
280
|
+
*/
|
|
281
|
+
export declare interface ActivationTrackBuilder extends TimelineBuilderBase {
|
|
282
|
+
/** Adds an activation clip that shows/hides the bound object */
|
|
283
|
+
clip(options: ActivationClipOptions): ActivationTrackBuilder;
|
|
284
|
+
/** Mutes this track so it is skipped during playback */
|
|
285
|
+
muted(muted?: boolean): ActivationTrackBuilder;
|
|
286
|
+
}
|
|
287
|
+
|
|
257
288
|
export declare const activeInHierarchyFieldName = "needle_isActiveInHierarchy";
|
|
258
289
|
|
|
259
290
|
/**
|
|
@@ -487,6 +518,62 @@ declare class Animation_2 extends Component implements IAnimationComponent {
|
|
|
487
518
|
}
|
|
488
519
|
export { Animation_2 as Animation }
|
|
489
520
|
|
|
521
|
+
/**
|
|
522
|
+
* A fluent builder for creating `AnimationClip` instances from code.
|
|
523
|
+
*
|
|
524
|
+
* Use {@link AnimationBuilder.create} to start a new builder, chain `.track()` calls
|
|
525
|
+
* to add animation tracks, and call `.build()` to produce the clip.
|
|
526
|
+
*
|
|
527
|
+
* @example Single track
|
|
528
|
+
* ```ts
|
|
529
|
+
* const clip = AnimationBuilder.create()
|
|
530
|
+
* .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
|
|
531
|
+
* .build();
|
|
532
|
+
* ```
|
|
533
|
+
*
|
|
534
|
+
* @example Multiple tracks
|
|
535
|
+
* ```ts
|
|
536
|
+
* const clip = AnimationBuilder.create("DoorOpen")
|
|
537
|
+
* .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
|
|
538
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
539
|
+
* .build(room);
|
|
540
|
+
* ```
|
|
541
|
+
*
|
|
542
|
+
* @category Animation and Sequencing
|
|
543
|
+
* @group Utilities
|
|
544
|
+
*/
|
|
545
|
+
export declare class AnimationBuilder {
|
|
546
|
+
private _name?;
|
|
547
|
+
private _tracks;
|
|
548
|
+
/** Creates a new AnimationBuilder instance */
|
|
549
|
+
static create(name?: string): AnimationBuilder;
|
|
550
|
+
constructor(name?: string);
|
|
551
|
+
/** Adds an animation track for an Object3D's position or scale */
|
|
552
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF_2<Vec3Value>, options?: TrackOptions): this;
|
|
553
|
+
/** Adds an animation track for an Object3D's quaternion */
|
|
554
|
+
track(target: Object3D, property: "quaternion", keyframes: KF_2<QuatValue>, options?: TrackOptions): this;
|
|
555
|
+
/** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
|
|
556
|
+
track(target: Object3D, property: "rotation", keyframes: KF_2<EulerValue>, options?: TrackOptions): this;
|
|
557
|
+
/** Adds an animation track for an Object3D's visibility */
|
|
558
|
+
track(target: Object3D, property: "visible", keyframes: KF_2<boolean>, options?: TrackOptions): this;
|
|
559
|
+
/** Adds an animation track for a material's numeric property */
|
|
560
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_2<number>, options?: TrackOptions): this;
|
|
561
|
+
/** Adds an animation track for a material's color property */
|
|
562
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
|
|
563
|
+
/** Adds an animation track for a light's numeric property */
|
|
564
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_2<number>, options?: TrackOptions): this;
|
|
565
|
+
/** Adds an animation track for a light's color */
|
|
566
|
+
track(target: Light_2, property: "color", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
|
|
567
|
+
/** Adds an animation track for a camera's numeric property */
|
|
568
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_2<number>, options?: TrackOptions): this;
|
|
569
|
+
/**
|
|
570
|
+
* Builds and returns the `AnimationClip`.
|
|
571
|
+
* @param root - Optional root Object3D for resolving track paths.
|
|
572
|
+
* When provided, tracks targeting a different object use `target.name` for named resolution.
|
|
573
|
+
*/
|
|
574
|
+
build(root?: Object3D): AnimationClip;
|
|
575
|
+
}
|
|
576
|
+
|
|
490
577
|
/**
|
|
491
578
|
* @category Animation and Sequencing
|
|
492
579
|
* @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
|
|
@@ -500,6 +587,34 @@ export declare type AnimationClipModel = {
|
|
|
500
587
|
rotation?: Quat | Quaternion;
|
|
501
588
|
};
|
|
502
589
|
|
|
590
|
+
/**
|
|
591
|
+
* Options for an animation clip in the timeline builder
|
|
592
|
+
*/
|
|
593
|
+
export declare type AnimationClipOptions = {
|
|
594
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
595
|
+
start?: number;
|
|
596
|
+
/** Duration of the clip in seconds. Defaults to the animation clip duration. */
|
|
597
|
+
duration?: number;
|
|
598
|
+
/** Playback speed multiplier (default: 1) */
|
|
599
|
+
speed?: number;
|
|
600
|
+
/** Whether the animation should loop within the clip (default: false) */
|
|
601
|
+
loop?: boolean;
|
|
602
|
+
/** Ease-in duration in seconds (default: 0) */
|
|
603
|
+
easeIn?: number;
|
|
604
|
+
/** Ease-out duration in seconds (default: 0) */
|
|
605
|
+
easeOut?: number;
|
|
606
|
+
/** Offset into the source animation clip in seconds (default: 0) */
|
|
607
|
+
clipIn?: number;
|
|
608
|
+
/** Whether to remove the start offset of the animation (default: false) */
|
|
609
|
+
removeStartOffset?: boolean;
|
|
610
|
+
/** Pre-extrapolation mode (default: None) */
|
|
611
|
+
preExtrapolation?: ClipExtrapolation;
|
|
612
|
+
/** Post-extrapolation mode (default: None) */
|
|
613
|
+
postExtrapolation?: ClipExtrapolation;
|
|
614
|
+
/** Play the clip in reverse */
|
|
615
|
+
reversed?: boolean;
|
|
616
|
+
};
|
|
617
|
+
|
|
503
618
|
/**
|
|
504
619
|
* AnimationCurve is a representation of a curve that can be used to animate values over time.
|
|
505
620
|
*
|
|
@@ -577,6 +692,19 @@ export declare class AnimationExtension implements IUSDExporterExtension {
|
|
|
577
692
|
|
|
578
693
|
declare type AnimationIdentifier = AnimationClip | number | string | undefined;
|
|
579
694
|
|
|
695
|
+
/** User-friendly interpolation mode names */
|
|
696
|
+
export declare type AnimationInterpolation = "linear" | "smooth" | "step";
|
|
697
|
+
|
|
698
|
+
/** A single keyframe: a time and a value */
|
|
699
|
+
export declare type AnimationKeyframe<V> = {
|
|
700
|
+
/** Time in seconds */
|
|
701
|
+
time: number;
|
|
702
|
+
/** The value at this time */
|
|
703
|
+
value: V;
|
|
704
|
+
/** Interpolation mode for this track (default: `"linear"`). Note: Three.js applies one mode per track; the first keyframe's mode is used. */
|
|
705
|
+
interpolation?: AnimationInterpolation;
|
|
706
|
+
};
|
|
707
|
+
|
|
580
708
|
/**
|
|
581
709
|
* Registry for animation related data. Use {@link registerAnimationMixer} to register an animation mixer instance.
|
|
582
710
|
* Can be accessed from {@link Context.animations} and is used internally e.g. when exporting GLTF files.
|
|
@@ -597,43 +725,39 @@ declare class AnimationsRegistry {
|
|
|
597
725
|
unregisterAnimationMixer(mixer: AnimationMixer | null | undefined): void;
|
|
598
726
|
}
|
|
599
727
|
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
/**
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
private _clipRotQuat;
|
|
634
|
-
evaluate(time: number): void;
|
|
635
|
-
private createRotationInterpolant;
|
|
636
|
-
private createPositionInterpolant;
|
|
728
|
+
/**
|
|
729
|
+
* Builder for animation tracks.
|
|
730
|
+
* Provides `.clip()` for pre-built AnimationClips and `.track()` for inline animation definition.
|
|
731
|
+
*
|
|
732
|
+
* @category Animation and Sequencing
|
|
733
|
+
*/
|
|
734
|
+
export declare interface AnimationTrackBuilder extends TimelineBuilderBase {
|
|
735
|
+
/** Adds a pre-built AnimationClip */
|
|
736
|
+
clip(asset: AnimationClip, options?: AnimationClipOptions): AnimationTrackBuilder;
|
|
737
|
+
/** Adds a clip from a single {@link TrackDescriptor} */
|
|
738
|
+
clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): AnimationTrackBuilder;
|
|
739
|
+
/** Adds a clip from multiple {@link TrackDescriptor}s */
|
|
740
|
+
clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): AnimationTrackBuilder;
|
|
741
|
+
/** Adds an animation track for an Object3D's position or scale */
|
|
742
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): AnimationTrackBuilder;
|
|
743
|
+
/** Adds an animation track for an Object3D's quaternion */
|
|
744
|
+
track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
745
|
+
/** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
|
|
746
|
+
track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
747
|
+
/** Adds an animation track for an Object3D's visibility */
|
|
748
|
+
track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): AnimationTrackBuilder;
|
|
749
|
+
/** Adds an animation track for a material's numeric property */
|
|
750
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
|
|
751
|
+
/** Adds an animation track for a material's color property */
|
|
752
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
753
|
+
/** Adds an animation track for a light's numeric property */
|
|
754
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
|
|
755
|
+
/** Adds an animation track for a light's color */
|
|
756
|
+
track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
757
|
+
/** Adds an animation track for a camera's numeric property */
|
|
758
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
|
|
759
|
+
/** Mutes this track so it is skipped during playback */
|
|
760
|
+
muted(muted?: boolean): AnimationTrackBuilder;
|
|
637
761
|
}
|
|
638
762
|
|
|
639
763
|
declare class AnimationTriggers {
|
|
@@ -726,6 +850,12 @@ export declare class Animator extends Component implements IAnimationComponent {
|
|
|
726
850
|
* Identifies this component as an animation component in the engine
|
|
727
851
|
*/
|
|
728
852
|
get isAnimationComponent(): boolean;
|
|
853
|
+
/**
|
|
854
|
+
* The current animator mixer, used for low-level control of animations. Owned by the AnimatorController
|
|
855
|
+
* @returns The current AnimationMixer, or null if no controller is assigned
|
|
856
|
+
* @see AnimatorController.mixer
|
|
857
|
+
*/
|
|
858
|
+
get mixer(): AnimationMixer | null;
|
|
729
859
|
/**
|
|
730
860
|
* When enabled, animation will affect the root transform position and rotation
|
|
731
861
|
*/
|
|
@@ -1102,13 +1232,6 @@ export declare class AnimatorController {
|
|
|
1102
1232
|
* @param animator - The animator to bind this controller to
|
|
1103
1233
|
*/
|
|
1104
1234
|
bind(animator: Animator): void;
|
|
1105
|
-
/**
|
|
1106
|
-
* Creates a deep copy of this controller.
|
|
1107
|
-
* Clones the model data but does not copy runtime state.
|
|
1108
|
-
*
|
|
1109
|
-
* @returns A new AnimatorController instance with the same configuration
|
|
1110
|
-
*/
|
|
1111
|
-
clone(): AnimatorController | null;
|
|
1112
1235
|
/**
|
|
1113
1236
|
* Updates the controller's state machine and animations.
|
|
1114
1237
|
* Called each frame by the animator component.
|
|
@@ -1151,11 +1274,15 @@ export declare class AnimatorController {
|
|
|
1151
1274
|
/**
|
|
1152
1275
|
* A fluent builder for creating {@link AnimatorController} instances from code.
|
|
1153
1276
|
*
|
|
1154
|
-
* Use {@link AnimatorController.build} to create a new builder.
|
|
1277
|
+
* Use {@link AnimatorControllerBuilder.create} or {@link AnimatorController.build} to create a new builder.
|
|
1155
1278
|
*
|
|
1156
|
-
*
|
|
1279
|
+
* The builder tracks state names and parameter types through the fluent chain,
|
|
1280
|
+
* providing autocomplete for state names in `.transition()` and type-aware
|
|
1281
|
+
* `.condition()` calls (e.g., trigger parameters don't require a mode argument).
|
|
1282
|
+
*
|
|
1283
|
+
* @example With pre-built AnimationClips
|
|
1157
1284
|
* ```ts
|
|
1158
|
-
* const controller =
|
|
1285
|
+
* const controller = AnimatorControllerBuilder.create("CharacterController")
|
|
1159
1286
|
* .floatParameter("Speed", 0)
|
|
1160
1287
|
* .triggerParameter("Jump")
|
|
1161
1288
|
* .state("Idle", { clip: idleClip, loop: true })
|
|
@@ -1166,36 +1293,70 @@ export declare class AnimatorController {
|
|
|
1166
1293
|
* .transition("Walk", "Idle", { duration: 0.25 })
|
|
1167
1294
|
* .condition("Speed", "less", 0.1)
|
|
1168
1295
|
* .transition("*", "Jump", { duration: 0.1 })
|
|
1169
|
-
* .condition("Jump"
|
|
1296
|
+
* .condition("Jump")
|
|
1170
1297
|
* .transition("Jump", "Idle", { hasExitTime: true, exitTime: 0.9, duration: 0.25 })
|
|
1171
1298
|
* .build();
|
|
1172
1299
|
* ```
|
|
1173
1300
|
*
|
|
1301
|
+
* @example With inline tracks (no pre-built clips needed)
|
|
1302
|
+
* ```ts
|
|
1303
|
+
* const controller = AnimatorControllerBuilder.create("Door")
|
|
1304
|
+
* .boolParameter("Open", false)
|
|
1305
|
+
* .state("Closed", { loop: true })
|
|
1306
|
+
* .track(door, "position", { from: [0, 0, 0], to: [0, 0, 0], duration: 1 })
|
|
1307
|
+
* .state("Open", { loop: true })
|
|
1308
|
+
* .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
|
|
1309
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
1310
|
+
* .transition("Closed", "Open", { duration: 0.25 })
|
|
1311
|
+
* .condition("Open", "if")
|
|
1312
|
+
* .transition("Open", "Closed", { duration: 0.25 })
|
|
1313
|
+
* .condition("Open", "ifNot")
|
|
1314
|
+
* .build(room);
|
|
1315
|
+
* ```
|
|
1316
|
+
*
|
|
1317
|
+
* @typeParam TStates - Union of state names added via `.state()`. Used for autocomplete and validation in `.transition()` and `.defaultState()`.
|
|
1318
|
+
* @typeParam TParams - Record mapping parameter names to their types (`"trigger"`, `"bool"`, `"float"`, `"int"`). Used for type-aware `.condition()` overloads.
|
|
1319
|
+
*
|
|
1174
1320
|
* @category Animation and Sequencing
|
|
1175
1321
|
* @group Utilities
|
|
1176
1322
|
*/
|
|
1177
|
-
export declare class AnimatorControllerBuilder {
|
|
1323
|
+
export declare class AnimatorControllerBuilder<TStates extends string = never, TParams extends Record<string, "trigger" | "bool" | "float" | "int"> = {}> {
|
|
1178
1324
|
private _name;
|
|
1179
1325
|
private _parameters;
|
|
1180
1326
|
private _states;
|
|
1181
1327
|
private _anyStateTransitions;
|
|
1182
1328
|
private _defaultStateName;
|
|
1183
1329
|
private _lastTransition;
|
|
1330
|
+
private _lastState;
|
|
1331
|
+
/**
|
|
1332
|
+
* Creates a new AnimatorControllerBuilder instance.
|
|
1333
|
+
* @param name - Optional name for the controller
|
|
1334
|
+
*/
|
|
1335
|
+
static create(name?: string): AnimatorControllerBuilder;
|
|
1184
1336
|
constructor(name?: string);
|
|
1185
1337
|
/** Adds a float parameter */
|
|
1186
|
-
floatParameter(name:
|
|
1338
|
+
floatParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "float">>;
|
|
1187
1339
|
/** Adds an integer parameter */
|
|
1188
|
-
intParameter(name:
|
|
1340
|
+
intParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "int">>;
|
|
1189
1341
|
/** Adds a boolean parameter */
|
|
1190
|
-
boolParameter(name:
|
|
1342
|
+
boolParameter<N extends string>(name: N, defaultValue?: boolean): AnimatorControllerBuilder<TStates, TParams & Record<N, "bool">>;
|
|
1191
1343
|
/** Adds a trigger parameter */
|
|
1192
|
-
triggerParameter(name:
|
|
1344
|
+
triggerParameter<N extends string>(name: N): AnimatorControllerBuilder<TStates, TParams & Record<N, "trigger">>;
|
|
1193
1345
|
/**
|
|
1194
1346
|
* Adds a state to the controller. The first state added becomes the default state.
|
|
1347
|
+
*
|
|
1348
|
+
* When `options.clip` is provided, the state uses that clip directly.
|
|
1349
|
+
* When omitted, chain `.track()` calls to define animation tracks inline:
|
|
1350
|
+
* ```ts
|
|
1351
|
+
* .state("Open", { loop: true })
|
|
1352
|
+
* .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
|
|
1353
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
1354
|
+
* ```
|
|
1355
|
+
*
|
|
1195
1356
|
* @param name - Unique name for the state
|
|
1196
|
-
* @param options - State configuration including clip, loop, speed
|
|
1357
|
+
* @param options - State configuration including clip, loop, speed. When omitted, use `.track()` to add animation data.
|
|
1197
1358
|
*/
|
|
1198
|
-
state(name:
|
|
1359
|
+
state<N extends string>(name: N, options?: StateOptions): AnimatorControllerBuilder<TStates | N, TParams>;
|
|
1199
1360
|
/**
|
|
1200
1361
|
* Adds a transition between two states.
|
|
1201
1362
|
* Use `"*"` as the source to create a transition from any state.
|
|
@@ -1204,26 +1365,52 @@ export declare class AnimatorControllerBuilder {
|
|
|
1204
1365
|
* @param to - Destination state name
|
|
1205
1366
|
* @param options - Transition configuration
|
|
1206
1367
|
*/
|
|
1207
|
-
transition(from:
|
|
1368
|
+
transition(from: TStates | "*", to: TStates, options?: TransitionOptions): AnimatorControllerBuilder<TStates, TParams>;
|
|
1208
1369
|
/**
|
|
1209
1370
|
* Adds a condition to the most recently added transition.
|
|
1210
1371
|
* Multiple conditions on the same transition are AND-ed together.
|
|
1372
|
+
*
|
|
1373
|
+
* The required arguments depend on the parameter type:
|
|
1374
|
+
* - **Trigger**: `.condition("Jump")` — mode defaults to `"if"`, no threshold needed
|
|
1375
|
+
* - **Bool**: `.condition("Open", "if")` or `.condition("Open", "ifNot")`
|
|
1376
|
+
* - **Float/Int**: `.condition("Speed", "greater", 0.1)`
|
|
1377
|
+
*
|
|
1211
1378
|
* @param parameter - Name of the parameter to evaluate
|
|
1212
|
-
* @param mode - Condition mode: `"if"`, `"ifNot"`, `"greater"`, `"less"`, `"equals"`, `"notEqual"`
|
|
1213
|
-
* @param threshold - Comparison threshold for numeric conditions (default: 0)
|
|
1214
1379
|
*/
|
|
1215
|
-
condition(parameter:
|
|
1380
|
+
condition(parameter: ParamNamesOfType<TParams, "trigger">, mode?: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
|
|
1381
|
+
condition(parameter: ParamNamesOfType<TParams, "bool">, mode: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
|
|
1382
|
+
condition(parameter: ParamNamesOfType<TParams, "float" | "int">, mode: "greater" | "less" | "equals" | "notEqual", threshold?: number): AnimatorControllerBuilder<TStates, TParams>;
|
|
1383
|
+
/** Adds an animation track for an Object3D's position or scale to the current state */
|
|
1384
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF<Vec3Value>, options?: TrackOptions): this;
|
|
1385
|
+
/** Adds an animation track for an Object3D's quaternion to the current state */
|
|
1386
|
+
track(target: Object3D, property: "quaternion", keyframes: KF<QuatValue>, options?: TrackOptions): this;
|
|
1387
|
+
/** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) to the current state */
|
|
1388
|
+
track(target: Object3D, property: "rotation", keyframes: KF<EulerValue>, options?: TrackOptions): this;
|
|
1389
|
+
/** Adds an animation track for an Object3D's visibility to the current state */
|
|
1390
|
+
track(target: Object3D, property: "visible", keyframes: KF<boolean>, options?: TrackOptions): this;
|
|
1391
|
+
/** Adds an animation track for a material's numeric property to the current state */
|
|
1392
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF<number>, options?: TrackOptions): this;
|
|
1393
|
+
/** Adds an animation track for a material's color property to the current state */
|
|
1394
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF<ColorValue>, options?: TrackOptions): this;
|
|
1395
|
+
/** Adds an animation track for a light's numeric property to the current state */
|
|
1396
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF<number>, options?: TrackOptions): this;
|
|
1397
|
+
/** Adds an animation track for a light's color to the current state */
|
|
1398
|
+
track(target: Light_2, property: "color", keyframes: KF<ColorValue>, options?: TrackOptions): this;
|
|
1399
|
+
/** Adds an animation track for a camera's numeric property to the current state */
|
|
1400
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF<number>, options?: TrackOptions): this;
|
|
1216
1401
|
/**
|
|
1217
1402
|
* Sets which state is the default/entry state.
|
|
1218
1403
|
* If not called, the first added state is used.
|
|
1219
1404
|
* @param name - Name of the state
|
|
1220
1405
|
*/
|
|
1221
|
-
defaultState(name:
|
|
1406
|
+
defaultState(name: TStates): AnimatorControllerBuilder<TStates, TParams>;
|
|
1222
1407
|
/**
|
|
1223
1408
|
* Builds and returns the {@link AnimatorController}.
|
|
1224
1409
|
* Resolves all state name references to indices.
|
|
1410
|
+
* @param root - Optional root Object3D for resolving {@link TrackDescriptor} track paths.
|
|
1411
|
+
* When provided, tracks targeting a different object use `target.name` for named resolution.
|
|
1225
1412
|
*/
|
|
1226
|
-
build(): AnimatorController;
|
|
1413
|
+
build(root?: Object3D): AnimatorController;
|
|
1227
1414
|
}
|
|
1228
1415
|
|
|
1229
1416
|
export declare type AnimatorControllerModel = {
|
|
@@ -1472,6 +1659,75 @@ export declare class Attractor extends Component {
|
|
|
1472
1659
|
|
|
1473
1660
|
declare type AttributeChangeCallback = (value: string | null) => void;
|
|
1474
1661
|
|
|
1662
|
+
/**
|
|
1663
|
+
* Represents an audio clip that can be loaded and played independently.
|
|
1664
|
+
* The AudioClip class encapsulates the URL of the audio resource and provides
|
|
1665
|
+
* methods for playback control (play, pause, stop) and querying duration.
|
|
1666
|
+
*/
|
|
1667
|
+
export declare class AudioClip {
|
|
1668
|
+
readonly url: string;
|
|
1669
|
+
/**
|
|
1670
|
+
* Creates a new AudioClip instance with the specified URL.
|
|
1671
|
+
* @param url The URL of the audio resource to load. This can be a path to an audio file or a MediaStream URL.
|
|
1672
|
+
*/
|
|
1673
|
+
constructor(url: string);
|
|
1674
|
+
/** Whether the clip is currently playing.
|
|
1675
|
+
* @returns `true` if the clip is actively playing audio.
|
|
1676
|
+
*/
|
|
1677
|
+
get isPlaying(): boolean;
|
|
1678
|
+
/**
|
|
1679
|
+
* The total duration of the audio clip in seconds.
|
|
1680
|
+
* Loads the audio metadata if not already available.
|
|
1681
|
+
* @returns A promise that resolves with the duration in seconds.
|
|
1682
|
+
*/
|
|
1683
|
+
getDuration(): Promise<number>;
|
|
1684
|
+
/**
|
|
1685
|
+
* Plays the audio clip from the current position.
|
|
1686
|
+
* @returns A promise that resolves when playback finishes, or rejects on error.
|
|
1687
|
+
* If the clip is looping, the promise will never resolve on its own – call {@link stop} or {@link pause} to end playback.
|
|
1688
|
+
*/
|
|
1689
|
+
play(): Promise<void>;
|
|
1690
|
+
/**
|
|
1691
|
+
* Pauses playback at the current position.
|
|
1692
|
+
* Call {@link play} to resume.
|
|
1693
|
+
*/
|
|
1694
|
+
pause(): void;
|
|
1695
|
+
/**
|
|
1696
|
+
* Stops playback and resets the position to the beginning.
|
|
1697
|
+
*/
|
|
1698
|
+
stop(): void;
|
|
1699
|
+
/** Whether the clip should loop when reaching the end. */
|
|
1700
|
+
get loop(): boolean;
|
|
1701
|
+
set loop(value: boolean);
|
|
1702
|
+
/** Playback volume from 0 (silent) to 1 (full). */
|
|
1703
|
+
get volume(): number;
|
|
1704
|
+
set volume(value: number);
|
|
1705
|
+
/** Current playback position in seconds. */
|
|
1706
|
+
get currentTime(): number;
|
|
1707
|
+
set currentTime(value: number);
|
|
1708
|
+
/** Normalized playback progress from 0 to 1.
|
|
1709
|
+
* @returns The current playback position as a value between 0 and 1, or 0 if the duration is unknown.
|
|
1710
|
+
*/
|
|
1711
|
+
get progress(): number;
|
|
1712
|
+
/**
|
|
1713
|
+
* Seeks to a normalized position (0–1) in the clip.
|
|
1714
|
+
* @param position A value between 0 (start) and 1 (end).
|
|
1715
|
+
*/
|
|
1716
|
+
seek(position: number): void;
|
|
1717
|
+
/** The underlying HTMLAudioElement, or `undefined` if not yet created.
|
|
1718
|
+
* Use this to connect the element to the Web Audio API via `createMediaElementSource()`.
|
|
1719
|
+
* @returns The HTMLAudioElement if the clip has been loaded or played, otherwise `undefined`.
|
|
1720
|
+
*/
|
|
1721
|
+
get audioElement(): HTMLAudioElement | undefined;
|
|
1722
|
+
private _audioElement?;
|
|
1723
|
+
private _duration?;
|
|
1724
|
+
private _loadPromise?;
|
|
1725
|
+
private _loop;
|
|
1726
|
+
private _volume;
|
|
1727
|
+
/** Lazily creates and loads the shared HTMLAudioElement. */
|
|
1728
|
+
private ensureAudioElement;
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1475
1731
|
/**
|
|
1476
1732
|
* @category Animation and Sequencing
|
|
1477
1733
|
* @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
|
|
@@ -1486,6 +1742,26 @@ declare type AudioClipModel_2 = Models.ClipModel & {
|
|
|
1486
1742
|
_didTriggerPlay: boolean;
|
|
1487
1743
|
};
|
|
1488
1744
|
|
|
1745
|
+
/**
|
|
1746
|
+
* Options for an audio clip in the timeline builder
|
|
1747
|
+
*/
|
|
1748
|
+
export declare type AudioClipOptions = {
|
|
1749
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
1750
|
+
start?: number;
|
|
1751
|
+
/** Duration of the clip in seconds (required for audio since we can't infer it) */
|
|
1752
|
+
duration: number;
|
|
1753
|
+
/** Playback speed multiplier (default: 1) */
|
|
1754
|
+
speed?: number;
|
|
1755
|
+
/** Volume multiplier for this clip (default: 1) */
|
|
1756
|
+
volume?: number;
|
|
1757
|
+
/** Whether the audio should loop within the clip (default: false) */
|
|
1758
|
+
loop?: boolean;
|
|
1759
|
+
/** Ease-in duration in seconds (default: 0) */
|
|
1760
|
+
easeIn?: number;
|
|
1761
|
+
/** Ease-out duration in seconds (default: 0) */
|
|
1762
|
+
easeOut?: number;
|
|
1763
|
+
};
|
|
1764
|
+
|
|
1489
1765
|
export declare class AudioExtension implements IUSDExporterExtension {
|
|
1490
1766
|
static getName(clip: string): string;
|
|
1491
1767
|
get extensionName(): string;
|
|
@@ -1522,7 +1798,7 @@ export { AudioListener_2 as AudioListener }
|
|
|
1522
1798
|
/**
|
|
1523
1799
|
* Defines how audio volume attenuates over distance from the listener.
|
|
1524
1800
|
*/
|
|
1525
|
-
declare enum AudioRolloffMode {
|
|
1801
|
+
export declare enum AudioRolloffMode {
|
|
1526
1802
|
/**
|
|
1527
1803
|
* Logarithmic rolloff provides a natural, real-world attenuation where volume decreases
|
|
1528
1804
|
* exponentially with distance.
|
|
@@ -1627,9 +1903,10 @@ export declare class AudioSource extends Component {
|
|
|
1627
1903
|
*/
|
|
1628
1904
|
get isPlaying(): boolean;
|
|
1629
1905
|
/**
|
|
1630
|
-
* The total duration of the
|
|
1906
|
+
* The total duration of the currently loaded audio clip in seconds.
|
|
1631
1907
|
*
|
|
1632
1908
|
* @returns Duration in seconds or undefined if no clip is loaded
|
|
1909
|
+
* @remarks For MediaStream clips, duration is not directly available and will return undefined. If the audio clip has not started loading or is still loading, duration may also be undefined until the audio buffer is ready.
|
|
1633
1910
|
*/
|
|
1634
1911
|
get duration(): number | undefined;
|
|
1635
1912
|
/**
|
|
@@ -1654,7 +1931,8 @@ export declare class AudioSource extends Component {
|
|
|
1654
1931
|
/**
|
|
1655
1932
|
* Controls how the audio is positioned in space.
|
|
1656
1933
|
* Values range from 0 (2D, non-positional) to 1 (fully 3D positioned).
|
|
1657
|
-
*
|
|
1934
|
+
* Internally uses a dual-path audio graph to crossfade between a spatialized (PannerNode)
|
|
1935
|
+
* and a non-spatialized (direct) signal path.
|
|
1658
1936
|
*/
|
|
1659
1937
|
get spatialBlend(): number;
|
|
1660
1938
|
set spatialBlend(val: number);
|
|
@@ -1702,7 +1980,11 @@ export declare class AudioSource extends Component {
|
|
|
1702
1980
|
private audioLoader;
|
|
1703
1981
|
private shouldPlay;
|
|
1704
1982
|
private _lastClipStartedLoading;
|
|
1983
|
+
private _loadedClip;
|
|
1705
1984
|
private _audioElement;
|
|
1985
|
+
private _entryNode;
|
|
1986
|
+
private _spatialGain;
|
|
1987
|
+
private _bypassGain;
|
|
1706
1988
|
/**
|
|
1707
1989
|
* Returns the underlying {@link PositionalAudio} object, creating it if necessary.
|
|
1708
1990
|
* The audio source needs a user interaction to be initialized due to browser autoplay policies.
|
|
@@ -1730,6 +2012,15 @@ export declare class AudioSource extends Component {
|
|
|
1730
2012
|
private onApplicationMuteChanged;
|
|
1731
2013
|
private createAudio;
|
|
1732
2014
|
private __onAllowAudioCallback;
|
|
2015
|
+
/**
|
|
2016
|
+
* Sets up the dual-path audio graph for spatial blend crossfading.
|
|
2017
|
+
* Creates two parallel signal paths from source to output:
|
|
2018
|
+
* - 3D path: entry → panner → spatialGain → gain (spatialized)
|
|
2019
|
+
* - 2D path: entry → bypassGain → gain (non-spatialized)
|
|
2020
|
+
*/
|
|
2021
|
+
private setupSpatialBlendNodes;
|
|
2022
|
+
/** Updates the spatial/bypass gain values based on the current spatialBlend. */
|
|
2023
|
+
private updateSpatialBlendGains;
|
|
1733
2024
|
private applySpatialDistanceSettings;
|
|
1734
2025
|
private onNewClip;
|
|
1735
2026
|
/**
|
|
@@ -1737,8 +2028,9 @@ export declare class AudioSource extends Component {
|
|
|
1737
2028
|
* If no argument is provided, plays the currently assigned clip.
|
|
1738
2029
|
*
|
|
1739
2030
|
* @param clip - Optional audio clip or {@link MediaStream} to play
|
|
2031
|
+
* @returns A promise that resolves when playback starts successfully, or rejects on error
|
|
1740
2032
|
*/
|
|
1741
|
-
play(clip?: string | MediaStream | undefined):
|
|
2033
|
+
play(clip?: string | MediaStream | undefined): Promise<boolean>;
|
|
1742
2034
|
/**
|
|
1743
2035
|
* Pauses audio playback while maintaining the current position.
|
|
1744
2036
|
* Use play() to resume from the paused position.
|
|
@@ -1755,30 +2047,15 @@ export declare class AudioSource extends Component {
|
|
|
1755
2047
|
/* Excluded from this release type: update */
|
|
1756
2048
|
}
|
|
1757
2049
|
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
onAllowAudioChanged(allow: boolean): void;
|
|
1768
|
-
addModel(model: Models.ClipModel): void;
|
|
1769
|
-
onDisable(): void;
|
|
1770
|
-
onDestroy(): void;
|
|
1771
|
-
onMuteChanged(): void;
|
|
1772
|
-
stop(): void;
|
|
1773
|
-
private _playableDirectorResumed;
|
|
1774
|
-
onPauseChanged(): void;
|
|
1775
|
-
evaluate(time: number): void;
|
|
1776
|
-
/** Call to load audio buffer for a specific time in the track. Can be used to preload the timeline audio */
|
|
1777
|
-
loadAudio(time: number, lookAhead?: number, lookBehind?: number): Promise<(AudioBuffer | null)[]> | null;
|
|
1778
|
-
private isInTimeRange;
|
|
1779
|
-
private static _audioBuffers;
|
|
1780
|
-
static dispose(): void;
|
|
1781
|
-
private handleAudioLoading;
|
|
2050
|
+
/**
|
|
2051
|
+
* Builder for audio tracks. Provides `.clip()` for adding audio clips by URL.
|
|
2052
|
+
* @category Animation and Sequencing
|
|
2053
|
+
*/
|
|
2054
|
+
export declare interface AudioTrackBuilder extends TimelineBuilderBase {
|
|
2055
|
+
/** Adds an audio clip by URL */
|
|
2056
|
+
clip(url: string, options: AudioClipOptions): AudioTrackBuilder;
|
|
2057
|
+
/** Mutes this track so it is skipped during playback */
|
|
2058
|
+
muted(muted?: boolean): AudioTrackBuilder;
|
|
1782
2059
|
}
|
|
1783
2060
|
|
|
1784
2061
|
/* Excluded from this release type: AuralMode */
|
|
@@ -1811,69 +2088,6 @@ export declare class Avatar extends Component {
|
|
|
1811
2088
|
private loadAvatarObjects;
|
|
1812
2089
|
}
|
|
1813
2090
|
|
|
1814
|
-
/* Excluded from this release type: Avatar_Brain_LookAt */
|
|
1815
|
-
|
|
1816
|
-
/* Excluded from this release type: Avatar_MouthShapes */
|
|
1817
|
-
|
|
1818
|
-
/* Excluded from this release type: Avatar_MustacheShake */
|
|
1819
|
-
|
|
1820
|
-
/* Excluded from this release type: Avatar_POI */
|
|
1821
|
-
|
|
1822
|
-
/* Excluded from this release type: AvatarBlink_Simple */
|
|
1823
|
-
|
|
1824
|
-
/* Excluded from this release type: AvatarEyeLook_Rotation */
|
|
1825
|
-
|
|
1826
|
-
/**
|
|
1827
|
-
* Handles loading and instantiating avatar models from various sources.
|
|
1828
|
-
* Provides functionality to find and extract important parts of an avatar (head, hands).
|
|
1829
|
-
*
|
|
1830
|
-
* Debug mode can be enabled with the URL parameter `?debugavatar`,
|
|
1831
|
-
* which will log detailed information about avatar loading and configuration.
|
|
1832
|
-
*/
|
|
1833
|
-
export declare class AvatarLoader {
|
|
1834
|
-
private readonly avatarRegistryUrl;
|
|
1835
|
-
/**
|
|
1836
|
-
* Retrieves or creates a new avatar instance from an ID or existing Object3D.
|
|
1837
|
-
* @param context The application context
|
|
1838
|
-
* @param avatarId Either a string ID to load an avatar or an existing Object3D to use as avatar
|
|
1839
|
-
* @returns Promise resolving to an AvatarModel if successful, or null if failed
|
|
1840
|
-
*/
|
|
1841
|
-
getOrCreateNewAvatarInstance(context: Context, avatarId: string | Object3D): Promise<AvatarModel | null>;
|
|
1842
|
-
/**
|
|
1843
|
-
* Loads an avatar model from a file or registry using the provided ID.
|
|
1844
|
-
* @param context The engine context
|
|
1845
|
-
* @param avatarId The ID of the avatar to load
|
|
1846
|
-
* @returns Promise resolving to the loaded avatar's Object3D, or null if failed
|
|
1847
|
-
*/
|
|
1848
|
-
private loadAvatar;
|
|
1849
|
-
/**
|
|
1850
|
-
* Caches an avatar model for reuse.
|
|
1851
|
-
* @param _id The ID to associate with the model
|
|
1852
|
-
* @param _model The avatar model to cache
|
|
1853
|
-
*/
|
|
1854
|
-
private cacheModel;
|
|
1855
|
-
/**
|
|
1856
|
-
* Analyzes an Object3D to find avatar parts (head, hands) based on naming conventions.
|
|
1857
|
-
* @param obj The Object3D to search for avatar parts
|
|
1858
|
-
* @returns A structured AvatarModel with references to found parts
|
|
1859
|
-
*/
|
|
1860
|
-
private findAvatar;
|
|
1861
|
-
/**
|
|
1862
|
-
* Recursively searches for an avatar part by name within an Object3D hierarchy.
|
|
1863
|
-
* @param obj The Object3D to search within
|
|
1864
|
-
* @param searchString Array of strings that should all be present in the object name
|
|
1865
|
-
* @returns The found Object3D part or null if not found
|
|
1866
|
-
*/
|
|
1867
|
-
private findAvatarPart;
|
|
1868
|
-
/**
|
|
1869
|
-
* Handles HTTP response errors from avatar loading operations.
|
|
1870
|
-
* @param response The fetch API response to check
|
|
1871
|
-
* @returns The response if it was ok
|
|
1872
|
-
* @throws Error with status text if response was not ok
|
|
1873
|
-
*/
|
|
1874
|
-
private handleCustomAvatarErrors;
|
|
1875
|
-
}
|
|
1876
|
-
|
|
1877
2091
|
/**
|
|
1878
2092
|
* Marks a GameObject as being controlled or owned by a player in networked XR sessions.
|
|
1879
2093
|
* This is used internally by the networking system to identify player-controlled objects.
|
|
@@ -1934,35 +2148,6 @@ declare type AvatarMarkerEventArgs = {
|
|
|
1934
2148
|
gameObject: Object3D;
|
|
1935
2149
|
};
|
|
1936
2150
|
|
|
1937
|
-
/**
|
|
1938
|
-
* Represents an avatar model with head and hands references.
|
|
1939
|
-
* Used for representing characters in 3D space.
|
|
1940
|
-
*/
|
|
1941
|
-
export declare class AvatarModel {
|
|
1942
|
-
/** The root object of the avatar model */
|
|
1943
|
-
root: Object3D;
|
|
1944
|
-
/** The head object of the avatar model */
|
|
1945
|
-
head: Object3D;
|
|
1946
|
-
/** The left hand object of the avatar model, if available */
|
|
1947
|
-
leftHand: Object3D | null;
|
|
1948
|
-
/** The right hand object of the avatar model, if available */
|
|
1949
|
-
rigthHand: Object3D | null;
|
|
1950
|
-
/**
|
|
1951
|
-
* Checks if the avatar model has a valid configuration.
|
|
1952
|
-
* An avatar is considered valid if it has a head.
|
|
1953
|
-
* @returns Whether the avatar has a valid setup
|
|
1954
|
-
*/
|
|
1955
|
-
get isValid(): boolean;
|
|
1956
|
-
/**
|
|
1957
|
-
* Creates a new avatar model.
|
|
1958
|
-
* @param root The root object of the avatar
|
|
1959
|
-
* @param head The head object of the avatar
|
|
1960
|
-
* @param leftHand The left hand object of the avatar
|
|
1961
|
-
* @param rigthHand The right hand object of the avatar
|
|
1962
|
-
*/
|
|
1963
|
-
constructor(root: Object3D, head: Object3D, leftHand: Object3D | null, rigthHand: Object3D | null);
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
2151
|
export declare enum Axes {
|
|
1967
2152
|
None = 0,
|
|
1968
2153
|
X = 2,
|
|
@@ -2326,7 +2511,6 @@ export declare class BoxCollider extends Collider implements IBoxCollider {
|
|
|
2326
2511
|
center: Vector3;
|
|
2327
2512
|
/* Excluded from this release type: onEnable */
|
|
2328
2513
|
/* Excluded from this release type: onDisable */
|
|
2329
|
-
/* Excluded from this release type: onValidate */
|
|
2330
2514
|
/**
|
|
2331
2515
|
* Automatically fits the collider to the geometry of the object.
|
|
2332
2516
|
* Sets the size and center based on the object's bounding box.
|
|
@@ -2600,6 +2784,7 @@ declare class CallHandle extends EventDispatcher<any> {
|
|
|
2600
2784
|
* CallInfo represents a single callback method that can be invoked by the {@link EventList}.
|
|
2601
2785
|
*/
|
|
2602
2786
|
export declare class CallInfo {
|
|
2787
|
+
$serializedTypes: Record<string, any>;
|
|
2603
2788
|
/**
|
|
2604
2789
|
* When the CallInfo is enabled it will be invoked when the EventList is invoked
|
|
2605
2790
|
*/
|
|
@@ -2946,7 +3131,7 @@ export declare class Canvas extends UIRootComponent implements ICanvas {
|
|
|
2946
3131
|
private _receivers;
|
|
2947
3132
|
registerEventReceiver(receiver: ICanvasEventReceiver): void;
|
|
2948
3133
|
unregisterEventReceiver(receiver: ICanvasEventReceiver): void;
|
|
2949
|
-
onEnterXR(args: NeedleXREventArgs):
|
|
3134
|
+
onEnterXR(args: NeedleXREventArgs): void;
|
|
2950
3135
|
onLeaveXR(args: NeedleXREventArgs): void;
|
|
2951
3136
|
onBeforeRenderRoutine: () => void;
|
|
2952
3137
|
onAfterRenderRoutine: () => void;
|
|
@@ -3522,6 +3707,22 @@ export declare abstract class Collider extends Component implements ICollider {
|
|
|
3522
3707
|
* The layers that this collider will interact with. Used for filtering collision detection.
|
|
3523
3708
|
*/
|
|
3524
3709
|
filter?: number[];
|
|
3710
|
+
/**
|
|
3711
|
+
* The density of the collider, used for automatic mass calculation when the attached {@link Rigidbody} has `autoMass` enabled.
|
|
3712
|
+
* Rapier computes mass from density using the real-world formula: `mass = density × volume`.
|
|
3713
|
+
* The volume is derived from the collider shape (sphere, box, capsule, or convex hull).
|
|
3714
|
+
*
|
|
3715
|
+
* Reference values (relative to water = 1.0):
|
|
3716
|
+
* - Wood: 0.5–0.9
|
|
3717
|
+
* - Water: 1.0 (engine default)
|
|
3718
|
+
* - Rubber: 1.2
|
|
3719
|
+
* - Steel: 7.8
|
|
3720
|
+
*
|
|
3721
|
+
* @default undefined — uses the physics engine default of 1.0
|
|
3722
|
+
*/
|
|
3723
|
+
density?: number;
|
|
3724
|
+
/* Excluded from this release type: _propertiesDirty */
|
|
3725
|
+
/* Excluded from this release type: onValidate */
|
|
3525
3726
|
/* Excluded from this release type: awake */
|
|
3526
3727
|
/* Excluded from this release type: start */
|
|
3527
3728
|
/* Excluded from this release type: onEnable */
|
|
@@ -3623,7 +3824,10 @@ declare class ColorSerializer extends TypeSerializer {
|
|
|
3623
3824
|
onSerialize(data: any): any | void;
|
|
3624
3825
|
}
|
|
3625
3826
|
|
|
3626
|
-
export declare
|
|
3827
|
+
export declare let colorSerializer: ColorSerializer;
|
|
3828
|
+
|
|
3829
|
+
/** A Color value, either as a Three.js Color or as an `[r, g, b]` tuple (0–1) */
|
|
3830
|
+
declare type ColorValue = Color | [number, number, number];
|
|
3627
3831
|
|
|
3628
3832
|
/**
|
|
3629
3833
|
* Utility method to check if two materials were created from the same glTF material
|
|
@@ -3644,7 +3848,7 @@ export declare function compareAssociation<T extends Material>(obj1: T, obj2: T)
|
|
|
3644
3848
|
* **Input event methods:**
|
|
3645
3849
|
* {@link onPointerDown}, {@link onPointerUp}, {@link onPointerEnter}, {@link onPointerExit} and {@link onPointerMove}.
|
|
3646
3850
|
*
|
|
3647
|
-
* @example
|
|
3851
|
+
* @example Basic component
|
|
3648
3852
|
* ```typescript
|
|
3649
3853
|
* import { Behaviour } from "@needle-tools/engine";
|
|
3650
3854
|
* export class MyComponent extends Behaviour {
|
|
@@ -3657,6 +3861,25 @@ export declare function compareAssociation<T extends Material>(obj1: T, obj2: T)
|
|
|
3657
3861
|
* }
|
|
3658
3862
|
* ```
|
|
3659
3863
|
*
|
|
3864
|
+
* @example Automatic cleanup with autoCleanup
|
|
3865
|
+
* ```typescript
|
|
3866
|
+
* import { Behaviour, serializable, EventList } from "@needle-tools/engine";
|
|
3867
|
+
* export class ScoreTracker extends Behaviour {
|
|
3868
|
+
* @serializable(EventList)
|
|
3869
|
+
* onScoreChanged?: EventList<number>;
|
|
3870
|
+
*
|
|
3871
|
+
* start() {
|
|
3872
|
+
* // Registered during start → survives enable/disable, cleaned up on destroy
|
|
3873
|
+
* this.autoCleanup(this.onScoreChanged?.on(score => console.log("Score:", score)));
|
|
3874
|
+
* }
|
|
3875
|
+
*
|
|
3876
|
+
* onEnable() {
|
|
3877
|
+
* // Registered during onEnable → cleaned up on disable
|
|
3878
|
+
* this.autoCleanup(() => this.cleanupResources());
|
|
3879
|
+
* }
|
|
3880
|
+
* }
|
|
3881
|
+
* ```
|
|
3882
|
+
*
|
|
3660
3883
|
* @group Components
|
|
3661
3884
|
*/
|
|
3662
3885
|
declare abstract class Component implements IComponent, EventTarget, Partial<INeedleXRSessionEventReceiver>, Partial<IPointerEventHandler> {
|
|
@@ -3707,6 +3930,50 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
|
|
|
3707
3930
|
* @returns True if the component is enabled and all parent GameObjects are active
|
|
3708
3931
|
*/
|
|
3709
3932
|
get activeAndEnabled(): boolean;
|
|
3933
|
+
private __disableCleanups?;
|
|
3934
|
+
private __destroyCleanups?;
|
|
3935
|
+
/**
|
|
3936
|
+
* @experimental
|
|
3937
|
+
* Register a resource for automatic cleanup tied to this component's lifecycle.
|
|
3938
|
+
* Accepts {@link IDisposable} objects, cleanup functions, or event unsubscribe functions.
|
|
3939
|
+
* `null` and `undefined` are safe no-ops (convenient for conditional subscriptions).
|
|
3940
|
+
*
|
|
3941
|
+
* **Lifecycle-aware:** The cleanup store is chosen automatically based on when `autoCleanup` is called:
|
|
3942
|
+
* - Called during {@link onEnable} → cleaned up on {@link onDisable} (and re-registered on re-enable)
|
|
3943
|
+
* - Called during {@link awake} or {@link start} → cleaned up on {@link onDestroy} (survives enable/disable cycles)
|
|
3944
|
+
* - Called at any other time (e.g. from update) → cleaned up on {@link onDisable}
|
|
3945
|
+
*
|
|
3946
|
+
* @param disposable An {@link IDisposable}, a cleanup/unsubscribe function, or `null`/`undefined`
|
|
3947
|
+
*
|
|
3948
|
+
* @example EventList subscriptions
|
|
3949
|
+
* ```ts
|
|
3950
|
+
* import { Behaviour, serializable, EventList } from "@needle-tools/engine";
|
|
3951
|
+
*
|
|
3952
|
+
* export class MyComponent extends Behaviour {
|
|
3953
|
+
* @serializable(EventList)
|
|
3954
|
+
* onScoreChanged?: EventList<number>;
|
|
3955
|
+
*
|
|
3956
|
+
* onEnable() {
|
|
3957
|
+
* this.autoCleanup(this.onScoreChanged?.on(score => {
|
|
3958
|
+
* console.log("Score:", score);
|
|
3959
|
+
* }));
|
|
3960
|
+
* }
|
|
3961
|
+
* }
|
|
3962
|
+
* ```
|
|
3963
|
+
*
|
|
3964
|
+
* @example Lifetime subscriptions in awake
|
|
3965
|
+
* ```ts
|
|
3966
|
+
* import { Behaviour } from "@needle-tools/engine";
|
|
3967
|
+
*
|
|
3968
|
+
* export class Persistent extends Behaviour {
|
|
3969
|
+
* awake() {
|
|
3970
|
+
* // Registered during awake → survives enable/disable, cleaned up on destroy
|
|
3971
|
+
* this.autoCleanup(() => this.save());
|
|
3972
|
+
* }
|
|
3973
|
+
* }
|
|
3974
|
+
* ```
|
|
3975
|
+
*/
|
|
3976
|
+
protected autoCleanup(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
|
|
3710
3977
|
private get __isActive();
|
|
3711
3978
|
private get __isActiveInHierarchy();
|
|
3712
3979
|
private set __isActiveInHierarchy(value);
|
|
@@ -3725,11 +3992,6 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
|
|
|
3725
3992
|
* For example, URL to the glTF file this component was loaded from
|
|
3726
3993
|
*/
|
|
3727
3994
|
sourceId?: SourceIdentifier;
|
|
3728
|
-
/**
|
|
3729
|
-
* Called when this component needs to remap guids after an instantiate operation.
|
|
3730
|
-
* @param guidsMap Mapping from old guids to newly generated guids
|
|
3731
|
-
*/
|
|
3732
|
-
resolveGuids?(guidsMap: GuidsMap): void;
|
|
3733
3995
|
/**
|
|
3734
3996
|
* Called once when the component becomes active for the first time.
|
|
3735
3997
|
* This is the first lifecycle callback to be invoked
|
|
@@ -3942,6 +4204,10 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
|
|
|
3942
4204
|
destroy(): void;
|
|
3943
4205
|
/* Excluded from this release type: __didAwake */
|
|
3944
4206
|
/* Excluded from this release type: __didStart */
|
|
4207
|
+
/** True while start() has finished executing (used by autoCleanup to distinguish start from update) */
|
|
4208
|
+
private __didCompleteStart;
|
|
4209
|
+
/** True while onEnable() is executing (used by autoCleanup to route to disable store) */
|
|
4210
|
+
private __inEnableOrDisableCallback;
|
|
3945
4211
|
/* Excluded from this release type: __didEnable */
|
|
3946
4212
|
/* Excluded from this release type: __isEnabled */
|
|
3947
4213
|
/* Excluded from this release type: __destroyed */
|
|
@@ -4097,7 +4363,7 @@ declare class ComponentSerializer extends TypeSerializer {
|
|
|
4097
4363
|
findObjectForGuid(guid: string, root: Object3D): any;
|
|
4098
4364
|
}
|
|
4099
4365
|
|
|
4100
|
-
export declare
|
|
4366
|
+
export declare let componentSerializer: ComponentSerializer;
|
|
4101
4367
|
|
|
4102
4368
|
declare type ComponentType = "button" | "thumbstick" | "squeeze" | "touchpad";
|
|
4103
4369
|
|
|
@@ -4231,6 +4497,7 @@ export declare class ContactShadows extends Component {
|
|
|
4231
4497
|
set needsUpdate(val: boolean);
|
|
4232
4498
|
get needsUpdate(): boolean;
|
|
4233
4499
|
private _needsUpdate;
|
|
4500
|
+
private _needsFit;
|
|
4234
4501
|
/** All shadow objects are parented to this object.
|
|
4235
4502
|
* The gameObject itself should not be transformed because we want the ContactShadows object e.g. also have a GroundProjectedEnv component
|
|
4236
4503
|
* in which case ContactShadows scale would affect the projection
|
|
@@ -4460,13 +4727,14 @@ export declare class Context implements IContext {
|
|
|
4460
4727
|
* Use `setCurrentCamera` for updating the main camera.
|
|
4461
4728
|
*/
|
|
4462
4729
|
/**
|
|
4463
|
-
*
|
|
4464
|
-
* Types are
|
|
4465
|
-
*
|
|
4730
|
+
* Access your scene's full hierarchy, objects, and components directly by name — with full autocomplete.
|
|
4731
|
+
* Types are generated automatically from your GLB files when the dev server starts.
|
|
4732
|
+
*
|
|
4733
|
+
* You can store references to objects or components for later use.
|
|
4734
|
+
* Note that the scene hierarchy can change at runtime (e.g. when objects are added, removed, or re-parented),
|
|
4735
|
+
* in which case stored references may become stale.
|
|
4466
4736
|
*
|
|
4467
|
-
*
|
|
4468
|
-
* This is a convenience shorthand for `getComponent` lookups; the same result can be
|
|
4469
|
-
* achieved manually via `scene.getObjectByName(name)` + `getComponent(node, Type)`.
|
|
4737
|
+
* @experimental This API may change in future versions.
|
|
4470
4738
|
*
|
|
4471
4739
|
* @example
|
|
4472
4740
|
* // Toggle auto-rotate on the orbit camera
|
|
@@ -4475,12 +4743,6 @@ export declare class Context implements IContext {
|
|
|
4475
4743
|
* @example
|
|
4476
4744
|
* // Change the background color
|
|
4477
4745
|
* ctx.sceneData.Camera.Camera.backgroundColor = new RGBAColor(1, 0, 0, 1);
|
|
4478
|
-
*
|
|
4479
|
-
* @example
|
|
4480
|
-
* // Equivalent manual approach (without sceneData)
|
|
4481
|
-
* const node = ctx.scene.getObjectByName("Camera");
|
|
4482
|
-
* const orbit = getComponent(node, OrbitControls);
|
|
4483
|
-
* if (orbit) orbit.autoRotate = true;
|
|
4484
4746
|
*/
|
|
4485
4747
|
get sceneData(): SceneData;
|
|
4486
4748
|
get mainCamera(): Camera_2;
|
|
@@ -4489,30 +4751,48 @@ export declare class Context implements IContext {
|
|
|
4489
4751
|
private _mainCamera;
|
|
4490
4752
|
private _fallbackCamera;
|
|
4491
4753
|
/** access application state (e.g. if all audio should be muted) */
|
|
4492
|
-
application: Application;
|
|
4754
|
+
get application(): Application;
|
|
4755
|
+
private _application;
|
|
4493
4756
|
/** access animation mixer used by components in the scene */
|
|
4494
|
-
animations: AnimationsRegistry;
|
|
4757
|
+
get animations(): AnimationsRegistry;
|
|
4758
|
+
private _animations;
|
|
4495
4759
|
/** access timings (current frame number, deltaTime, timeScale, ...) */
|
|
4496
|
-
time: Time;
|
|
4760
|
+
get time(): Time;
|
|
4761
|
+
private _time;
|
|
4497
4762
|
/** access input data (e.g. click or touch events) */
|
|
4498
|
-
input: Input;
|
|
4763
|
+
get input(): Input;
|
|
4764
|
+
private _input;
|
|
4499
4765
|
/** access physics related methods (e.g. raycasting). To access the phyiscs engine use `context.physics.engine` */
|
|
4500
|
-
physics: Physics;
|
|
4766
|
+
get physics(): Physics;
|
|
4767
|
+
private _physics;
|
|
4501
4768
|
/** access postprocessing effects stack. Add/remove effects and configure adaptive performance settings */
|
|
4502
|
-
postprocessing: PostProcessing;
|
|
4769
|
+
get postprocessing(): PostProcessing;
|
|
4770
|
+
private _postprocessing;
|
|
4503
4771
|
/** access networking methods (use it to send or listen to messages or join a networking backend) */
|
|
4504
|
-
connection: NetworkConnection;
|
|
4772
|
+
get connection(): NetworkConnection;
|
|
4773
|
+
private _connection;
|
|
4774
|
+
/** context-level event bus for decoupled component communication
|
|
4775
|
+
* @see {@link ContextEventMap} for known event types
|
|
4776
|
+
*/
|
|
4777
|
+
get events(): EventBus;
|
|
4778
|
+
private _events;
|
|
4505
4779
|
/** @deprecated AssetDatabase is deprecated */
|
|
4506
4780
|
assets: AssetDatabase;
|
|
4507
|
-
/**
|
|
4508
|
-
|
|
4781
|
+
/** All registered lights in the scene, maintained by the Light component.
|
|
4782
|
+
* @see mainLight for accessing the main directional light in the scene
|
|
4783
|
+
*/
|
|
4784
|
+
readonly lights: ILight[];
|
|
4785
|
+
/** The brightest registered directional light, or null if none are registered
|
|
4786
|
+
* @see lights
|
|
4787
|
+
*/
|
|
4788
|
+
get mainLight(): ILight | null;
|
|
4509
4789
|
/** @deprecated Use sceneLighting */
|
|
4510
|
-
get rendererData()
|
|
4790
|
+
private get rendererData();
|
|
4511
4791
|
/** Access the scene lighting manager to control lighting settings in the context */
|
|
4512
|
-
sceneLighting: RendererData;
|
|
4513
|
-
addressables: Addressables;
|
|
4514
|
-
lightmaps: ILightDataRegistry;
|
|
4515
|
-
players: PlayerViewManager;
|
|
4792
|
+
readonly sceneLighting: RendererData;
|
|
4793
|
+
readonly addressables: Addressables;
|
|
4794
|
+
readonly lightmaps: ILightDataRegistry;
|
|
4795
|
+
readonly players: PlayerViewManager;
|
|
4516
4796
|
/** Access the LODs manager to control LOD behavior in the context */
|
|
4517
4797
|
readonly lodsManager: LODsManager;
|
|
4518
4798
|
/** Access the needle menu to add or remove buttons to the menu element */
|
|
@@ -4754,6 +5034,18 @@ export declare type ContextEventArgs = {
|
|
|
4754
5034
|
files?: LoadedModel[];
|
|
4755
5035
|
};
|
|
4756
5036
|
|
|
5037
|
+
/** Typed event map for {@link Context.events}.
|
|
5038
|
+
* Known events get full autocomplete; custom events can be typed at the call site via generic parameter.
|
|
5039
|
+
*/
|
|
5040
|
+
export declare interface ContextEventMap {
|
|
5041
|
+
"scene-content-changed": {
|
|
5042
|
+
/** The component that triggered the change (e.g. SceneSwitcher, DropListener) */
|
|
5043
|
+
readonly source: IComponent;
|
|
5044
|
+
/** The root object that was added/loaded */
|
|
5045
|
+
readonly object: Object3D;
|
|
5046
|
+
};
|
|
5047
|
+
}
|
|
5048
|
+
|
|
4757
5049
|
/** Use to register to various Needle Engine context events and to get access to all current instances
|
|
4758
5050
|
* e.g. when being created in the DOM
|
|
4759
5051
|
* @example
|
|
@@ -4805,6 +5097,20 @@ export declare type ControlClipModel = {
|
|
|
4805
5097
|
updateDirector: boolean;
|
|
4806
5098
|
};
|
|
4807
5099
|
|
|
5100
|
+
/**
|
|
5101
|
+
* Options for a control clip in the timeline builder
|
|
5102
|
+
*/
|
|
5103
|
+
export declare type ControlClipOptions = {
|
|
5104
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
5105
|
+
start?: number;
|
|
5106
|
+
/** Duration of the clip in seconds (required) */
|
|
5107
|
+
duration: number;
|
|
5108
|
+
/** Whether to control the activation of the source object (default: true) */
|
|
5109
|
+
controlActivation?: boolean;
|
|
5110
|
+
/** Whether to update a nested PlayableDirector on the source object (default: true) */
|
|
5111
|
+
updateDirector?: boolean;
|
|
5112
|
+
};
|
|
5113
|
+
|
|
4808
5114
|
/** true when selectstart was ever received.
|
|
4809
5115
|
* On VisionOS 1.1 we always have select events (as per the spec), so this is always true
|
|
4810
5116
|
*/
|
|
@@ -4815,12 +5121,15 @@ declare type ControllerAxes = "xr-standard-thumbstick" | "xr-standard-touchpad";
|
|
|
4815
5121
|
*/
|
|
4816
5122
|
export declare type ControllerChangedEvt = (args: NeedleXRControllerEventArgs) => void;
|
|
4817
5123
|
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
5124
|
+
/**
|
|
5125
|
+
* Builder for control tracks. Provides `.clip()` for controlling nested objects/timelines.
|
|
5126
|
+
* @category Animation and Sequencing
|
|
5127
|
+
*/
|
|
5128
|
+
export declare interface ControlTrackBuilder extends TimelineBuilderBase {
|
|
5129
|
+
/** Adds a control clip for a source object */
|
|
5130
|
+
clip(sourceObject: Object3D, options: ControlClipOptions): ControlTrackBuilder;
|
|
5131
|
+
/** Mutes this track so it is skipped during playback */
|
|
5132
|
+
muted(muted?: boolean): ControlTrackBuilder;
|
|
4824
5133
|
}
|
|
4825
5134
|
|
|
4826
5135
|
/**@obsolete use Graphics.copyTexture */
|
|
@@ -5008,7 +5317,6 @@ export declare class CursorFollow extends Component {
|
|
|
5008
5317
|
* - Cursor that follows terrain or mesh surfaces
|
|
5009
5318
|
*
|
|
5010
5319
|
* **Important notes:**
|
|
5011
|
-
* - Requires objects in the scene to have colliders for raycasting to work
|
|
5012
5320
|
* - Works best with {@link keepDistance} set to `false` to allow depth changes
|
|
5013
5321
|
* - Can be combined with {@link damping} for smooth surface following
|
|
5014
5322
|
* - The raycast uses the physics system's raycast functionality
|
|
@@ -5135,7 +5443,7 @@ export declare function decompressGpuTexture(texture: any, maxTextureSize?: numb
|
|
|
5135
5443
|
* return true;
|
|
5136
5444
|
* });
|
|
5137
5445
|
* */
|
|
5138
|
-
export declare function deepClone(obj: any, predicate?: deepClonePredicate): any;
|
|
5446
|
+
export declare function deepClone(obj: any, predicate?: deepClonePredicate, _visited?: WeakSet<object>): any;
|
|
5139
5447
|
|
|
5140
5448
|
declare type deepClonePredicate = (owner: any, propertyName: string, current: any) => boolean;
|
|
5141
5449
|
|
|
@@ -5363,7 +5671,7 @@ export declare namespace DeviceUtilities {
|
|
|
5363
5671
|
* Controls how the {@link PlayableDirector} behaves when playback reaches the end.
|
|
5364
5672
|
* @see {@link PlayableDirector.extrapolationMode}
|
|
5365
5673
|
*/
|
|
5366
|
-
declare enum DirectorWrapMode {
|
|
5674
|
+
export declare enum DirectorWrapMode {
|
|
5367
5675
|
/** Hold the last frame when playback reaches the end of the timeline. */
|
|
5368
5676
|
Hold = 0,
|
|
5369
5677
|
/** Loop back to the start and continue playing indefinitely. */
|
|
@@ -5372,6 +5680,101 @@ declare enum DirectorWrapMode {
|
|
|
5372
5680
|
None = 2
|
|
5373
5681
|
}
|
|
5374
5682
|
|
|
5683
|
+
/**
|
|
5684
|
+
* A store for managing disposable resources (event subscriptions, listeners, callbacks)
|
|
5685
|
+
* that should be cleaned up together.
|
|
5686
|
+
*
|
|
5687
|
+
* DisposableStore collects disposables and disposes them all at once when
|
|
5688
|
+
* {@link dispose} is called. After disposal, the store can be reused — new items
|
|
5689
|
+
* can be added and a subsequent {@link dispose} call will clean those up.
|
|
5690
|
+
*
|
|
5691
|
+
* This is the same pattern used internally by VSCode for lifecycle-bound resource management.
|
|
5692
|
+
*
|
|
5693
|
+
* @example Basic usage
|
|
5694
|
+
* ```ts
|
|
5695
|
+
* import { DisposableStore, on } from "@needle-tools/engine";
|
|
5696
|
+
*
|
|
5697
|
+
* const store = new DisposableStore();
|
|
5698
|
+
*
|
|
5699
|
+
* // Register a DOM event listener (typed!)
|
|
5700
|
+
* store.add(on(window, "resize", (ev) => console.log(ev)));
|
|
5701
|
+
*
|
|
5702
|
+
* // Register the return value of EventList.on()
|
|
5703
|
+
* store.add(myEventList.on(data => console.log(data)));
|
|
5704
|
+
*
|
|
5705
|
+
* // Register a raw cleanup function
|
|
5706
|
+
* store.add(() => someSDK.off("event", handler));
|
|
5707
|
+
*
|
|
5708
|
+
* // Later: dispose everything at once
|
|
5709
|
+
* store.dispose();
|
|
5710
|
+
* ```
|
|
5711
|
+
*
|
|
5712
|
+
* @example Use with Needle Engine components
|
|
5713
|
+
* ```ts
|
|
5714
|
+
* import { Behaviour, serializable, EventList, on } from "@needle-tools/engine";
|
|
5715
|
+
*
|
|
5716
|
+
* export class MyComponent extends Behaviour {
|
|
5717
|
+
* @serializable(EventList)
|
|
5718
|
+
* onClick?: EventList;
|
|
5719
|
+
*
|
|
5720
|
+
* onEnable() {
|
|
5721
|
+
* // DOM events — fully typed
|
|
5722
|
+
* this.autoCleanup(on(window, "resize", (ev) => this.onResize(ev)));
|
|
5723
|
+
*
|
|
5724
|
+
* // EventList — .on() returns a function, autoCleanup accepts it
|
|
5725
|
+
* this.autoCleanup(this.onClick?.on(() => console.log("clicked!")));
|
|
5726
|
+
* }
|
|
5727
|
+
* // No onDisable needed — cleaned up automatically!
|
|
5728
|
+
* }
|
|
5729
|
+
* ```
|
|
5730
|
+
*
|
|
5731
|
+
* @category Utilities
|
|
5732
|
+
* @group Lifecycle
|
|
5733
|
+
*/
|
|
5734
|
+
export declare class DisposableStore implements IDisposable {
|
|
5735
|
+
private _disposables;
|
|
5736
|
+
/** The number of registered disposables */
|
|
5737
|
+
get size(): number;
|
|
5738
|
+
/**
|
|
5739
|
+
* Register a disposable resource. Accepts:
|
|
5740
|
+
* - An {@link IDisposable} object (has a `dispose()` method) — e.g. from {@link on}
|
|
5741
|
+
* - A cleanup function (e.g. return value of `EventList.on()`)
|
|
5742
|
+
* - `null` or `undefined` (safe no-op for conditional subscriptions)
|
|
5743
|
+
*
|
|
5744
|
+
* When {@link dispose} is called, all registered resources are cleaned up.
|
|
5745
|
+
*
|
|
5746
|
+
* @param disposable The resource to register for disposal
|
|
5747
|
+
*
|
|
5748
|
+
* @example
|
|
5749
|
+
* ```ts
|
|
5750
|
+
* const store = new DisposableStore();
|
|
5751
|
+
*
|
|
5752
|
+
* // IDisposable object from on()
|
|
5753
|
+
* store.add(on(window, "resize", handler));
|
|
5754
|
+
*
|
|
5755
|
+
* // Function returned by EventList.on()
|
|
5756
|
+
* store.add(myEvent.on(handler));
|
|
5757
|
+
*
|
|
5758
|
+
* // Raw cleanup function
|
|
5759
|
+
* store.add(() => connection.close());
|
|
5760
|
+
*
|
|
5761
|
+
* // Conditional — safe with undefined
|
|
5762
|
+
* store.add(this.maybeEvent?.on(handler));
|
|
5763
|
+
* ```
|
|
5764
|
+
*/
|
|
5765
|
+
add(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
|
|
5766
|
+
/**
|
|
5767
|
+
* Dispose all registered resources. Each registered disposable is cleaned up,
|
|
5768
|
+
* then the internal list is cleared. The store can be reused after disposal.
|
|
5769
|
+
*
|
|
5770
|
+
* Called automatically by the engine when a component's `onDisable` lifecycle fires.
|
|
5771
|
+
*/
|
|
5772
|
+
dispose(): void;
|
|
5773
|
+
}
|
|
5774
|
+
|
|
5775
|
+
/** A function that performs cleanup when called */
|
|
5776
|
+
export declare type DisposeFn = () => void;
|
|
5777
|
+
|
|
5375
5778
|
/** Recursive disposes all referenced resources by this object. Does not traverse children */
|
|
5376
5779
|
export declare function disposeObjectResources(obj: object | null | undefined): void;
|
|
5377
5780
|
|
|
@@ -5479,6 +5882,12 @@ export declare class DragControls extends Component implements IPointerEventHand
|
|
|
5479
5882
|
* providing visual feedback about the object's position relative to surfaces below it.
|
|
5480
5883
|
*/
|
|
5481
5884
|
showGizmo: boolean;
|
|
5885
|
+
/** Invoked once when a drag begins (after the minimum drag distance threshold is met). */
|
|
5886
|
+
dragStarted: EventList;
|
|
5887
|
+
/** Invoked every frame while the object is being dragged. */
|
|
5888
|
+
dragUpdated: EventList;
|
|
5889
|
+
/** Invoked once when the last pointer is released and the drag ends. */
|
|
5890
|
+
dragEnded: EventList;
|
|
5482
5891
|
/**
|
|
5483
5892
|
* Returns the object currently being dragged by this DragControls component, if any.
|
|
5484
5893
|
* @returns The object being dragged or null if no object is currently dragged
|
|
@@ -5919,17 +6328,43 @@ export declare class EnvironmentScene extends Scene {
|
|
|
5919
6328
|
createAreaLightMaterial(intensity: number): MeshBasicMaterial;
|
|
5920
6329
|
}
|
|
5921
6330
|
|
|
5922
|
-
|
|
6331
|
+
/** An Euler value, either as a Three.js Euler or as a `[x, y, z]` tuple (radians) */
|
|
6332
|
+
declare type EulerValue = Euler | [number, number, number];
|
|
5923
6333
|
|
|
5924
|
-
|
|
5925
|
-
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
6334
|
+
/** Typed event bus. Known {@link ContextEventMap} events get full autocomplete.
|
|
6335
|
+
* Custom events can be typed at the call site via generic parameter.
|
|
6336
|
+
* @example Known events
|
|
6337
|
+
* ```ts
|
|
6338
|
+
* context.events.on("scene-content-changed", e => e.object);
|
|
6339
|
+
* ```
|
|
6340
|
+
* @example Custom events — type at call site
|
|
6341
|
+
* ```ts
|
|
6342
|
+
* context.events.emit<{ pts: number }>("scored", { pts: 10 });
|
|
6343
|
+
* context.events.on<{ pts: number }>("scored", e => e.pts);
|
|
6344
|
+
* ```
|
|
6345
|
+
* @example Once
|
|
6346
|
+
* ```ts
|
|
6347
|
+
* context.events.on("scene-content-changed", e => { ... }, { once: true });
|
|
6348
|
+
* ```
|
|
6349
|
+
*/
|
|
6350
|
+
export declare class EventBus {
|
|
6351
|
+
private _listeners;
|
|
6352
|
+
/** Emit a known {@link ContextEventMap} event */
|
|
6353
|
+
emit<K extends keyof ContextEventMap & string>(type: K, detail?: ContextEventMap[K]): void;
|
|
6354
|
+
/** Emit a custom event with user-provided type */
|
|
6355
|
+
emit<T>(type: string, detail?: T): void;
|
|
6356
|
+
/** Subscribe to a known {@link ContextEventMap} event. Returns an unsubscribe function. */
|
|
6357
|
+
on<K extends keyof ContextEventMap & string>(type: K, callback: (args: ContextEventMap[K]) => void, options?: EventBusListenerOptions): () => void;
|
|
6358
|
+
/** Subscribe to a custom event with user-provided type. Returns an unsubscribe function. */
|
|
6359
|
+
on<T>(type: string, callback: (args: T) => void, options?: EventBusListenerOptions): () => void;
|
|
6360
|
+
/** Remove all listeners. Called when the context is cleared or destroyed. */
|
|
6361
|
+
clear(): void;
|
|
6362
|
+
}
|
|
6363
|
+
|
|
6364
|
+
/** Options for {@link EventBus.on}. */
|
|
6365
|
+
export declare interface EventBusListenerOptions {
|
|
6366
|
+
/** If true the listener is automatically removed after the first invocation. */
|
|
6367
|
+
once?: boolean;
|
|
5933
6368
|
}
|
|
5934
6369
|
|
|
5935
6370
|
/**
|
|
@@ -5978,13 +6413,9 @@ declare class EulerSerializer extends TypeSerializer {
|
|
|
5978
6413
|
* @see {@link Button} for UI button events
|
|
5979
6414
|
*/
|
|
5980
6415
|
export declare class EventList<TArgs extends any = any> implements IEventList {
|
|
6416
|
+
$serializedTypes: Record<string, any>;
|
|
5981
6417
|
/** checked during instantiate to create a new instance */
|
|
5982
6418
|
readonly isEventList = true;
|
|
5983
|
-
/* Excluded from this release type: __internalOnInstantiate */
|
|
5984
|
-
private target?;
|
|
5985
|
-
private key?;
|
|
5986
|
-
/** set an event target to try invoke the EventTarget dispatchEvent when this EventList is invoked */
|
|
5987
|
-
setEventTarget(key: string, target: object): void;
|
|
5988
6419
|
/** How many callback methods are subscribed to this event */
|
|
5989
6420
|
get listenerCount(): number;
|
|
5990
6421
|
/** If the event is currently being invoked */
|
|
@@ -6017,13 +6448,41 @@ export declare class EventList<TArgs extends any = any> implements IEventList {
|
|
|
6017
6448
|
invoke(...args: Array<TArgs>): boolean;
|
|
6018
6449
|
/** Add a new event listener to this event
|
|
6019
6450
|
* @returns a function to remove the event listener
|
|
6451
|
+
* @see {@link removeEventListener} for more details and return value information
|
|
6452
|
+
* @see {@link off} for an alias with better readability when unsubscribing from events
|
|
6453
|
+
* @example
|
|
6454
|
+
* ```ts
|
|
6455
|
+
* const off = myEvent.addEventListener(args => console.log("Clicked!", args));
|
|
6456
|
+
* // later
|
|
6457
|
+
* off();
|
|
6458
|
+
* ```
|
|
6020
6459
|
*/
|
|
6021
6460
|
addEventListener(callback: (args: TArgs) => void): Function;
|
|
6461
|
+
/**
|
|
6462
|
+
* Alias for addEventListener for better readability when subscribing to events. You can use it like this:
|
|
6463
|
+
* ```ts
|
|
6464
|
+
* myEvent.on(args => console.log("Clicked!", args));
|
|
6465
|
+
* ```
|
|
6466
|
+
* @returns a function to remove the event listener
|
|
6467
|
+
* @see {@link addEventListener} for more details and return value information
|
|
6468
|
+
*/
|
|
6469
|
+
on(callback: (args: TArgs) => void): Function;
|
|
6022
6470
|
/**
|
|
6023
6471
|
* Remove an event listener from this event.
|
|
6024
6472
|
* @returns true if the event listener was found and removed, false otherwise
|
|
6025
6473
|
*/
|
|
6026
6474
|
removeEventListener(fn: Function | null | undefined): boolean;
|
|
6475
|
+
/**
|
|
6476
|
+
* Alias for removeEventListener for better readability when unsubscribing from events. You can use it like this:
|
|
6477
|
+
* ```ts
|
|
6478
|
+
* const off = myEvent.on(args => console.log("Clicked!", args));
|
|
6479
|
+
* // later
|
|
6480
|
+
* off();
|
|
6481
|
+
* ```
|
|
6482
|
+
*
|
|
6483
|
+
* @see {@link removeEventListener} for more details and return value information
|
|
6484
|
+
*/
|
|
6485
|
+
off(callback: Function | null | undefined): boolean;
|
|
6027
6486
|
/**
|
|
6028
6487
|
* Remove all event listeners from this event. Use with caution! This will remove all listeners!
|
|
6029
6488
|
*/
|
|
@@ -6054,6 +6513,7 @@ declare type EventListenerOptions_2 = {
|
|
|
6054
6513
|
signal?: AbortSignal;
|
|
6055
6514
|
};
|
|
6056
6515
|
|
|
6516
|
+
/** @deprecated No longer automatically dispatched. Use `eventList.on()` directly instead. */
|
|
6057
6517
|
export declare class EventListEvent<TArgs extends any> extends Event {
|
|
6058
6518
|
args?: TArgs;
|
|
6059
6519
|
}
|
|
@@ -6064,7 +6524,7 @@ declare class EventListSerializer extends TypeSerializer {
|
|
|
6064
6524
|
onDeserialize(data: EventListData, context: SerializationContext): EventList<any> | undefined | null;
|
|
6065
6525
|
}
|
|
6066
6526
|
|
|
6067
|
-
export declare
|
|
6527
|
+
export declare let eventListSerializer: EventListSerializer;
|
|
6068
6528
|
|
|
6069
6529
|
/**
|
|
6070
6530
|
* [EventSystem](https://engine.needle.tools/docs/api/EventSystem) is responsible for managing and dispatching input events to UI components within the scene.
|
|
@@ -6507,7 +6967,7 @@ declare type FitParameters = {
|
|
|
6507
6967
|
* @see {@link HingeJoint} for rotating connections
|
|
6508
6968
|
*/
|
|
6509
6969
|
export declare class FixedJoint extends Joint {
|
|
6510
|
-
protected createJoint(self: Rigidbody, other: Rigidbody):
|
|
6970
|
+
protected createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
6511
6971
|
}
|
|
6512
6972
|
|
|
6513
6973
|
declare type FocusRect = DOMRect | Element | {
|
|
@@ -7159,16 +7619,13 @@ export declare function getResourceUserCount(object: object): number | undefined
|
|
|
7159
7619
|
* Returns a lazily-resolved proxy typed as {@link SceneData}.
|
|
7160
7620
|
* The proxy is cached per context — each context gets exactly one instance.
|
|
7161
7621
|
*
|
|
7162
|
-
*
|
|
7163
|
-
*
|
|
7164
|
-
*
|
|
7165
|
-
*
|
|
7622
|
+
* Shape mirrors the generated `needle-bindings.gen.d.ts`:
|
|
7623
|
+
* ctx.sceneData.MyGlb.Camera.$components.OrbitControls.autoRotate = true;
|
|
7624
|
+
* ctx.sceneData.MyGlb.Camera.$object // → THREE.Camera
|
|
7625
|
+
* ctx.sceneData.MyGlb.UI.Button.$components.Button // → Needle Button component
|
|
7166
7626
|
*
|
|
7167
|
-
*
|
|
7168
|
-
*
|
|
7169
|
-
*
|
|
7170
|
-
* @example
|
|
7171
|
-
* ctx.sceneData.Camera.OrbitControls.autoRotate = true;
|
|
7627
|
+
* GLB name is ignored at runtime (scene is already loaded).
|
|
7628
|
+
* Node lookup starts at the scene root.
|
|
7172
7629
|
*/
|
|
7173
7630
|
export declare function getSceneData(ctx: IContext): SceneData;
|
|
7174
7631
|
|
|
@@ -7694,14 +8151,8 @@ export declare type GuidsMap = {
|
|
|
7694
8151
|
[key: string]: string;
|
|
7695
8152
|
};
|
|
7696
8153
|
|
|
7697
|
-
/* Excluded from this release type: hasCommercialLicense */
|
|
7698
|
-
|
|
7699
|
-
/* Excluded from this release type: hasIndieLicense */
|
|
7700
|
-
|
|
7701
8154
|
/* Excluded from this release type: hasPointerEventComponent */
|
|
7702
8155
|
|
|
7703
|
-
/* Excluded from this release type: hasProLicense */
|
|
7704
|
-
|
|
7705
8156
|
export declare function hideDebugConsole(): void;
|
|
7706
8157
|
|
|
7707
8158
|
export declare enum HideFlags {
|
|
@@ -7761,7 +8212,7 @@ export declare class HingeJoint extends Joint {
|
|
|
7761
8212
|
anchor?: Vector3;
|
|
7762
8213
|
/** Axis of rotation for the hinge (e.g., Vector3(0,1,0) for vertical axis) */
|
|
7763
8214
|
axis?: Vector3;
|
|
7764
|
-
protected createJoint(self: Rigidbody, other: Rigidbody):
|
|
8215
|
+
protected createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
7765
8216
|
}
|
|
7766
8217
|
|
|
7767
8218
|
declare type HitPointObject = Object3D & {
|
|
@@ -7984,7 +8435,7 @@ declare const HTMLElementBase: typeof HTMLElement;
|
|
|
7984
8435
|
|
|
7985
8436
|
export declare type IAnimationComponent = Pick<IComponent, "gameObject"> & {
|
|
7986
8437
|
isAnimationComponent: boolean;
|
|
7987
|
-
addClip?(clip: AnimationClip):
|
|
8438
|
+
addClip?(clip: AnimationClip): void;
|
|
7988
8439
|
};
|
|
7989
8440
|
|
|
7990
8441
|
/* Excluded from this release type: IApplyPrototypeExtension */
|
|
@@ -8058,6 +8509,12 @@ export declare interface ICollider extends IComponent {
|
|
|
8058
8509
|
* Default: undefined
|
|
8059
8510
|
*/
|
|
8060
8511
|
filter?: number[];
|
|
8512
|
+
/** The density of the collider used for automatic mass calculation.
|
|
8513
|
+
* When the attached Rigidbody has `autoMass` enabled, the mass is computed as `density × volume`.
|
|
8514
|
+
* Note: Make sure to call updateProperties after having changed this property
|
|
8515
|
+
* Default: undefined (uses physics engine default of 1.0)
|
|
8516
|
+
*/
|
|
8517
|
+
density?: number;
|
|
8061
8518
|
}
|
|
8062
8519
|
|
|
8063
8520
|
export declare type ICollisionContext = {
|
|
@@ -8084,7 +8541,6 @@ export declare interface IComponent extends IHasGuid {
|
|
|
8084
8541
|
/* Excluded from this release type: __internalEnable */
|
|
8085
8542
|
/* Excluded from this release type: __internalDisable */
|
|
8086
8543
|
/* Excluded from this release type: __internalDestroy */
|
|
8087
|
-
/* Excluded from this release type: resolveGuids */
|
|
8088
8544
|
/** experimental, called when the script is registered for the first time, this is called even if the component is not enabled. */
|
|
8089
8545
|
registering?(): any;
|
|
8090
8546
|
awake(): any;
|
|
@@ -8121,6 +8577,24 @@ export declare interface IConnectionData {
|
|
|
8121
8577
|
|
|
8122
8578
|
export declare type IContext = Context;
|
|
8123
8579
|
|
|
8580
|
+
/**
|
|
8581
|
+
* Interface for objects that hold resources and can be disposed.
|
|
8582
|
+
* Implement this interface on any object that needs deterministic cleanup.
|
|
8583
|
+
*
|
|
8584
|
+
* @example
|
|
8585
|
+
* ```ts
|
|
8586
|
+
* class MyResource implements IDisposable {
|
|
8587
|
+
* dispose() { /* release resources *\/ }
|
|
8588
|
+
* }
|
|
8589
|
+
* ```
|
|
8590
|
+
*
|
|
8591
|
+
* @category Utilities
|
|
8592
|
+
* @group Lifecycle
|
|
8593
|
+
*/
|
|
8594
|
+
export declare interface IDisposable {
|
|
8595
|
+
dispose(): void;
|
|
8596
|
+
}
|
|
8597
|
+
|
|
8124
8598
|
/** Implement to receive callbacks from {@type @needle-tools/editor-sync} package */
|
|
8125
8599
|
declare interface IEditorModification {
|
|
8126
8600
|
/**
|
|
@@ -8140,7 +8614,6 @@ export declare interface IEffectProvider {
|
|
|
8140
8614
|
|
|
8141
8615
|
export declare interface IEventList {
|
|
8142
8616
|
readonly isEventList: true;
|
|
8143
|
-
__internalOnInstantiate(map: InstantiateContext): IEventList;
|
|
8144
8617
|
}
|
|
8145
8618
|
|
|
8146
8619
|
export declare interface IGameObject extends Object3D {
|
|
@@ -8241,6 +8714,8 @@ declare interface ILayoutGroup extends IComponent {
|
|
|
8241
8714
|
export declare interface ILight extends IComponent {
|
|
8242
8715
|
intensity: number;
|
|
8243
8716
|
color: Color;
|
|
8717
|
+
/** The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"` */
|
|
8718
|
+
readonly type: "directional" | "point" | "spot";
|
|
8244
8719
|
}
|
|
8245
8720
|
|
|
8246
8721
|
declare interface ILightDataRegistry {
|
|
@@ -8431,13 +8906,45 @@ export declare interface INeedleXRSessionEventReceiver extends Pick<IComponent,
|
|
|
8431
8906
|
export declare interface INetworkConnection {
|
|
8432
8907
|
get isConnected(): boolean;
|
|
8433
8908
|
get isInRoom(): boolean;
|
|
8434
|
-
send(key: string, data
|
|
8909
|
+
send(key: string, data?: IModel | object | boolean | string | number, queue?: SendQueue): unknown;
|
|
8435
8910
|
}
|
|
8436
8911
|
|
|
8437
8912
|
export declare interface INetworkingWebsocketUrlProvider {
|
|
8438
8913
|
getWebsocketUrl(): string | null;
|
|
8439
8914
|
}
|
|
8440
8915
|
|
|
8916
|
+
/**
|
|
8917
|
+
* @experimental
|
|
8918
|
+
* Interface for a network transport layer used by {@link NetworkConnection}.
|
|
8919
|
+
* The default implementation wraps a websocket via `websocket-ts`.
|
|
8920
|
+
* Custom implementations can be injected into {@link NetworkConnection.connect}
|
|
8921
|
+
* for testing or alternative transports.
|
|
8922
|
+
*
|
|
8923
|
+
* **Lifecycle:** After creating a transport and passing it to `connect()`,
|
|
8924
|
+
* `NetworkConnection` sets the four event callbacks (`onOpen`, `onClose`,
|
|
8925
|
+
* `onError`, `onMessage`) and then calls {@link start}. The transport
|
|
8926
|
+
* should call `onOpen` when the connection is ready.
|
|
8927
|
+
*/
|
|
8928
|
+
export declare interface INetworkTransport {
|
|
8929
|
+
/** Start the connection. Called by NetworkConnection after event callbacks are set.
|
|
8930
|
+
* May return a promise if setup is async (e.g. dynamic imports). */
|
|
8931
|
+
start(): void | Promise<void>;
|
|
8932
|
+
/** Send data (string for JSON messages, Uint8Array for binary) */
|
|
8933
|
+
send(data: string | Uint8Array): void;
|
|
8934
|
+
/** Close the transport */
|
|
8935
|
+
close(): void | Promise<void>;
|
|
8936
|
+
/** The URL this transport is connected to, if applicable */
|
|
8937
|
+
readonly url: string | undefined;
|
|
8938
|
+
/** Called when the transport connection opens */
|
|
8939
|
+
onOpen: (() => void) | null;
|
|
8940
|
+
/** Called when the transport connection closes */
|
|
8941
|
+
onClose: (() => void) | null;
|
|
8942
|
+
/** Called when an error occurs */
|
|
8943
|
+
onError: ((err: any) => void) | null;
|
|
8944
|
+
/** Called when a message is received. Data is either a string (JSON) or Blob (binary). */
|
|
8945
|
+
onMessage: ((data: string | Blob) => void) | null;
|
|
8946
|
+
}
|
|
8947
|
+
|
|
8441
8948
|
export declare class InheritVelocityModule {
|
|
8442
8949
|
enabled: boolean;
|
|
8443
8950
|
curve: MinMaxCurve;
|
|
@@ -8457,10 +8964,20 @@ export declare class InheritVelocityModule {
|
|
|
8457
8964
|
applyCurrent(vel: Vector3 | Vector3_2, t01: number, lerpFactor: number): void;
|
|
8458
8965
|
}
|
|
8459
8966
|
|
|
8967
|
+
/* Excluded from this release type: initAddressableSerializers */
|
|
8968
|
+
|
|
8969
|
+
/** Register all builtin serializers and prototype patches.
|
|
8970
|
+
* Must be called from {@link initEngine} so the registrations survive tree-shaking
|
|
8971
|
+
* when the package declares `sideEffects: false`.
|
|
8972
|
+
*/
|
|
8973
|
+
export declare function initBuiltinSerializers(): void;
|
|
8974
|
+
|
|
8460
8975
|
/** Register the Rapier physics backend. Called from {@link initEngine}
|
|
8461
8976
|
* to ensure it runs regardless of tree-shaking. */
|
|
8462
8977
|
export declare function initPhysics(): void;
|
|
8463
8978
|
|
|
8979
|
+
/* Excluded from this release type: initVolumeParameterSerializer */
|
|
8980
|
+
|
|
8464
8981
|
/**
|
|
8465
8982
|
* Handles all input events including mouse, touch, keyboard, and XR controllers.
|
|
8466
8983
|
* Access via `this.context.input` from any component.
|
|
@@ -8514,14 +9031,33 @@ export declare class Input implements IInput {
|
|
|
8514
9031
|
*/
|
|
8515
9032
|
private readonly _eventListeners;
|
|
8516
9033
|
/** Adds an event listener for the specified event type. The callback will be called when the event is triggered.
|
|
9034
|
+
*
|
|
9035
|
+
* Returns an unsubscribe function — call it to remove the listener.
|
|
9036
|
+
* Pass it to {@link Behaviour.autoCleanup} for automatic lifecycle management.
|
|
9037
|
+
*
|
|
8517
9038
|
* @param type The event type to listen for
|
|
8518
9039
|
* @param callback The callback to call when the event is triggered
|
|
8519
9040
|
* @param options The options for adding the event listener.
|
|
8520
|
-
* @
|
|
9041
|
+
* @returns A function that removes the event listener when called.
|
|
9042
|
+
*
|
|
9043
|
+
* @example With autoCleanup (recommended)
|
|
8521
9044
|
* ```ts
|
|
8522
|
-
*
|
|
9045
|
+
* export class MyComponent extends Behaviour {
|
|
9046
|
+
* onEnable() {
|
|
9047
|
+
* this.autoCleanup(this.context.input.addEventListener("pointerdown", (evt) => {
|
|
9048
|
+
* console.log("Pointer down", evt.pointerId, evt.pointerType);
|
|
9049
|
+
* }));
|
|
9050
|
+
* }
|
|
9051
|
+
* // Listener is automatically removed on disable — no manual cleanup needed!
|
|
9052
|
+
* }
|
|
9053
|
+
* ```
|
|
9054
|
+
* @example Manual unsubscribe
|
|
9055
|
+
* ```ts
|
|
9056
|
+
* const off = input.addEventListener("pointerdown", (evt) => {
|
|
8523
9057
|
* console.log("Pointer down", evt.pointerId, evt.pointerType);
|
|
8524
9058
|
* });
|
|
9059
|
+
* // later
|
|
9060
|
+
* off();
|
|
8525
9061
|
* ```
|
|
8526
9062
|
* @example Adding a listener that is called after all other listeners
|
|
8527
9063
|
* By using a higher value for the queue the listener will be called after other listeners (default queue is 0).
|
|
@@ -8537,8 +9073,8 @@ export declare class Input implements IInput {
|
|
|
8537
9073
|
* }, { once: true });
|
|
8538
9074
|
* ```
|
|
8539
9075
|
*/
|
|
8540
|
-
addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2):
|
|
8541
|
-
addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2):
|
|
9076
|
+
addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2): () => void;
|
|
9077
|
+
addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2): () => void;
|
|
8542
9078
|
/** Removes the event listener from the specified event type. If no queue is specified the listener will be removed from all queues.
|
|
8543
9079
|
* @param type The event type to remove the listener from
|
|
8544
9080
|
* @param callback The callback to remove
|
|
@@ -8984,7 +9520,7 @@ export declare function instantiate(instance: AssetReference, opts?: IInstantiat
|
|
|
8984
9520
|
export declare function instantiate(instance: IGameObject | Object3D, opts?: IInstantiateOptions | null): IGameObject;
|
|
8985
9521
|
|
|
8986
9522
|
/**
|
|
8987
|
-
* Provides access to the instantiated object
|
|
9523
|
+
* Provides access to the instantiated object map (used by EventList etc.)
|
|
8988
9524
|
*/
|
|
8989
9525
|
export declare type InstantiateContext = Readonly<InstantiateReferenceMap>;
|
|
8990
9526
|
|
|
@@ -9024,7 +9560,8 @@ export declare class InstantiateOptions implements IInstantiateOptions {
|
|
|
9024
9560
|
cloneAssign(other: InstantiateOptions | IInstantiateOptions): void;
|
|
9025
9561
|
}
|
|
9026
9562
|
|
|
9027
|
-
|
|
9563
|
+
/** Maps uuid/guid → { original, clone } for Object3D and Component instances */
|
|
9564
|
+
export declare type InstantiateReferenceMap = Record<string, ObjectCloneReference>;
|
|
9028
9565
|
|
|
9029
9566
|
/**
|
|
9030
9567
|
* An empty component that can be used to mark an object as interactable.
|
|
@@ -9095,8 +9632,10 @@ export declare interface IPhysicsEngine {
|
|
|
9095
9632
|
postStep(): any;
|
|
9096
9633
|
/** Indicates whether the physics engine is currently updating */
|
|
9097
9634
|
get isUpdating(): boolean;
|
|
9098
|
-
/**
|
|
9099
|
-
|
|
9635
|
+
/** Tears down the physics world and frees all resources. The world will be re-created on next use. */
|
|
9636
|
+
dispose(): void;
|
|
9637
|
+
/** @deprecated Use {@link dispose} instead. */
|
|
9638
|
+
clearCaches(): void;
|
|
9100
9639
|
/** Enables or disables the physics engine */
|
|
9101
9640
|
enabled: boolean;
|
|
9102
9641
|
/** Returns the underlying physics world object */
|
|
@@ -9143,6 +9682,11 @@ export declare interface IPhysicsEngine {
|
|
|
9143
9682
|
* @returns False to ignore this collider, true to include it
|
|
9144
9683
|
*/
|
|
9145
9684
|
filterPredicate?: (collider: ICollider) => boolean;
|
|
9685
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
9686
|
+
* By default trigger colliders are skipped.
|
|
9687
|
+
* @default false
|
|
9688
|
+
*/
|
|
9689
|
+
includeTriggers?: boolean;
|
|
9146
9690
|
}): RaycastResult;
|
|
9147
9691
|
/**
|
|
9148
9692
|
* Performs a raycast that also returns the normal vector at the hit point
|
|
@@ -9170,6 +9714,11 @@ export declare interface IPhysicsEngine {
|
|
|
9170
9714
|
* @returns False to ignore this collider, true to include it
|
|
9171
9715
|
*/
|
|
9172
9716
|
filterPredicate?: (collider: ICollider) => boolean;
|
|
9717
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
9718
|
+
* By default trigger colliders are skipped.
|
|
9719
|
+
* @default false
|
|
9720
|
+
*/
|
|
9721
|
+
includeTriggers?: boolean;
|
|
9173
9722
|
}): RaycastResult;
|
|
9174
9723
|
/**
|
|
9175
9724
|
* Finds all colliders within a sphere
|
|
@@ -9326,8 +9875,9 @@ export declare interface IPhysicsEngine {
|
|
|
9326
9875
|
* @returns The underlying physics body or null if not found
|
|
9327
9876
|
*/
|
|
9328
9877
|
getBody(obj: ICollider | IRigidbody): null | any;
|
|
9329
|
-
addFixedJoint(body1: IRigidbody, body2: IRigidbody): any;
|
|
9330
|
-
addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): any;
|
|
9878
|
+
addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<any> | any;
|
|
9879
|
+
addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): Promise<any> | any;
|
|
9880
|
+
removeJoint(joint: any): void;
|
|
9331
9881
|
/** Enable to render collider shapes */
|
|
9332
9882
|
debugRenderColliders: boolean;
|
|
9333
9883
|
/** Enable to visualize raycasts in the scene with gizmos */
|
|
@@ -9548,6 +10098,18 @@ export declare function isDestroyed(go: Object3D): boolean;
|
|
|
9548
10098
|
/** True when the application runs on a local url */
|
|
9549
10099
|
export declare function isDevEnvironment(): boolean;
|
|
9550
10100
|
|
|
10101
|
+
/**
|
|
10102
|
+
* Type guard to check if an object implements {@link IDisposable}.
|
|
10103
|
+
*
|
|
10104
|
+
* @example
|
|
10105
|
+
* ```ts
|
|
10106
|
+
* if (isDisposable(obj)) {
|
|
10107
|
+
* obj.dispose(); // safe to call
|
|
10108
|
+
* }
|
|
10109
|
+
* ```
|
|
10110
|
+
*/
|
|
10111
|
+
export declare function isDisposable(value: unknown): value is IDisposable;
|
|
10112
|
+
|
|
9551
10113
|
export declare function isDisposed(obj: object): boolean;
|
|
9552
10114
|
|
|
9553
10115
|
export declare interface ISerializable {
|
|
@@ -9582,6 +10144,10 @@ export declare function isHotReloadEnabled(): boolean;
|
|
|
9582
10144
|
/**@returns true if the element is an needle engine icon element */
|
|
9583
10145
|
export declare function isIconElement(element: Node): boolean;
|
|
9584
10146
|
|
|
10147
|
+
export declare interface ISignalReceiver {
|
|
10148
|
+
readonly isSignalReceiver: true;
|
|
10149
|
+
}
|
|
10150
|
+
|
|
9585
10151
|
/** @deprecated use {@link DeviceUtilities.isiOS} instead */
|
|
9586
10152
|
export declare function isiOS(): boolean;
|
|
9587
10153
|
|
|
@@ -9616,6 +10182,8 @@ export declare function isResourceTrackingEnabled(): boolean;
|
|
|
9616
10182
|
/** @deprecated use {@link DeviceUtilities.isSafari} instead */
|
|
9617
10183
|
export declare function isSafari(): boolean;
|
|
9618
10184
|
|
|
10185
|
+
export declare function isTrackModel(obj: unknown): obj is TrackModel;
|
|
10186
|
+
|
|
9619
10187
|
export declare function isUsingInstancing(instance: Object3D): boolean;
|
|
9620
10188
|
|
|
9621
10189
|
export declare interface ITime {
|
|
@@ -9740,7 +10308,9 @@ declare abstract class Joint extends Component {
|
|
|
9740
10308
|
connectedBody?: Rigidbody;
|
|
9741
10309
|
get rigidBody(): Rigidbody | null;
|
|
9742
10310
|
private _rigidBody;
|
|
10311
|
+
private _jointHandle;
|
|
9743
10312
|
onEnable(): void;
|
|
10313
|
+
onDisable(): void;
|
|
9744
10314
|
private create;
|
|
9745
10315
|
protected abstract createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
9746
10316
|
}
|
|
@@ -9782,6 +10352,15 @@ declare class Keyframe_2 {
|
|
|
9782
10352
|
}
|
|
9783
10353
|
export { Keyframe_2 as Keyframe }
|
|
9784
10354
|
|
|
10355
|
+
/** Keyframe array or tween shorthand */
|
|
10356
|
+
declare type KF<V> = AnimationKeyframe<V>[] | Tween<V>;
|
|
10357
|
+
|
|
10358
|
+
/** Keyframe array or tween shorthand */
|
|
10359
|
+
declare type KF_2<V> = AnimationKeyframe<V>[] | Tween<V>;
|
|
10360
|
+
|
|
10361
|
+
/** Keyframe array or tween shorthand */
|
|
10362
|
+
declare type KF_3<V> = AnimationKeyframe<V>[] | Tween<V>;
|
|
10363
|
+
|
|
9785
10364
|
declare type LabelHandle = {
|
|
9786
10365
|
setText(str: string): any;
|
|
9787
10366
|
};
|
|
@@ -9878,10 +10457,13 @@ declare type LifecycleMethodOptions = {
|
|
|
9878
10457
|
*/
|
|
9879
10458
|
export declare class Light extends Component implements ILight {
|
|
9880
10459
|
/**
|
|
9881
|
-
* The type of light
|
|
9882
|
-
* Can not be changed at runtime.
|
|
10460
|
+
* The type of light as a lowercase string: `"directional"`, `"point"`, `"spot"`.
|
|
10461
|
+
* Implements {@link ILight.type}. Can not be changed at runtime.
|
|
9883
10462
|
*/
|
|
9884
|
-
|
|
10463
|
+
get type(): ILight["type"];
|
|
10464
|
+
/** Numeric LightType serialized from Unity/Blender — converts to string on write */
|
|
10465
|
+
set type(value: LightType | ILight["type"]);
|
|
10466
|
+
private _type;
|
|
9885
10467
|
/**
|
|
9886
10468
|
* The maximum distance the light affects.
|
|
9887
10469
|
* Only applicable for spot and point lights.
|
|
@@ -9987,11 +10569,6 @@ export declare class Light extends Component implements ILight {
|
|
|
9987
10569
|
* and applies all settings like shadows, intensity, and color.
|
|
9988
10570
|
*/
|
|
9989
10571
|
createLight(): void;
|
|
9990
|
-
/**
|
|
9991
|
-
* Coroutine that updates the main light reference in the context
|
|
9992
|
-
* if this directional light should be the main light
|
|
9993
|
-
*/
|
|
9994
|
-
updateMainLightRoutine(): Generator<undefined, void, unknown>;
|
|
9995
10572
|
/**
|
|
9996
10573
|
* Controls whether the renderer's shadow map type can be changed when soft shadows are used
|
|
9997
10574
|
*/
|
|
@@ -10040,6 +10617,25 @@ declare enum LightShadows {
|
|
|
10040
10617
|
Soft = 2
|
|
10041
10618
|
}
|
|
10042
10619
|
|
|
10620
|
+
/**
|
|
10621
|
+
* Defines the type of light in a scene.
|
|
10622
|
+
* @see {@link Light} for configuring light properties and behavior
|
|
10623
|
+
*/
|
|
10624
|
+
declare enum LightType {
|
|
10625
|
+
/** Spot light that emits light in a cone shape */
|
|
10626
|
+
Spot = 0,
|
|
10627
|
+
/** Directional light that emits parallel light rays in a specific direction */
|
|
10628
|
+
Directional = 1,
|
|
10629
|
+
/** Point light that emits light in all directions from a single point */
|
|
10630
|
+
Point = 2,
|
|
10631
|
+
/** Area light */
|
|
10632
|
+
Area = 3,
|
|
10633
|
+
/** Rectangle shaped area light that only affects baked lightmaps and light probes */
|
|
10634
|
+
Rectangle = 3,
|
|
10635
|
+
/** Disc shaped area light that only affects baked lightmaps and light probes */
|
|
10636
|
+
Disc = 4
|
|
10637
|
+
}
|
|
10638
|
+
|
|
10043
10639
|
export declare class LimitVelocityOverLifetimeModule {
|
|
10044
10640
|
enabled: boolean;
|
|
10045
10641
|
dampen: number;
|
|
@@ -10433,13 +11029,15 @@ export declare function markAsInstancedRendered(go: Object3D, instanced: boolean
|
|
|
10433
11029
|
time: number;
|
|
10434
11030
|
}
|
|
10435
11031
|
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
|
|
10440
|
-
|
|
10441
|
-
|
|
10442
|
-
|
|
11032
|
+
/**
|
|
11033
|
+
* Builder for marker tracks. Provides `.marker()` for adding markers.
|
|
11034
|
+
* @category Animation and Sequencing
|
|
11035
|
+
*/
|
|
11036
|
+
export declare interface MarkerTrackBuilder extends TimelineBuilderBase {
|
|
11037
|
+
/** Adds a marker referencing a signal asset by guid */
|
|
11038
|
+
marker(time: number, asset: string, options?: SignalMarkerOptions): MarkerTrackBuilder;
|
|
11039
|
+
/** Mutes this track so it is skipped during playback */
|
|
11040
|
+
muted(muted?: boolean): MarkerTrackBuilder;
|
|
10443
11041
|
}
|
|
10444
11042
|
|
|
10445
11043
|
export declare enum MarkerType {
|
|
@@ -10985,6 +11583,7 @@ export declare type Model = (GLTF | FBX | OBJ | CustomModel);
|
|
|
10985
11583
|
|
|
10986
11584
|
declare namespace Models {
|
|
10987
11585
|
export {
|
|
11586
|
+
isTrackModel,
|
|
10988
11587
|
TimelineAssetModel,
|
|
10989
11588
|
TrackType,
|
|
10990
11589
|
ClipExtrapolation,
|
|
@@ -11028,15 +11627,13 @@ export declare type MouseButtonName = "left" | "right" | "middle";
|
|
|
11028
11627
|
/* Excluded from this release type: nameofFactory */
|
|
11029
11628
|
|
|
11030
11629
|
/**
|
|
11031
|
-
*
|
|
11032
|
-
*
|
|
11033
|
-
* safe to import at module level, including in SSR environments
|
|
11034
|
-
* (returns a silent error proxy when no context is active).
|
|
11630
|
+
* Quick access to the current Needle Engine context from anywhere — no need to pass `ctx` around.
|
|
11631
|
+
* Use it in React/Svelte/Vue components, button handlers, or plain JavaScript.
|
|
11035
11632
|
*
|
|
11036
|
-
*
|
|
11037
|
-
*
|
|
11633
|
+
* Safe to import at module level, including in SSR environments.
|
|
11634
|
+
* For pages with multiple `<needle-engine>` elements, use `ctx` directly instead.
|
|
11038
11635
|
*
|
|
11039
|
-
*
|
|
11636
|
+
* @experimental This API may change in future releases.
|
|
11040
11637
|
*
|
|
11041
11638
|
* @example
|
|
11042
11639
|
* import { needle } from "@needle-tools/engine";
|
|
@@ -11194,11 +11791,17 @@ export declare interface NeedleEngineAttributes {
|
|
|
11194
11791
|
'hash': string;
|
|
11195
11792
|
/** Set to automatically add OrbitControls to the loaded scene. */
|
|
11196
11793
|
'camera-controls': string;
|
|
11197
|
-
/** Override the default
|
|
11794
|
+
/** Override the default Draco decoder/decompressor path. Can be a URL or a local path to a directory containing the Draco decoder files.
|
|
11795
|
+
* @default "https://www.gstatic.com/draco/versioned/decoders/1.5.7/"
|
|
11796
|
+
* @example <needle-engine dracoDecoderPath="./decoders/draco/"></needle-engine>
|
|
11797
|
+
*/
|
|
11198
11798
|
'dracoDecoderPath': string;
|
|
11199
|
-
/** Override the default
|
|
11799
|
+
/** Override the default Draco decoder type. */
|
|
11200
11800
|
'dracoDecoderType': 'wasm' | 'js';
|
|
11201
|
-
/** Override the default KTX2 transcoder/decoder path.
|
|
11801
|
+
/** Override the default KTX2 transcoder/decoder path. Can be a URL or a local path to a directory containing the KTX2 transcoder files.
|
|
11802
|
+
* @default "https://cdn.needle.tools/static/three/0.179.1/basis2/"
|
|
11803
|
+
* @example <needle-engine ktx2DecoderPath="./decoders/ktx2/"></needle-engine>
|
|
11804
|
+
*/
|
|
11202
11805
|
'ktx2DecoderPath': string;
|
|
11203
11806
|
/** Prevent context from being disposed when element is removed from DOM. */
|
|
11204
11807
|
'keep-alive': 'true' | 'false';
|
|
@@ -12152,8 +12755,7 @@ export declare class NeedleXRSession implements INeedleXRSession {
|
|
|
12152
12755
|
get referenceSpace(): XRSpace | null;
|
|
12153
12756
|
/** @returns the XRFrame `viewerpose` using the xr `referenceSpace` */
|
|
12154
12757
|
get viewerPose(): XRViewerPose | undefined;
|
|
12155
|
-
/** @returns `true` if any image is currently being tracked */
|
|
12156
|
-
/** returns true if images are currently being tracked */
|
|
12758
|
+
/** @returns `true` if any image is currently being tracked or emulated */
|
|
12157
12759
|
get isTrackingImages(): boolean;
|
|
12158
12760
|
/** The currently active XR rig */
|
|
12159
12761
|
get rig(): IXRRig | null;
|
|
@@ -12199,6 +12801,8 @@ export declare class NeedleXRSession implements INeedleXRSession {
|
|
|
12199
12801
|
private readonly _xr_update_scripts;
|
|
12200
12802
|
/** scripts that are in the scene but inactive (e.g. disabled parent gameObject) */
|
|
12201
12803
|
private readonly _inactive_scripts;
|
|
12804
|
+
/** tracks scripts that have received onEnterXR — prevents spurious onLeaveXR calls */
|
|
12805
|
+
private readonly _scripts_in_xr;
|
|
12202
12806
|
private readonly _controllerAdded;
|
|
12203
12807
|
private readonly _controllerRemoved;
|
|
12204
12808
|
private readonly _originalCameraWorldPosition?;
|
|
@@ -12586,7 +13190,7 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12586
13190
|
/** Use to leave a room that you are currently connected to (use `leaveRoom()` to disconnect from the currently active room but you can also specify a room name) */
|
|
12587
13191
|
leaveRoom(room?: string | null): boolean;
|
|
12588
13192
|
/** Send a message to the networking backend - it will be broadcasted to all connected users (except yourself) in the same room by default */
|
|
12589
|
-
send<K extends NetworkEventKey>(key: K, data?: (K extends keyof NetworkEventMap ? NetworkEventData<K> : WebsocketSendType)
|
|
13193
|
+
send<K extends NetworkEventKey>(key: K, data?: (K extends keyof NetworkEventMap ? NetworkEventData<K> : WebsocketSendType), queue?: SendQueue): void;
|
|
12590
13194
|
/**
|
|
12591
13195
|
* Deletes the network state for a specific object on the server.
|
|
12592
13196
|
* This removes the object's state from the room, preventing it from being sent to newly joining users.
|
|
@@ -12608,61 +13212,69 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12608
13212
|
private _defaultMessagesBufferArray;
|
|
12609
13213
|
sendBufferedMessagesNow(): void;
|
|
12610
13214
|
/** Use to start listening to networking events.
|
|
12611
|
-
*
|
|
13215
|
+
* Returns an unsubscribe function that removes the listener when called.
|
|
13216
|
+
* The returned function can also be passed to {@link stopListen} or {@link Component.autoCleanup} for automatic lifecycle management.
|
|
13217
|
+
*
|
|
13218
|
+
* @example With autoCleanup (recommended)
|
|
13219
|
+
* ```ts
|
|
13220
|
+
* export class MyComponent extends Behaviour {
|
|
13221
|
+
* onEnable() {
|
|
13222
|
+
* this.autoCleanup(this.context.connection.beginListen("joined-room", () => {
|
|
13223
|
+
* console.log("I joined a networked room");
|
|
13224
|
+
* }));
|
|
13225
|
+
* }
|
|
13226
|
+
* // Automatically unsubscribed on disable — no manual cleanup needed!
|
|
13227
|
+
* }
|
|
13228
|
+
* ```
|
|
12612
13229
|
*
|
|
12613
|
-
* @example
|
|
13230
|
+
* @example Manual unsubscribe
|
|
12614
13231
|
* ```ts
|
|
12615
|
-
*
|
|
12616
|
-
*
|
|
12617
|
-
*
|
|
12618
|
-
* });
|
|
13232
|
+
* const unsub = this.context.connection.beginListen("joined-room", () => { });
|
|
13233
|
+
* // Later:
|
|
13234
|
+
* unsub(); // removes the listener
|
|
12619
13235
|
* ```
|
|
12620
13236
|
*
|
|
12621
|
-
* @example
|
|
13237
|
+
* @example With stopListen (legacy pattern, still supported)
|
|
12622
13238
|
* ```ts
|
|
12623
|
-
* // Make sure to unsubscribe from events when the component is disabled
|
|
12624
13239
|
* export class MyComponent extends Behaviour {
|
|
12625
13240
|
* onEnable() {
|
|
12626
|
-
* this.connection.beginListen("joined-room", this.onJoinedRoom)
|
|
13241
|
+
* this.context.connection.beginListen("joined-room", this.onJoinedRoom);
|
|
12627
13242
|
* }
|
|
12628
13243
|
* onDisable() {
|
|
12629
|
-
* this.connection.stopListen("joined-room", this.onJoinedRoom)
|
|
13244
|
+
* this.context.connection.stopListen("joined-room", this.onJoinedRoom);
|
|
12630
13245
|
* }
|
|
12631
13246
|
* onJoinedRoom = () => {
|
|
12632
|
-
*
|
|
13247
|
+
* console.log("I joined a networked room");
|
|
12633
13248
|
* }
|
|
12634
13249
|
* }
|
|
12635
13250
|
* ```
|
|
12636
13251
|
* @link https://engine.needle.tools/docs/networking.html
|
|
12637
13252
|
*
|
|
12638
13253
|
*/
|
|
12639
|
-
beginListen<K extends NetworkEventKey>(key: K, callback: K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void):
|
|
13254
|
+
beginListen<K extends NetworkEventKey>(key: K, callback: K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void): DisposeFn;
|
|
12640
13255
|
/**@deprecated please use stopListen instead (2.65.2-pre) */
|
|
12641
13256
|
stopListening<K extends NetworkEventKey>(key: K, callback: (K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void) | null): void;
|
|
12642
|
-
/** Use to stop listening to networking events
|
|
13257
|
+
/** Use to stop listening to networking events.
|
|
13258
|
+
* Accepts either the original callback or the unsubscribe function returned by {@link beginListen}.
|
|
12643
13259
|
* To subscribe to events use the `{@link beginListen}` method.
|
|
12644
|
-
* See the example below for typical usage:
|
|
12645
13260
|
*
|
|
12646
|
-
*
|
|
13261
|
+
* @example
|
|
12647
13262
|
* ```ts
|
|
12648
|
-
* //
|
|
12649
|
-
*
|
|
12650
|
-
*
|
|
12651
|
-
* this.connection.beginListen("joined-room", this.onJoinedRoom)
|
|
12652
|
-
* }
|
|
12653
|
-
* onDisable() {
|
|
12654
|
-
* this.connection.stopListen("joined-room", this.onJoinedRoom)
|
|
12655
|
-
* }
|
|
12656
|
-
* onJoinedRoom = () => {
|
|
12657
|
-
* console.log("I joined a networked room")
|
|
12658
|
-
* }
|
|
12659
|
-
* }
|
|
13263
|
+
* // Both patterns work:
|
|
13264
|
+
* this.context.connection.stopListen("joined-room", this.onJoinedRoom); // original callback
|
|
13265
|
+
* this.context.connection.stopListen("joined-room", unsub); // unsubscribe fn from beginListen
|
|
12660
13266
|
* ```
|
|
12661
13267
|
*/
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
13268
|
+
private static _didLogStopListenHint;
|
|
13269
|
+
stopListen<K extends NetworkEventKey>(key: K, callback: (K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void) | Function | null): void;
|
|
13270
|
+
/** Use to start listening to networking binary events.
|
|
13271
|
+
* Returns an unsubscribe function that removes the listener when called.
|
|
13272
|
+
* The returned function can also be passed to {@link stopListenBinary} or {@link Component.autoCleanup}.
|
|
13273
|
+
*/
|
|
13274
|
+
beginListenBinary(identifier: string, callback: BinaryCallback): DisposeFn;
|
|
13275
|
+
/** Use to stop listening to networking binary events.
|
|
13276
|
+
* Accepts either the original callback or the unsubscribe function returned by {@link beginListenBinary}.
|
|
13277
|
+
*/
|
|
12666
13278
|
stopListenBinary(identifier: string, callback: any): void;
|
|
12667
13279
|
private netWebSocketUrlProvider?;
|
|
12668
13280
|
/** Use to override the networking server backend url.
|
|
@@ -12671,16 +13283,19 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12671
13283
|
registerProvider(prov: INetworkingWebsocketUrlProvider): void;
|
|
12672
13284
|
/** Used to connect to the networking server
|
|
12673
13285
|
* @param url Optional url to connect to. If not provided, it will use the url from the registered `INetworkingWebsocketUrlProvider` or the default backend networking url. If you want to change the url after connecting, you need to disconnect first and then connect again with the new url.
|
|
13286
|
+
* @param transport Optional custom transport to use instead of the default websocket. Useful for testing or alternative transports.
|
|
12674
13287
|
*/
|
|
12675
|
-
connect(url?: string): Promise<boolean>;
|
|
13288
|
+
connect(url?: string, transport?: INetworkTransport): Promise<boolean>;
|
|
12676
13289
|
/** Disconnect from the networking backend + reset internal state */
|
|
12677
13290
|
disconnect(): void;
|
|
13291
|
+
/** Full teardown: disconnect, clear all listeners, and release all resources.
|
|
13292
|
+
* Called when the owning Context is destroyed. After dispose(), this instance should not be reused. */
|
|
13293
|
+
dispose(): void;
|
|
12678
13294
|
private _listeners;
|
|
12679
13295
|
private _listenersBinary;
|
|
12680
13296
|
private connected;
|
|
12681
|
-
private channelId;
|
|
12682
13297
|
private _connectionId;
|
|
12683
|
-
private
|
|
13298
|
+
private _transport;
|
|
12684
13299
|
private _waitingForSocket;
|
|
12685
13300
|
private _isInRoom;
|
|
12686
13301
|
private _currentRoomName;
|
|
@@ -12690,6 +13305,8 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12690
13305
|
private _state;
|
|
12691
13306
|
private _currentDelay;
|
|
12692
13307
|
private _connectingToWebsocketPromise;
|
|
13308
|
+
/** Wire up a transport's event callbacks and start it */
|
|
13309
|
+
private connectTransport;
|
|
12693
13310
|
private connectWebsocket;
|
|
12694
13311
|
private onMessage;
|
|
12695
13312
|
private handleIncomingBinaryMessage;
|
|
@@ -12818,7 +13435,7 @@ export declare interface NetworkEventMap {
|
|
|
12818
13435
|
* @see {@link RoomEvents} for room lifecycle events
|
|
12819
13436
|
* @see {@link isLocalNetwork} for local network detection
|
|
12820
13437
|
* @link https://engine.needle.tools/docs/how-to-guides/networking/
|
|
12821
|
-
* @summary
|
|
13438
|
+
* @summary Configures the websocket server URL for multiplayer networking
|
|
12822
13439
|
* @category Networking
|
|
12823
13440
|
* @group Components
|
|
12824
13441
|
*/
|
|
@@ -12955,7 +13572,7 @@ export declare type OBJ = {
|
|
|
12955
13572
|
scenes: Object3D[];
|
|
12956
13573
|
};
|
|
12957
13574
|
|
|
12958
|
-
declare type ObjectCloneReference = {
|
|
13575
|
+
export declare type ObjectCloneReference = {
|
|
12959
13576
|
readonly original: object;
|
|
12960
13577
|
readonly clone: object;
|
|
12961
13578
|
};
|
|
@@ -13039,7 +13656,7 @@ declare class ObjectSerializer extends TypeSerializer {
|
|
|
13039
13656
|
onDeserialize(data: ObjectData | string | null, context: SerializationContext): Object3D<Object3DEventMap> | Component | null | undefined;
|
|
13040
13657
|
}
|
|
13041
13658
|
|
|
13042
|
-
export declare
|
|
13659
|
+
export declare let objectSerializer: ObjectSerializer;
|
|
13043
13660
|
|
|
13044
13661
|
declare type ObjectToNodeMap = {
|
|
13045
13662
|
[uuid: string]: number;
|
|
@@ -13082,6 +13699,8 @@ export declare class ObjectUtils {
|
|
|
13082
13699
|
private static applyDefaultObjectOptions;
|
|
13083
13700
|
}
|
|
13084
13701
|
|
|
13702
|
+
/* Excluded from this release type: _OdZF */
|
|
13703
|
+
|
|
13085
13704
|
/**
|
|
13086
13705
|
* Remove a listener for before an XR session is requested
|
|
13087
13706
|
* @param fn The function to remove from the listeners
|
|
@@ -13162,6 +13781,61 @@ export declare function offXRSessionEnd(fn: (evt: XRSessionEventArgs) => void):
|
|
|
13162
13781
|
*/
|
|
13163
13782
|
export declare function offXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
|
|
13164
13783
|
|
|
13784
|
+
/**
|
|
13785
|
+
* @experimental
|
|
13786
|
+
* Subscribe to a DOM event on any {@link EventTarget} (window, document, HTML elements, etc.)
|
|
13787
|
+
* and return an {@link IDisposable} that removes the listener when disposed.
|
|
13788
|
+
*
|
|
13789
|
+
* Provides full TypeScript event type inference — the callback parameter
|
|
13790
|
+
* is automatically typed based on the event name (e.g. `"resize"` → `UIEvent`,
|
|
13791
|
+
* `"click"` → `MouseEvent`).
|
|
13792
|
+
*
|
|
13793
|
+
* Use with {@link DisposableStore.add} for automatic lifecycle cleanup in components.
|
|
13794
|
+
*
|
|
13795
|
+
* @param target The EventTarget to listen on (window, document, an element, etc.)
|
|
13796
|
+
* @param type The event name (e.g. `"resize"`, `"click"`, `"keydown"`)
|
|
13797
|
+
* @param listener The event handler callback
|
|
13798
|
+
* @param options Optional addEventListener options (passive, capture, once, signal)
|
|
13799
|
+
* @returns An {@link IDisposable} that removes the event listener when disposed
|
|
13800
|
+
*
|
|
13801
|
+
* @example Standalone usage
|
|
13802
|
+
* ```ts
|
|
13803
|
+
* import { on } from "@needle-tools/engine";
|
|
13804
|
+
*
|
|
13805
|
+
* const sub = on(window, "resize", (ev) => {
|
|
13806
|
+
* // ev is typed as UIEvent
|
|
13807
|
+
* console.log("resized", ev.target);
|
|
13808
|
+
* });
|
|
13809
|
+
*
|
|
13810
|
+
* // Later: clean up
|
|
13811
|
+
* sub.dispose();
|
|
13812
|
+
* ```
|
|
13813
|
+
*
|
|
13814
|
+
* @example With autoCleanup in a component
|
|
13815
|
+
* ```ts
|
|
13816
|
+
* import { Behaviour, on } from "@needle-tools/engine";
|
|
13817
|
+
*
|
|
13818
|
+
* export class MyComponent extends Behaviour {
|
|
13819
|
+
* onEnable() {
|
|
13820
|
+
* this.autoCleanup(on(window, "resize", (ev) => { /* UIEvent *\/ }));
|
|
13821
|
+
* this.autoCleanup(on(document, "keydown", (ev) => { /* KeyboardEvent *\/ }));
|
|
13822
|
+
* this.autoCleanup(on(this.context.domElement, "click", (ev) => { /* MouseEvent *\/ }));
|
|
13823
|
+
* }
|
|
13824
|
+
* // All listeners removed automatically on disable!
|
|
13825
|
+
* }
|
|
13826
|
+
* ```
|
|
13827
|
+
*
|
|
13828
|
+
* @category Utilities
|
|
13829
|
+
* @group Lifecycle
|
|
13830
|
+
*/
|
|
13831
|
+
export declare function on<K extends keyof WindowEventMap>(target: Window, type: K, listener: (ev: WindowEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13832
|
+
|
|
13833
|
+
export declare function on<K extends keyof DocumentEventMap>(target: Document, type: K, listener: (ev: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13834
|
+
|
|
13835
|
+
export declare function on<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, listener: (ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13836
|
+
|
|
13837
|
+
export declare function on(target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13838
|
+
|
|
13165
13839
|
/**
|
|
13166
13840
|
* Register a callback in the engine onAfterRender event
|
|
13167
13841
|
* This is called every frame after the main camera has rendered
|
|
@@ -13796,14 +14470,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
13796
14470
|
*/
|
|
13797
14471
|
private setLookTargetFromConstraint;
|
|
13798
14472
|
private lerpLookTarget;
|
|
14473
|
+
private canFocusAtPointer;
|
|
13799
14474
|
private setTargetFromRaycast;
|
|
13800
14475
|
/**
|
|
13801
14476
|
* Fits the camera to show the objects provided (defaults to the scene if no objects are passed in)
|
|
13802
14477
|
* @param options The options for fitting the camera. Use to provide objects to fit to, fit direction and size and other settings.
|
|
13803
14478
|
*/
|
|
13804
14479
|
fitCamera(options?: OrbitFitCameraOptions): any;
|
|
13805
|
-
/** @deprecated Use fitCamera(options) */
|
|
13806
|
-
fitCamera(objects?: Object3D | Array<Object3D>, options?: Omit<OrbitFitCameraOptions, "objects">): any;
|
|
13807
14480
|
private _haveAttachedKeyboardEvents;
|
|
13808
14481
|
}
|
|
13809
14482
|
|
|
@@ -14004,6 +14677,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14004
14677
|
value: number | boolean | string;
|
|
14005
14678
|
};
|
|
14006
14679
|
|
|
14680
|
+
/** Extracts parameter names of a given type from the builder's tracked parameter map */
|
|
14681
|
+
declare type ParamNamesOfType<TParams, PType extends string> = {
|
|
14682
|
+
[K in keyof TParams & string]: TParams[K] extends PType ? K : never;
|
|
14683
|
+
}[keyof TParams & string];
|
|
14684
|
+
|
|
14007
14685
|
declare type ParseNumber<T> = T extends `${infer U extends number}` ? U : never;
|
|
14008
14686
|
|
|
14009
14687
|
/** Load a gltf file from a url. This is the core method used by Needle Engine to load gltf files. All known extensions are registered here.
|
|
@@ -14635,13 +15313,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14635
15313
|
* The timeline asset containing tracks, clips, and markers that this director will play.
|
|
14636
15314
|
* Assign a timeline asset exported from Unity or Blender to enable playback.
|
|
14637
15315
|
*/
|
|
14638
|
-
playableAsset
|
|
15316
|
+
get playableAsset(): Models.TimelineAssetModel | undefined;
|
|
15317
|
+
set playableAsset(value: Models.TimelineAssetModel | undefined);
|
|
15318
|
+
private _playableAsset?;
|
|
14639
15319
|
/**
|
|
14640
15320
|
* When true, the timeline starts playing automatically when the component awakens.
|
|
14641
15321
|
* Set to false to control playback manually via `play()`.
|
|
14642
15322
|
* @default false
|
|
14643
15323
|
*/
|
|
14644
|
-
playOnAwake
|
|
15324
|
+
playOnAwake: boolean;
|
|
14645
15325
|
/**
|
|
14646
15326
|
* Determines how the timeline behaves when it reaches the end of its duration.
|
|
14647
15327
|
* @default DirectorWrapMode.Loop
|
|
@@ -14719,15 +15399,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14719
15399
|
/** Iterates over all tracks of the timeline
|
|
14720
15400
|
* @returns all tracks of the timeline
|
|
14721
15401
|
*/
|
|
14722
|
-
forEachTrack(): Generator<Tracks.
|
|
15402
|
+
forEachTrack(): Generator<Tracks.TimelineTrackHandler, void, unknown>;
|
|
14723
15403
|
/**
|
|
14724
15404
|
* @returns all animation tracks of the timeline
|
|
14725
15405
|
*/
|
|
14726
|
-
get animationTracks(): Tracks.
|
|
15406
|
+
get animationTracks(): Tracks.TimelineAnimationTrack[];
|
|
14727
15407
|
/**
|
|
14728
15408
|
* @returns all audio tracks of the timeline
|
|
14729
15409
|
*/
|
|
14730
|
-
get audioTracks(): Tracks.
|
|
15410
|
+
get audioTracks(): Tracks.TimelineAudioTrack[];
|
|
14731
15411
|
/**
|
|
14732
15412
|
* @returns all signal tracks of the timeline
|
|
14733
15413
|
*/
|
|
@@ -14735,7 +15415,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14735
15415
|
/**
|
|
14736
15416
|
* @returns all marker tracks of the timeline
|
|
14737
15417
|
*/
|
|
14738
|
-
get markerTracks(): Tracks.
|
|
15418
|
+
get markerTracks(): Tracks.TimelineMarkerTrack[];
|
|
15419
|
+
/**
|
|
15420
|
+
* @returns all activation tracks of the timeline
|
|
15421
|
+
*/
|
|
15422
|
+
get activationTracks(): Tracks.TimelineActivationTrack[];
|
|
15423
|
+
/**
|
|
15424
|
+
* @returns all tracks of the timeline
|
|
15425
|
+
*/
|
|
15426
|
+
get tracks(): ReadonlyArray<Tracks.TimelineTrackHandler>;
|
|
14739
15427
|
/**
|
|
14740
15428
|
* Iterates over all markers of the timeline, optionally filtering by type
|
|
14741
15429
|
*
|
|
@@ -14749,13 +15437,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14749
15437
|
*
|
|
14750
15438
|
*/
|
|
14751
15439
|
foreachMarker<T extends Record<string, any>>(type?: string | null): Generator<(T & Models.MarkerModel)>;
|
|
14752
|
-
private
|
|
14753
|
-
/* Excluded from this release type: resolveGuids */
|
|
15440
|
+
private _needsGraphRebuild;
|
|
14754
15441
|
private _isPlaying;
|
|
14755
15442
|
private _internalUpdateRoutine;
|
|
14756
15443
|
private _isPaused;
|
|
14757
15444
|
/** internal, true during the time stop() is being processed */
|
|
14758
15445
|
private _isStopping;
|
|
15446
|
+
/* Excluded from this release type: _isUserEvaluation */
|
|
14759
15447
|
private _time;
|
|
14760
15448
|
private _duration;
|
|
14761
15449
|
private _weight;
|
|
@@ -14764,6 +15452,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14764
15452
|
private readonly _signalTracks;
|
|
14765
15453
|
private readonly _markerTracks;
|
|
14766
15454
|
private readonly _controlTracks;
|
|
15455
|
+
private readonly _activationTracks;
|
|
14767
15456
|
private readonly _customTracks;
|
|
14768
15457
|
private readonly _tracksArray;
|
|
14769
15458
|
private get _allTracks();
|
|
@@ -15755,6 +16444,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15755
16444
|
w: number;
|
|
15756
16445
|
};
|
|
15757
16446
|
|
|
16447
|
+
/** A Quaternion value, either as a Three.js Quaternion or as a `[x, y, z, w]` tuple */
|
|
16448
|
+
declare type QuatValue = Quaternion | [number, number, number, number];
|
|
16449
|
+
|
|
15758
16450
|
/** Generates a random number
|
|
15759
16451
|
* @deprecated use Mathf.random(min, max)
|
|
15760
16452
|
*/
|
|
@@ -15880,6 +16572,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15880
16572
|
* @default undefined
|
|
15881
16573
|
*/
|
|
15882
16574
|
useIgnoreRaycastLayer?: boolean;
|
|
16575
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
16576
|
+
* By default trigger colliders are skipped.
|
|
16577
|
+
* @default false
|
|
16578
|
+
*/
|
|
16579
|
+
includeTriggers?: boolean;
|
|
15883
16580
|
}): null | {
|
|
15884
16581
|
point: Vector3;
|
|
15885
16582
|
collider: ICollider;
|
|
@@ -15897,6 +16594,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15897
16594
|
* @default undefined
|
|
15898
16595
|
*/
|
|
15899
16596
|
useIgnoreRaycastLayer?: boolean;
|
|
16597
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
16598
|
+
* By default trigger colliders are skipped.
|
|
16599
|
+
* @default false
|
|
16600
|
+
*/
|
|
16601
|
+
includeTriggers?: boolean;
|
|
15900
16602
|
}): null | {
|
|
15901
16603
|
point: Vector3;
|
|
15902
16604
|
normal: Vector3;
|
|
@@ -15942,6 +16644,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15942
16644
|
private _gravity;
|
|
15943
16645
|
get gravity(): Vec3;
|
|
15944
16646
|
set gravity(value: Vec3);
|
|
16647
|
+
/** Tears down the physics world and frees all WASM resources.
|
|
16648
|
+
* After calling this, the world will be re-created on next use. */
|
|
16649
|
+
dispose(): void;
|
|
16650
|
+
/** @deprecated Use {@link dispose} instead. */
|
|
15945
16651
|
clearCaches(): void;
|
|
15946
16652
|
addBoxCollider(collider: ICollider, size: Vector3): Promise<void>;
|
|
15947
16653
|
addSphereCollider(collider: ICollider): Promise<void>;
|
|
@@ -15988,7 +16694,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15988
16694
|
private getRigidbodyRelativeMatrix;
|
|
15989
16695
|
private static centerConnectionPos;
|
|
15990
16696
|
private static centerConnectionRot;
|
|
15991
|
-
|
|
16697
|
+
private _jointTempMatrix;
|
|
16698
|
+
addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<ImpulseJoint | null>;
|
|
15992
16699
|
/** The joint prevents any relative movement between two rigid-bodies, except for relative rotations along one axis. This is typically used to simulate wheels, fans, etc. They are characterized by one local anchor as well as one local axis on each rigid-body. */
|
|
15993
16700
|
addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: {
|
|
15994
16701
|
x: number;
|
|
@@ -15998,8 +16705,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15998
16705
|
x: number;
|
|
15999
16706
|
y: number;
|
|
16000
16707
|
z: number;
|
|
16001
|
-
}):
|
|
16708
|
+
}): Promise<ImpulseJoint | null>;
|
|
16709
|
+
removeJoint(joint: ImpulseJoint): void;
|
|
16710
|
+
/** Compute the relative transform from body1's local space to body2's local space (W2⁻¹ * W1), ignoring scale. */
|
|
16002
16711
|
private calculateJointRelativeMatrices;
|
|
16712
|
+
private normalizeMatrixColumns;
|
|
16003
16713
|
}
|
|
16004
16714
|
|
|
16005
16715
|
/**
|
|
@@ -16802,10 +17512,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16802
17512
|
*/
|
|
16803
17513
|
export declare class Rigidbody extends Component implements IRigidbody {
|
|
16804
17514
|
get isRigidbody(): boolean;
|
|
16805
|
-
/** When true the mass
|
|
17515
|
+
/** When true the mass is automatically computed from the attached colliders using `mass = density × volume`.
|
|
17516
|
+
* Each collider's {@link Collider.density} determines how heavy it contributes to the total mass.
|
|
17517
|
+
* Disable to set mass explicitly via the `mass` property.
|
|
17518
|
+
*/
|
|
16806
17519
|
autoMass: boolean;
|
|
16807
|
-
/**
|
|
16808
|
-
*
|
|
17520
|
+
/** The mass of the rigidbody in kg (when `autoMass` is disabled).
|
|
17521
|
+
* When `autoMass` is enabled, reading this returns the computed mass from `density × volume` of all attached colliders.
|
|
17522
|
+
* Setting this property automatically disables `autoMass`.
|
|
17523
|
+
*
|
|
17524
|
+
* **Prefer using {@link Collider.density}** with `autoMass` enabled instead — density scales
|
|
17525
|
+
* naturally with collider size, while explicit mass stays fixed regardless of shape changes.
|
|
16809
17526
|
*/
|
|
16810
17527
|
set mass(value: number);
|
|
16811
17528
|
get mass(): number;
|
|
@@ -16888,7 +17605,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16888
17605
|
onEnable(): void;
|
|
16889
17606
|
onDisable(): void;
|
|
16890
17607
|
onDestroy(): void;
|
|
16891
|
-
onValidate(): void;
|
|
17608
|
+
onValidate(property?: string): void;
|
|
17609
|
+
private static _didWarnAutoMass;
|
|
16892
17610
|
beforePhysics(): Generator<undefined, void, unknown>;
|
|
16893
17611
|
/** Teleport the rigidbody to a new position in the world.
|
|
16894
17612
|
* Will reset forces before setting the object world position
|
|
@@ -18108,10 +18826,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18108
18826
|
|
|
18109
18827
|
export declare function sendDestroyed(guid: string, con: INetworkConnection, opts?: SyncDestroyOptions): void;
|
|
18110
18828
|
|
|
18829
|
+
/** Controls when a network message is actually sent to the server.
|
|
18830
|
+
* @see {@link NetworkConnection.send}
|
|
18831
|
+
*/
|
|
18111
18832
|
export declare enum SendQueue {
|
|
18833
|
+
/** Hold the message until the transport connection opens, then send it. Use for messages that must arrive as soon as the socket is ready (e.g. join-room). */
|
|
18112
18834
|
OnConnection = 0,
|
|
18835
|
+
/** Hold the message until the client has joined a room, then send it. Use for messages that require room context. */
|
|
18113
18836
|
OnRoomJoin = 1,
|
|
18837
|
+
/** Buffer the message and send it on the next `sendBufferedMessagesNow()` call (typically once per frame). This is the default for `send()`. */
|
|
18114
18838
|
Queued = 2,
|
|
18839
|
+
/** Send the message to the server immediately without buffering. */
|
|
18115
18840
|
Immediate = 3
|
|
18116
18841
|
}
|
|
18117
18842
|
|
|
@@ -18544,6 +19269,16 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18544
19269
|
asset: string;
|
|
18545
19270
|
}
|
|
18546
19271
|
|
|
19272
|
+
/**
|
|
19273
|
+
* Options for a signal marker in the timeline builder
|
|
19274
|
+
*/
|
|
19275
|
+
export declare type SignalMarkerOptions = {
|
|
19276
|
+
/** Whether the signal should fire if the playback starts past its time (default: false) */
|
|
19277
|
+
retroActive?: boolean;
|
|
19278
|
+
/** Whether the signal should only fire once (default: false) */
|
|
19279
|
+
emitOnce?: boolean;
|
|
19280
|
+
};
|
|
19281
|
+
|
|
18547
19282
|
/** SignalReceiver is a component that listens for signals and invokes a reaction when a signal is received.
|
|
18548
19283
|
* Signals can be added to a signal track on a {@link PlayableDirector}
|
|
18549
19284
|
*
|
|
@@ -18551,7 +19286,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18551
19286
|
* @category Animation and Sequencing
|
|
18552
19287
|
* @group Components
|
|
18553
19288
|
*/
|
|
18554
|
-
export declare class SignalReceiver extends Component {
|
|
19289
|
+
export declare class SignalReceiver extends Component implements ISignalReceiver {
|
|
19290
|
+
readonly isSignalReceiver = true;
|
|
18555
19291
|
private static receivers;
|
|
18556
19292
|
static invoke(guid: string): void;
|
|
18557
19293
|
events?: SignalReceiverEvent[];
|
|
@@ -18570,10 +19306,26 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18570
19306
|
reaction: EventList<void>;
|
|
18571
19307
|
}
|
|
18572
19308
|
|
|
18573
|
-
|
|
19309
|
+
/**
|
|
19310
|
+
* Builder for signal tracks. Provides `.signal()` for callback-based signals and `.marker()` for asset-based markers.
|
|
19311
|
+
* @category Animation and Sequencing
|
|
19312
|
+
*/
|
|
19313
|
+
export declare interface SignalTrackBuilder extends TimelineBuilderBase {
|
|
19314
|
+
/** Adds a signal with a callback that fires at the given time */
|
|
19315
|
+
signal(time: number, callback: Function, options?: SignalMarkerOptions): SignalTrackBuilder;
|
|
19316
|
+
/** Adds a signal marker referencing a signal asset by guid */
|
|
19317
|
+
marker(time: number, asset: string, options?: SignalMarkerOptions): SignalTrackBuilder;
|
|
19318
|
+
/** Mutes this track so it is skipped during playback */
|
|
19319
|
+
muted(muted?: boolean): SignalTrackBuilder;
|
|
19320
|
+
}
|
|
19321
|
+
|
|
19322
|
+
export declare class SignalTrackHandler extends TimelineTrackHandler {
|
|
18574
19323
|
models: Models.SignalMarkerModel[];
|
|
18575
19324
|
didTrigger: boolean[];
|
|
18576
19325
|
receivers: Array<SignalReceiver | null>;
|
|
19326
|
+
private _lastTime;
|
|
19327
|
+
onEnable(): void;
|
|
19328
|
+
onMuteChanged(): void;
|
|
18577
19329
|
evaluate(time: number): void;
|
|
18578
19330
|
}
|
|
18579
19331
|
|
|
@@ -19073,10 +19825,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19073
19825
|
* Removes scale change monitoring when the collider is disabled.
|
|
19074
19826
|
*/
|
|
19075
19827
|
onDisable(): void;
|
|
19076
|
-
/**
|
|
19077
|
-
* Updates collider properties when validated in the editor or inspector.
|
|
19078
|
-
*/
|
|
19079
|
-
onValidate(): void;
|
|
19080
19828
|
}
|
|
19081
19829
|
|
|
19082
19830
|
export declare class SphereIntersection implements Intersection {
|
|
@@ -19829,8 +20577,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19829
20577
|
* Configuration for an animation state in the builder
|
|
19830
20578
|
*/
|
|
19831
20579
|
export declare type StateOptions = {
|
|
19832
|
-
/**
|
|
19833
|
-
|
|
20580
|
+
/**
|
|
20581
|
+
* The animation clip for this state. Accepts:
|
|
20582
|
+
* - A pre-built `AnimationClip`
|
|
20583
|
+
* - A single {@link TrackDescriptor} from {@link track}
|
|
20584
|
+
* - An array of {@link TrackDescriptor}s (multiple tracks combined into one clip)
|
|
20585
|
+
*
|
|
20586
|
+
* When omitted, use {@link AnimatorControllerBuilder.track .track()} to define animation tracks inline.
|
|
20587
|
+
*/
|
|
20588
|
+
clip?: AnimationClip | TrackDescriptor | TrackDescriptor[];
|
|
19834
20589
|
/** Whether the animation should loop (default: false) */
|
|
19835
20590
|
loop?: boolean;
|
|
19836
20591
|
/** Base speed multiplier (default: 1) */
|
|
@@ -20396,6 +21151,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20396
21151
|
set font(val: string | null);
|
|
20397
21152
|
get font(): string | null;
|
|
20398
21153
|
private _font;
|
|
21154
|
+
private _assignedAtRuntime;
|
|
20399
21155
|
/**
|
|
20400
21156
|
* Whether to support basic rich text tags in the `text` property. Supported tags include `<b>`, `<i>`, and `<color=hex>`. For example: `Hello <b>World</b>` or `Score: <color=#ff0000>100</color>`
|
|
20401
21157
|
* @default false
|
|
@@ -20651,6 +21407,57 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20651
21407
|
/* Excluded from this release type: update */
|
|
20652
21408
|
}
|
|
20653
21409
|
|
|
21410
|
+
/**
|
|
21411
|
+
* Handles activation (visibility) of bound objects for a timeline activation track.
|
|
21412
|
+
*
|
|
21413
|
+
* Each clip on the track defines a time range during which the bound objects should be active (visible).
|
|
21414
|
+
* @see TimelineTrackHandler for details on how tracks and clips work in general, and how to mutate them at runtime.
|
|
21415
|
+
* @see PlayableDirector for how to control timeline playback and time.
|
|
21416
|
+
* @see TimelineBuilder for how to create and configure timelines and tracks in the editor.
|
|
21417
|
+
*/
|
|
21418
|
+
export declare class TimelineActivationTrack extends TimelineTrackHandler {
|
|
21419
|
+
evaluate(time: number): void;
|
|
21420
|
+
}
|
|
21421
|
+
|
|
21422
|
+
export declare class TimelineAnimationTrack extends TimelineTrackHandler {
|
|
21423
|
+
/* Excluded from this release type: models */
|
|
21424
|
+
/* Excluded from this release type: trackOffset */
|
|
21425
|
+
/** The object that is being animated. */
|
|
21426
|
+
target?: Object3D;
|
|
21427
|
+
/** The AnimationMixer, should be shared with the animator if an animator is bound */
|
|
21428
|
+
mixer?: AnimationMixer;
|
|
21429
|
+
clips: Array<AnimationClip>;
|
|
21430
|
+
actions: Array<AnimationAction>;
|
|
21431
|
+
/**
|
|
21432
|
+
* You can use the weight to blend the timeline animation tracks with multiple animation tracks on the same object.
|
|
21433
|
+
* @default 1
|
|
21434
|
+
*/
|
|
21435
|
+
weight: number;
|
|
21436
|
+
/** holds data/info about clips differences */
|
|
21437
|
+
private _actionOffsets;
|
|
21438
|
+
private _didBind;
|
|
21439
|
+
private _animator;
|
|
21440
|
+
onDisable(): void;
|
|
21441
|
+
onDestroy(): void;
|
|
21442
|
+
onStateChanged(): void;
|
|
21443
|
+
createHooks(clipModel: Models.AnimationClipModel, clip: any): void;
|
|
21444
|
+
bind(): void;
|
|
21445
|
+
private ensureTrackOffsets;
|
|
21446
|
+
private _useclipOffsets;
|
|
21447
|
+
private _totalOffsetPosition;
|
|
21448
|
+
private _totalOffsetRotation;
|
|
21449
|
+
private _totalOffsetPosition2;
|
|
21450
|
+
private _totalOffsetRotation2;
|
|
21451
|
+
private _summedPos;
|
|
21452
|
+
private _tempPos;
|
|
21453
|
+
private _summedRot;
|
|
21454
|
+
private _tempRot;
|
|
21455
|
+
private _clipRotQuat;
|
|
21456
|
+
evaluate(time: number): void;
|
|
21457
|
+
private createRotationInterpolant;
|
|
21458
|
+
private createPositionInterpolant;
|
|
21459
|
+
}
|
|
21460
|
+
|
|
20654
21461
|
/**
|
|
20655
21462
|
* @category Animation and Sequencing
|
|
20656
21463
|
* @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
|
|
@@ -20660,6 +21467,325 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20660
21467
|
tracks: TrackModel[];
|
|
20661
21468
|
};
|
|
20662
21469
|
|
|
21470
|
+
/**
|
|
21471
|
+
* Handles audio playback for a timeline audio track.
|
|
21472
|
+
*
|
|
21473
|
+
* **Runtime mutation:** The track model is read fresh every frame during `evaluate()`.
|
|
21474
|
+
* You can mutate `track.volume`, `clip.start`, `clip.end`, `clip.asset.volume` etc.
|
|
21475
|
+
* at any time — changes take effect on the next frame without rebuilding the timeline.
|
|
21476
|
+
*
|
|
21477
|
+
* **Audio stopping:** Audio clips are automatically stopped when:
|
|
21478
|
+
* - Timeline time moves outside a clip's `[start, end]` range (e.g. jumping or normal playback advancing past a clip)
|
|
21479
|
+
* - The track is muted (via `muted = true`)
|
|
21480
|
+
* - The director is stopped (`director.stop()`)
|
|
21481
|
+
* - The director is paused (`director.pause()`)
|
|
21482
|
+
* - The director is disabled or destroyed
|
|
21483
|
+
*/
|
|
21484
|
+
export declare class TimelineAudioTrack extends TimelineTrackHandler {
|
|
21485
|
+
models: Array<AudioClipModel_2>;
|
|
21486
|
+
listener: AudioListener_3;
|
|
21487
|
+
audio: Array<Audio_2>;
|
|
21488
|
+
audioContextTimeOffset: Array<number>;
|
|
21489
|
+
lastTime: number;
|
|
21490
|
+
audioSource?: AudioSource;
|
|
21491
|
+
/** Track-level volume multiplier (0–1). Applied on top of per-clip volume each frame. */
|
|
21492
|
+
get volume(): number;
|
|
21493
|
+
set volume(val: number);
|
|
21494
|
+
private _audioLoader;
|
|
21495
|
+
private getAudioFilePath;
|
|
21496
|
+
onAllowAudioChanged(allow: boolean): void;
|
|
21497
|
+
addModel(model: Models.ClipModel): void;
|
|
21498
|
+
onDisable(): void;
|
|
21499
|
+
onDestroy(): void;
|
|
21500
|
+
onMuteChanged(): void;
|
|
21501
|
+
stop(): void;
|
|
21502
|
+
private _playableDirectorResumed;
|
|
21503
|
+
onPauseChanged(): void;
|
|
21504
|
+
evaluate(time: number): void;
|
|
21505
|
+
/** Call to load audio buffer for a specific time in the track. Can be used to preload the timeline audio */
|
|
21506
|
+
loadAudio(time: number, lookAhead?: number, lookBehind?: number): Promise<(AudioBuffer | null)[]> | null;
|
|
21507
|
+
private isInTimeRange;
|
|
21508
|
+
private static _audioBuffers;
|
|
21509
|
+
static dispose(): void;
|
|
21510
|
+
private handleAudioLoading;
|
|
21511
|
+
}
|
|
21512
|
+
|
|
21513
|
+
/**
|
|
21514
|
+
* A fluent builder for creating timeline assets ({@link TimelineAssetModel}) from code.
|
|
21515
|
+
*
|
|
21516
|
+
* Use {@link TimelineBuilder.create} to start building a timeline.
|
|
21517
|
+
*
|
|
21518
|
+
* @example Using build() for timelines without signal callbacks
|
|
21519
|
+
* ```ts
|
|
21520
|
+
* const timeline = TimelineBuilder.create("MySequence")
|
|
21521
|
+
* .animationTrack("Character", animator)
|
|
21522
|
+
* .clip(walkClip, { duration: 2, easeIn: 0.3 })
|
|
21523
|
+
* .clip(runClip, { duration: 3, easeIn: 0.5, easeOut: 0.5 })
|
|
21524
|
+
* .activationTrack("FX", particleObject)
|
|
21525
|
+
* .clip({ start: 1, duration: 2 })
|
|
21526
|
+
* .audioTrack("Music", audioSource)
|
|
21527
|
+
* .clip("music.mp3", { start: 0, duration: 5, volume: 0.8 })
|
|
21528
|
+
* .build();
|
|
21529
|
+
*
|
|
21530
|
+
* director.playableAsset = timeline;
|
|
21531
|
+
* director.play();
|
|
21532
|
+
* ```
|
|
21533
|
+
*
|
|
21534
|
+
* @example With inline tracks (no pre-built clips needed)
|
|
21535
|
+
* ```ts
|
|
21536
|
+
* TimelineBuilder.create("DoorSequence")
|
|
21537
|
+
* .animationTrack("Door", door)
|
|
21538
|
+
* .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
|
|
21539
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
21540
|
+
* .signalTrack("Events")
|
|
21541
|
+
* .signal(0.5, () => playSound("creak"))
|
|
21542
|
+
* .install(director);
|
|
21543
|
+
*
|
|
21544
|
+
* director.play();
|
|
21545
|
+
* ```
|
|
21546
|
+
*
|
|
21547
|
+
* @example Using install() with signal callbacks
|
|
21548
|
+
* ```ts
|
|
21549
|
+
* TimelineBuilder.create("WithSignals")
|
|
21550
|
+
* .animationTrack("Character", animator)
|
|
21551
|
+
* .clip(walkClip, { duration: 2 })
|
|
21552
|
+
* .signalTrack("Events")
|
|
21553
|
+
* .signal(1.0, () => console.log("1 second!"))
|
|
21554
|
+
* .signal(2.0, () => spawnParticles())
|
|
21555
|
+
* .install(director);
|
|
21556
|
+
*
|
|
21557
|
+
* director.play();
|
|
21558
|
+
* ```
|
|
21559
|
+
*
|
|
21560
|
+
* @category Animation and Sequencing
|
|
21561
|
+
* @group Utilities
|
|
21562
|
+
*/
|
|
21563
|
+
export declare class TimelineBuilder {
|
|
21564
|
+
private _name;
|
|
21565
|
+
private _tracks;
|
|
21566
|
+
private _currentTrack;
|
|
21567
|
+
private _pendingSignals;
|
|
21568
|
+
private _idProvider;
|
|
21569
|
+
private constructor();
|
|
21570
|
+
/**
|
|
21571
|
+
* Creates a new TimelineBuilder instance.
|
|
21572
|
+
* @param name - Name for the timeline asset
|
|
21573
|
+
* @param seed - Optional numeric seed for deterministic guid generation. Defaults to `Date.now()`.
|
|
21574
|
+
*/
|
|
21575
|
+
static create(name?: string, seed?: number): TimelineBuilderBase;
|
|
21576
|
+
/**
|
|
21577
|
+
* Adds an animation track. Chain `.clip()` calls to add pre-built clips,
|
|
21578
|
+
* or chain `.track()` calls to define animation data inline:
|
|
21579
|
+
*
|
|
21580
|
+
* @example With pre-built AnimationClip
|
|
21581
|
+
* ```ts
|
|
21582
|
+
* .animationTrack("Character", animator)
|
|
21583
|
+
* .clip(walkClip, { duration: 2, easeIn: 0.3 })
|
|
21584
|
+
* .clip(runClip, { duration: 3 })
|
|
21585
|
+
* ```
|
|
21586
|
+
*
|
|
21587
|
+
* @example With inline tracks
|
|
21588
|
+
* ```ts
|
|
21589
|
+
* .animationTrack("Door", door)
|
|
21590
|
+
* .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
|
|
21591
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
21592
|
+
* ```
|
|
21593
|
+
*
|
|
21594
|
+
* @param name - Display name for the track
|
|
21595
|
+
* @param binding - The Animator or Object3D to animate
|
|
21596
|
+
*/
|
|
21597
|
+
animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
|
|
21598
|
+
/**
|
|
21599
|
+
* Adds an audio track. Subsequent `.clip()` calls add audio clips to this track.
|
|
21600
|
+
* @param name - Display name for the track
|
|
21601
|
+
* @param binding - The AudioSource to play audio on (optional)
|
|
21602
|
+
* @param volume - Track volume multiplier (default: 1)
|
|
21603
|
+
*/
|
|
21604
|
+
audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
|
|
21605
|
+
/**
|
|
21606
|
+
* Adds an activation track. Subsequent `.clip()` calls define when the bound object is active.
|
|
21607
|
+
* @param name - Display name for the track
|
|
21608
|
+
* @param binding - The Object3D to show/hide
|
|
21609
|
+
*/
|
|
21610
|
+
activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
|
|
21611
|
+
/**
|
|
21612
|
+
* Adds a control track. Subsequent `.clip()` calls control nested timelines or objects.
|
|
21613
|
+
* @param name - Display name for the track
|
|
21614
|
+
*/
|
|
21615
|
+
controlTrack(name: string): ControlTrackBuilder;
|
|
21616
|
+
/**
|
|
21617
|
+
* Adds a signal track. Use `.signal()` or `.marker()` to add signal markers.
|
|
21618
|
+
* @param name - Display name for the track
|
|
21619
|
+
* @param binding - The SignalReceiver component (optional — if using `.signal()` with callbacks, one is created automatically by {@link install})
|
|
21620
|
+
*/
|
|
21621
|
+
signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
|
|
21622
|
+
/**
|
|
21623
|
+
* Adds a marker track. Use `.marker()` to add markers.
|
|
21624
|
+
* @param name - Display name for the track
|
|
21625
|
+
*/
|
|
21626
|
+
markerTrack(name: string): MarkerTrackBuilder;
|
|
21627
|
+
/**
|
|
21628
|
+
* Adds a clip to the current track. The clip type must match the track type.
|
|
21629
|
+
*
|
|
21630
|
+
* - On an **animation track**: pass an `AnimationClip`, a {@link TrackDescriptor}, or a `TrackDescriptor[]` — and optional {@link AnimationClipOptions}
|
|
21631
|
+
* - On an **audio track**: pass a clip URL (string) and {@link AudioClipOptions}
|
|
21632
|
+
* - On an **activation track**: pass {@link ActivationClipOptions}
|
|
21633
|
+
* - On a **control track**: pass an Object3D and {@link ControlClipOptions}
|
|
21634
|
+
*/
|
|
21635
|
+
clip(asset: AnimationClip, options?: AnimationClipOptions): this;
|
|
21636
|
+
clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): this;
|
|
21637
|
+
clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): this;
|
|
21638
|
+
clip(url: string, options: AudioClipOptions): this;
|
|
21639
|
+
clip(options: ActivationClipOptions): this;
|
|
21640
|
+
clip(sourceObject: Object3D, options: ControlClipOptions): this;
|
|
21641
|
+
/**
|
|
21642
|
+
* Adds a signal marker to the current signal or marker track.
|
|
21643
|
+
* @param time - Time in seconds when the signal fires
|
|
21644
|
+
* @param asset - The signal asset identifier (guid string)
|
|
21645
|
+
* @param options - Optional marker configuration
|
|
21646
|
+
*/
|
|
21647
|
+
marker(time: number, asset: string, options?: SignalMarkerOptions): this;
|
|
21648
|
+
/**
|
|
21649
|
+
* Adds a signal with a callback to the current signal track.
|
|
21650
|
+
* This is a convenience method that automatically generates a signal asset guid,
|
|
21651
|
+
* adds the marker, and registers the callback so that {@link install} can wire up
|
|
21652
|
+
* the `SignalReceiver` on the director's GameObject.
|
|
21653
|
+
*
|
|
21654
|
+
* @param time - Time in seconds when the signal fires
|
|
21655
|
+
* @param callback - The function to invoke when the signal fires
|
|
21656
|
+
* @param options - Optional marker configuration
|
|
21657
|
+
*
|
|
21658
|
+
* @example
|
|
21659
|
+
* ```ts
|
|
21660
|
+
* const timeline = TimelineBuilder.create("Sequence")
|
|
21661
|
+
* .signalTrack("Events")
|
|
21662
|
+
* .signal(1.0, () => console.log("1 second reached!"))
|
|
21663
|
+
* .signal(3.5, () => console.log("halfway!"), { emitOnce: true })
|
|
21664
|
+
* .install(director);
|
|
21665
|
+
* ```
|
|
21666
|
+
*/
|
|
21667
|
+
signal(time: number, callback: Function, options?: SignalMarkerOptions): this;
|
|
21668
|
+
/**
|
|
21669
|
+
* Mutes the current track so it is skipped during playback.
|
|
21670
|
+
*/
|
|
21671
|
+
muted(muted?: boolean): this;
|
|
21672
|
+
/** Adds an animation track descriptor for an Object3D's position or scale to the current animation track */
|
|
21673
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): this;
|
|
21674
|
+
/** Adds an animation track descriptor for an Object3D's quaternion to the current animation track */
|
|
21675
|
+
track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): this;
|
|
21676
|
+
/** Adds an animation track descriptor for an Object3D's rotation (Euler, converted to quaternion) to the current animation track */
|
|
21677
|
+
track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): this;
|
|
21678
|
+
/** Adds an animation track descriptor for an Object3D's visibility to the current animation track */
|
|
21679
|
+
track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): this;
|
|
21680
|
+
/** Adds an animation track descriptor for a material's numeric property to the current animation track */
|
|
21681
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): this;
|
|
21682
|
+
/** Adds an animation track descriptor for a material's color property to the current animation track */
|
|
21683
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
|
|
21684
|
+
/** Adds an animation track descriptor for a light's numeric property to the current animation track */
|
|
21685
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): this;
|
|
21686
|
+
/** Adds an animation track descriptor for a light's color to the current animation track */
|
|
21687
|
+
track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
|
|
21688
|
+
/** Adds an animation track descriptor for a camera's numeric property to the current animation track */
|
|
21689
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): this;
|
|
21690
|
+
/**
|
|
21691
|
+
* Builds and returns the {@link TimelineAssetModel}.
|
|
21692
|
+
* Assign the result to `PlayableDirector.playableAsset` to play it.
|
|
21693
|
+
*
|
|
21694
|
+
* If you used `.signal()` with callbacks, use {@link install} instead — it calls `build()`
|
|
21695
|
+
* internally and also wires up the SignalReceiver on the director's GameObject.
|
|
21696
|
+
*/
|
|
21697
|
+
build(): TimelineAssetModel;
|
|
21698
|
+
/**
|
|
21699
|
+
* Builds the timeline asset, assigns it to the director, and wires up any
|
|
21700
|
+
* `.signal()` callbacks by creating/configuring a {@link SignalReceiver} on the
|
|
21701
|
+
* director's GameObject.
|
|
21702
|
+
*
|
|
21703
|
+
* @param director - The PlayableDirector to install the timeline on
|
|
21704
|
+
* @returns The built TimelineAssetModel (also assigned to `director.playableAsset`)
|
|
21705
|
+
*
|
|
21706
|
+
* @example
|
|
21707
|
+
* ```ts
|
|
21708
|
+
* TimelineBuilder.create("MyTimeline")
|
|
21709
|
+
* .animationTrack("Anim", animator)
|
|
21710
|
+
* .clip(walkClip, { duration: 2 })
|
|
21711
|
+
* .signalTrack("Events")
|
|
21712
|
+
* .signal(1.0, () => console.log("signal fired!"))
|
|
21713
|
+
* .install(director);
|
|
21714
|
+
*
|
|
21715
|
+
* director.play();
|
|
21716
|
+
* ```
|
|
21717
|
+
*/
|
|
21718
|
+
install(director: PlayableDirector): TimelineAssetModel;
|
|
21719
|
+
private pushTrack;
|
|
21720
|
+
/** Commits any pending `.track()` descriptors on the current animation track into a clip */
|
|
21721
|
+
private commitInlineTracks;
|
|
21722
|
+
}
|
|
21723
|
+
|
|
21724
|
+
/**
|
|
21725
|
+
* Shared methods available on all track builders and the TimelineBuilder entry point.
|
|
21726
|
+
* Provides track creation, build, and install methods.
|
|
21727
|
+
*
|
|
21728
|
+
* @category Animation and Sequencing
|
|
21729
|
+
*/
|
|
21730
|
+
export declare interface TimelineBuilderBase {
|
|
21731
|
+
/** Adds an animation track. Chain `.clip()` or `.track()` to add content. */
|
|
21732
|
+
animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
|
|
21733
|
+
/** Adds an audio track. Chain `.clip()` to add audio clips. */
|
|
21734
|
+
audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
|
|
21735
|
+
/** Adds an activation track. Chain `.clip()` to define activation windows. */
|
|
21736
|
+
activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
|
|
21737
|
+
/** Adds a control track. Chain `.clip()` to control nested objects/timelines. */
|
|
21738
|
+
controlTrack(name: string): ControlTrackBuilder;
|
|
21739
|
+
/** Adds a signal track. Chain `.signal()` or `.marker()` to add events. */
|
|
21740
|
+
signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
|
|
21741
|
+
/** Adds a marker track. Chain `.marker()` to add markers. */
|
|
21742
|
+
markerTrack(name: string): MarkerTrackBuilder;
|
|
21743
|
+
/** Builds and returns the {@link TimelineAssetModel}. */
|
|
21744
|
+
build(): TimelineAssetModel;
|
|
21745
|
+
/** Builds the timeline, assigns it to the director, and wires up signal callbacks. */
|
|
21746
|
+
install(director: PlayableDirector): TimelineAssetModel;
|
|
21747
|
+
}
|
|
21748
|
+
|
|
21749
|
+
export declare class TimelineControlTrack extends TimelineTrackHandler {
|
|
21750
|
+
models: Array<Models.ClipModel>;
|
|
21751
|
+
timelines: Array<PlayableDirector | null>;
|
|
21752
|
+
resolveSourceObjects(_context: Context): void;
|
|
21753
|
+
private _previousActiveModel;
|
|
21754
|
+
evaluate(time: number): void;
|
|
21755
|
+
}
|
|
21756
|
+
|
|
21757
|
+
export declare class TimelineMarkerTrack extends TimelineTrackHandler {
|
|
21758
|
+
models: Array<Models.MarkerModel & Record<string, any>>;
|
|
21759
|
+
needsSorting: boolean;
|
|
21760
|
+
foreachMarker<T>(type?: string | null): Generator<T, void, unknown>;
|
|
21761
|
+
onEnable(): void;
|
|
21762
|
+
evaluate(_time: number): void;
|
|
21763
|
+
private sort;
|
|
21764
|
+
}
|
|
21765
|
+
|
|
21766
|
+
/**
|
|
21767
|
+
* A TrackHandler is responsible for evaluating a specific type of timeline track.
|
|
21768
|
+
* A timeline track can be an animation track, audio track, signal track, control track etc and is controlled by a {@link PlayableDirector}.
|
|
21769
|
+
*/
|
|
21770
|
+
export declare abstract class TimelineTrackHandler {
|
|
21771
|
+
director: PlayableDirector;
|
|
21772
|
+
track: Models.TrackModel;
|
|
21773
|
+
get muted(): boolean;
|
|
21774
|
+
set muted(val: boolean);
|
|
21775
|
+
forEachClip(backwards?: boolean): IterableIterator<Models.ClipModel>;
|
|
21776
|
+
onEnable?(): any;
|
|
21777
|
+
onDisable?(): any;
|
|
21778
|
+
onDestroy?(): any;
|
|
21779
|
+
abstract evaluate(time: number): any;
|
|
21780
|
+
onMuteChanged?(): any;
|
|
21781
|
+
onPauseChanged?(): any;
|
|
21782
|
+
/** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
|
|
21783
|
+
onStateChanged?(isPlaying: boolean): any;
|
|
21784
|
+
getClipTime(time: number, model: Models.ClipModel): number;
|
|
21785
|
+
getClipTimeNormalized(time: number, model: Models.ClipModel): number;
|
|
21786
|
+
evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
|
|
21787
|
+
}
|
|
21788
|
+
|
|
20663
21789
|
declare type TonemappingAttributeOptions = "none" | "linear" | "neutral" | "agx";
|
|
20664
21790
|
|
|
20665
21791
|
/**
|
|
@@ -20688,27 +21814,20 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20688
21814
|
export declare function toSourceId(src: string | null): SourceIdentifier | undefined;
|
|
20689
21815
|
|
|
20690
21816
|
/**
|
|
20691
|
-
*
|
|
20692
|
-
*
|
|
21817
|
+
* An opaque descriptor for a single animation track.
|
|
21818
|
+
* Created by {@link track} and resolved into a Three.js KeyframeTrack
|
|
21819
|
+
* when passed to {@link createAnimation}, or inline to
|
|
21820
|
+
* {@link AnimatorControllerBuilder.state} / {@link TimelineBuilder.clip}.
|
|
21821
|
+
*
|
|
21822
|
+
* @category Animation and Sequencing
|
|
20693
21823
|
*/
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
|
|
20700
|
-
|
|
20701
|
-
onDisable?(): any;
|
|
20702
|
-
onDestroy?(): any;
|
|
20703
|
-
abstract evaluate(time: number): any;
|
|
20704
|
-
onMuteChanged?(): any;
|
|
20705
|
-
onPauseChanged?(): any;
|
|
20706
|
-
/** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
|
|
20707
|
-
onStateChanged?(isPlaying: boolean): any;
|
|
20708
|
-
getClipTime(time: number, model: Models.ClipModel): number;
|
|
20709
|
-
getClipTimeNormalized(time: number, model: Models.ClipModel): number;
|
|
20710
|
-
evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
|
|
20711
|
-
}
|
|
21824
|
+
declare type TrackDescriptor = {
|
|
21825
|
+
readonly __isTrackDescriptor: true;
|
|
21826
|
+
/* Excluded from this release type: _target */
|
|
21827
|
+
/* Excluded from this release type: _property */
|
|
21828
|
+
/* Excluded from this release type: _keyframes */
|
|
21829
|
+
/* Excluded from this release type: _root */
|
|
21830
|
+
};
|
|
20712
21831
|
|
|
20713
21832
|
/**
|
|
20714
21833
|
* @category Animation and Sequencing
|
|
@@ -20734,14 +21853,26 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20734
21853
|
rotation: Quat | Quaternion;
|
|
20735
21854
|
};
|
|
20736
21855
|
|
|
21856
|
+
/** Options for a single track */
|
|
21857
|
+
declare type TrackOptions = {
|
|
21858
|
+
/**
|
|
21859
|
+
* Root object for resolving the track path.
|
|
21860
|
+
* - If `root === target` → self-targeting (`.property`)
|
|
21861
|
+
* - If `root !== target` → named targeting (`"targetName.property"` using `target.name`)
|
|
21862
|
+
* - If omitted → self-targeting by default
|
|
21863
|
+
*/
|
|
21864
|
+
root?: Object3D;
|
|
21865
|
+
};
|
|
21866
|
+
|
|
20737
21867
|
declare namespace Tracks {
|
|
20738
21868
|
export {
|
|
20739
|
-
|
|
20740
|
-
|
|
20741
|
-
|
|
20742
|
-
|
|
21869
|
+
TimelineTrackHandler,
|
|
21870
|
+
TimelineAnimationTrack,
|
|
21871
|
+
TimelineAudioTrack,
|
|
21872
|
+
TimelineMarkerTrack,
|
|
20743
21873
|
SignalTrackHandler,
|
|
20744
|
-
|
|
21874
|
+
TimelineActivationTrack,
|
|
21875
|
+
TimelineControlTrack
|
|
20745
21876
|
}
|
|
20746
21877
|
}
|
|
20747
21878
|
|
|
@@ -20947,10 +22078,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20947
22078
|
export declare type TransitionOptions = {
|
|
20948
22079
|
/** Duration of the crossfade in seconds (default: 0) */
|
|
20949
22080
|
duration?: number;
|
|
20950
|
-
/** Normalized exit time 0-1
|
|
22081
|
+
/** Normalized exit time 0-1. When set, the transition waits until the source animation reaches this point before transitioning. */
|
|
20951
22082
|
exitTime?: number;
|
|
20952
|
-
/** Whether the transition waits for exitTime before transitioning (default: false) */
|
|
20953
|
-
hasExitTime?: boolean;
|
|
20954
22083
|
/** Normalized offset into the destination state's animation (default: 0) */
|
|
20955
22084
|
offset?: number;
|
|
20956
22085
|
/** Whether duration is in seconds (true) or normalized (false) (default: false) */
|
|
@@ -21020,6 +22149,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21020
22149
|
|
|
21021
22150
|
export declare function tryGetGuid(obj: any): string | undefined | null;
|
|
21022
22151
|
|
|
22152
|
+
/** Shorthand for a simple two-keyframe animation (start → end) */
|
|
22153
|
+
export declare type Tween<V> = {
|
|
22154
|
+
/** Start value (at time 0) */
|
|
22155
|
+
from: V;
|
|
22156
|
+
/** End value (at time = duration) */
|
|
22157
|
+
to: V;
|
|
22158
|
+
/** Duration in seconds (default: 1) */
|
|
22159
|
+
duration?: number;
|
|
22160
|
+
/** Interpolation mode (default: `"linear"`) */
|
|
22161
|
+
interpolation?: AnimationInterpolation;
|
|
22162
|
+
};
|
|
22163
|
+
|
|
21023
22164
|
declare type Type = new (...args: any[]) => any;
|
|
21024
22165
|
|
|
21025
22166
|
declare type TypeResolver<T> = (data: any) => Constructor<T> | null;
|
|
@@ -21543,6 +22684,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21543
22684
|
z: number;
|
|
21544
22685
|
};
|
|
21545
22686
|
|
|
22687
|
+
/** A Vector3 value, either as a Three.js Vector3 or as a `[x, y, z]` tuple */
|
|
22688
|
+
declare type Vec3Value = Vector3 | [number, number, number];
|
|
22689
|
+
|
|
21546
22690
|
export declare type Vec4 = {
|
|
21547
22691
|
x: number;
|
|
21548
22692
|
y: number;
|
|
@@ -21763,8 +22907,14 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21763
22907
|
private _receivedInput;
|
|
21764
22908
|
/* Excluded from this release type: __constructor */
|
|
21765
22909
|
private _playErrors;
|
|
21766
|
-
/**
|
|
21767
|
-
|
|
22910
|
+
/**
|
|
22911
|
+
* Plays the assigned video clip, URL, or MediaStream.
|
|
22912
|
+
* If a `clip` argument is passed, it is used as the new video source (mirroring {@link AudioSource.play}).
|
|
22913
|
+
*
|
|
22914
|
+
* @param clip - Optional video URL string or {@link MediaStream} to play. If omitted, plays the currently assigned source.
|
|
22915
|
+
* @returns A promise that resolves to `true` when playback was successfully started, or `false` on error.
|
|
22916
|
+
*/
|
|
22917
|
+
play(clip?: string | MediaStream): Promise<boolean>;
|
|
21768
22918
|
/**
|
|
21769
22919
|
* Stop the video playback. This will reset the video to the beginning
|
|
21770
22920
|
*/
|
|
@@ -22034,9 +23184,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22034
23184
|
* voip.createMenuButton = true;
|
|
22035
23185
|
*
|
|
22036
23186
|
* // Manual control
|
|
22037
|
-
* voip.connect(); // Start sending
|
|
22038
|
-
* voip.disconnect(); // Stop sending
|
|
22039
|
-
* voip.setMuted(true); // Mute
|
|
23187
|
+
* voip.connect(); // Start sending your microphone
|
|
23188
|
+
* voip.disconnect(); // Stop sending your microphone
|
|
23189
|
+
* voip.setMuted(true); // Mute incoming audio (silence other users)
|
|
22040
23190
|
* ```
|
|
22041
23191
|
*
|
|
22042
23192
|
* @summary Voice over IP for networked audio communication
|
|
@@ -22095,8 +23245,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22095
23245
|
*/
|
|
22096
23246
|
get incomingStreams(): ReadonlyMap<string, HTMLAudioElement>;
|
|
22097
23247
|
/**
|
|
22098
|
-
*
|
|
22099
|
-
* they are considered "speaking". Default is
|
|
23248
|
+
* Normalized amplitude threshold for speaking detection (0–1). When a user's average
|
|
23249
|
+
* audio amplitude exceeds this, they are considered "speaking". Default is 0.1.
|
|
22100
23250
|
*/
|
|
22101
23251
|
speakingThreshold: number;
|
|
22102
23252
|
/**
|
|
@@ -22106,6 +23256,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22106
23256
|
onSpeakingChanged: EventList;
|
|
22107
23257
|
private _speakingStates;
|
|
22108
23258
|
private _analysers;
|
|
23259
|
+
private _sharedAudioContext?;
|
|
23260
|
+
private _lastSpeakingPollMs;
|
|
22109
23261
|
private _net?;
|
|
22110
23262
|
private _menubutton?;
|
|
22111
23263
|
/* Excluded from this release type: awake */
|
|
@@ -22115,21 +23267,27 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22115
23267
|
/** Set via the mic button (e.g. when the websocket connection closes and rejoins but the user was muted before we don't want to enable VOIP again automatically) */
|
|
22116
23268
|
private _allowSending;
|
|
22117
23269
|
private _outputStream;
|
|
23270
|
+
private _connectInFlight?;
|
|
22118
23271
|
/**
|
|
22119
23272
|
* @returns true if the component is currently sending audio
|
|
22120
23273
|
*/
|
|
22121
23274
|
get isSending(): boolean;
|
|
22122
23275
|
/** Start sending audio. */
|
|
22123
23276
|
connect(audioSource?: MediaTrackConstraints): Promise<boolean>;
|
|
23277
|
+
private _connectImpl;
|
|
22124
23278
|
/** Stop sending audio (muting your own microphone) */
|
|
22125
23279
|
disconnect(opts?: {
|
|
22126
23280
|
remember: boolean;
|
|
22127
23281
|
}): void;
|
|
22128
23282
|
/**
|
|
22129
|
-
* Mute or unmute the audio
|
|
23283
|
+
* Mute or unmute the audio you hear from other users (incoming streams).
|
|
23284
|
+
* This does NOT mute your own microphone — use {@link disconnect} to stop sending your microphone.
|
|
22130
23285
|
*/
|
|
22131
23286
|
setMuted(mute: boolean): void;
|
|
22132
|
-
/**
|
|
23287
|
+
/**
|
|
23288
|
+
* Returns true if incoming audio is currently muted (you can't hear other users).
|
|
23289
|
+
* When there are no incoming streams, returns false.
|
|
23290
|
+
*/
|
|
22133
23291
|
get isMuted(): boolean;
|
|
22134
23292
|
private updateButton;
|
|
22135
23293
|
/** @deprecated */
|
|
@@ -22141,6 +23299,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22141
23299
|
/* Excluded from this release type: update */
|
|
22142
23300
|
private setupAnalyser;
|
|
22143
23301
|
private cleanupAnalyser;
|
|
23302
|
+
private closeSharedAudioContext;
|
|
22144
23303
|
private onReceiveStream;
|
|
22145
23304
|
private onStreamEnded;
|
|
22146
23305
|
private onEnabledChanged;
|
|
@@ -22464,7 +23623,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22464
23623
|
private onApplyPose;
|
|
22465
23624
|
}
|
|
22466
23625
|
|
|
22467
|
-
declare type WebsocketSendType = IModel | object | boolean |
|
|
23626
|
+
declare type WebsocketSendType = IModel | object | boolean | string | number;
|
|
22468
23627
|
|
|
22469
23628
|
/**
|
|
22470
23629
|
* Use the [WebXR](https://engine.needle.tools/docs/api/WebXR) component to enable VR and AR on **iOS and Android** in your scene. VisionOS support is also provided via QuickLook USDZ export.
|
|
@@ -22858,6 +24017,25 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22858
24017
|
* @link https://github.com/immersive-web/marker-tracking/blob/main/explainer.md - WebXR Marker Tracking Specification
|
|
22859
24018
|
*/
|
|
22860
24019
|
export declare class WebXRImageTracking extends Component {
|
|
24020
|
+
/**
|
|
24021
|
+
* Event invoked every frame when images are being tracked.
|
|
24022
|
+
* @example
|
|
24023
|
+
* ```ts
|
|
24024
|
+
* const tracker = this.gameObject.getComponent(WebXRImageTracking);
|
|
24025
|
+
* tracker?.imageTracked.addEventListener(evt => {
|
|
24026
|
+
* for (const img of evt.trackedImages) {
|
|
24027
|
+
* console.log(img.url, img.state);
|
|
24028
|
+
* }
|
|
24029
|
+
* });
|
|
24030
|
+
* ```
|
|
24031
|
+
*/
|
|
24032
|
+
imageTracked: EventList<WebXRImageTrackingEvent>;
|
|
24033
|
+
/** @inheritdoc */
|
|
24034
|
+
addEventListener<K extends keyof WebXRImageTrackingEventMap>(type: K, listener: (evt: WebXRImageTrackingEventMap[K]) => any): void;
|
|
24035
|
+
addEventListener<T extends Event>(type: string, listener: (evt: T) => any): void;
|
|
24036
|
+
/** @inheritdoc */
|
|
24037
|
+
removeEventListener<K extends keyof WebXRImageTrackingEventMap>(type: K, listener: (evt: WebXRImageTrackingEventMap[K]) => any): void;
|
|
24038
|
+
removeEventListener<T extends Event>(type: string, listener: (evt: T) => any): void;
|
|
22861
24039
|
/**
|
|
22862
24040
|
* Set which marker should be primary (first in the list).
|
|
22863
24041
|
* Useful when deploying to QuickLook mode where one marker is tracked at a time.
|
|
@@ -22944,6 +24122,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22944
24122
|
private onImageTrackingUpdate;
|
|
22945
24123
|
}
|
|
22946
24124
|
|
|
24125
|
+
/** Data passed to image tracking event listeners. */
|
|
24126
|
+
export declare interface WebXRImageTrackingEvent {
|
|
24127
|
+
/** The images currently being tracked this frame. */
|
|
24128
|
+
readonly trackedImages: readonly WebXRTrackedImage[];
|
|
24129
|
+
}
|
|
24130
|
+
|
|
24131
|
+
/** Event map for {@link WebXRImageTracking} events. Use with `addEventListener` for typed event handling. */
|
|
24132
|
+
export declare interface WebXRImageTrackingEventMap {
|
|
24133
|
+
/** Dispatched every frame when images are being tracked. The event detail contains the tracking data for the current frame. */
|
|
24134
|
+
"image-tracking": CustomEvent<WebXRImageTrackingEvent>;
|
|
24135
|
+
}
|
|
24136
|
+
|
|
22947
24137
|
/**
|
|
22948
24138
|
* Configuration model for a tracked image marker.
|
|
22949
24139
|
* Defines which image to track, its physical size, and which 3D content to display when detected.
|
|
@@ -23142,8 +24332,39 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
23142
24332
|
get widthInMeters(): number;
|
|
23143
24333
|
/** The ImageBitmap used for tracking */
|
|
23144
24334
|
get bitmap(): ImageBitmap;
|
|
23145
|
-
/**
|
|
24335
|
+
/**
|
|
24336
|
+
* The {@link WebXRImageTrackingModel} configuration for this tracked image.
|
|
24337
|
+
* Use this to access the assigned 3D object, marker settings, and other image tracking configuration.
|
|
24338
|
+
* Available on each {@link WebXRTrackedImage} received from the `image-tracking` {@link CustomEvent} (`event.detail`).
|
|
24339
|
+
* @example
|
|
24340
|
+
* ```ts
|
|
24341
|
+
* tracker.addEventListener("image-tracking", event => {
|
|
24342
|
+
* for (const img of event.detail.trackedImages) {
|
|
24343
|
+
* const model = img.model;
|
|
24344
|
+
* // Access the assigned 3D object
|
|
24345
|
+
* const obj = model.object;
|
|
24346
|
+
* // Access other settings
|
|
24347
|
+
* console.log(model.widthInMeters, model.hideWhenTrackingIsLost);
|
|
24348
|
+
* }
|
|
24349
|
+
* });
|
|
24350
|
+
* ```
|
|
24351
|
+
*/
|
|
23146
24352
|
get model(): WebXRImageTrackingModel;
|
|
24353
|
+
/**
|
|
24354
|
+
* The 3D object or prefab assigned to this tracked image marker in the {@link WebXRImageTrackingModel}.
|
|
24355
|
+
* Use this to access the object associated with an AR image tracking marker from the `image-tracking` {@link CustomEvent}.
|
|
24356
|
+
* Shorthand for `this.model.object`.
|
|
24357
|
+
* @example
|
|
24358
|
+
* ```ts
|
|
24359
|
+
* tracker.addEventListener("image-tracking", event => {
|
|
24360
|
+
* for (const img of event.detail.trackedImages) {
|
|
24361
|
+
* const obj = img.trackedModel;
|
|
24362
|
+
* // verbose alternative: img.model.object
|
|
24363
|
+
* }
|
|
24364
|
+
* });
|
|
24365
|
+
* ```
|
|
24366
|
+
*/
|
|
24367
|
+
get trackedModel(): AssetReference | undefined;
|
|
23147
24368
|
/**
|
|
23148
24369
|
* The measured size of the detected image in the real world.
|
|
23149
24370
|
* May differ from `widthInMeters` if the physical marker doesn't match the configured size.
|