@needle-tools/engine 5.1.0-canary.deec6e4 → 5.1.0-canary.e6680fa
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +99 -1
- package/SKILL.md +4 -1
- package/components.needle.json +1 -1
- package/dist/needle-engine.bundle-Bl_hyH5G.umd.cjs +1734 -0
- package/dist/needle-engine.bundle-Cduc1gj6.min.js +1734 -0
- package/dist/{needle-engine.bundle-CvtELXh0.js → needle-engine.bundle-DNcqT8nJ.js} +19415 -18452
- package/dist/needle-engine.d.ts +1588 -374
- package/dist/needle-engine.js +572 -569
- 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 +8 -1
- 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/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 +21 -8
- package/lib/engine/engine_context.js +46 -16
- 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 +7 -7
- 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 +7 -7
- package/lib/engine/engine_license.js +186 -58
- package/lib/engine/engine_license.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.js +2 -2
- package/lib/engine/engine_scenedata.js.map +1 -1
- package/lib/engine/engine_serialization_builtin_serializer.js +28 -5
- 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_types.d.ts +29 -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/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 +1 -1
- 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-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 +2 -119
- package/lib/engine-components/AnimatorController.js +33 -232
- 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/Camera.d.ts +6 -1
- package/lib/engine-components/Camera.js +16 -3
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +14 -6
- package/lib/engine-components/CameraUtils.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.js +9 -1
- 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/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/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/package.json +2 -83
- package/plugins/common/cloud.js +6 -1
- package/plugins/common/license.js +55 -12
- package/plugins/common/worker.js +9 -4
- package/plugins/types/userconfig.d.ts +4 -1
- package/plugins/vite/asap.js +17 -8
- package/plugins/vite/build-pipeline.js +57 -20
- package/plugins/vite/dependencies.js +29 -10
- package/plugins/vite/dependency-watcher.js +2 -2
- package/plugins/vite/editor-connection.js +3 -3
- 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/reload.js +1 -1
- package/plugins/vite/server.js +2 -1
- package/src/engine/api.ts +11 -1
- package/src/engine/codegen/register_types.ts +10 -18
- 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 +52 -19
- 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 +7 -7
- package/src/engine/engine_input.ts +28 -7
- package/src/engine/engine_instantiate_resolve.ts +407 -0
- package/src/engine/engine_license.ts +202 -56
- 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 +3 -3
- package/src/engine/engine_serialization_builtin_serializer.ts +32 -9
- package/src/engine/engine_serialization_core.ts +9 -0
- package/src/engine/engine_types.ts +46 -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/needle menu/needle-menu-spatial.ts +2 -2
- package/src/engine/webcomponents/needle menu/needle-menu.ts +6 -6
- package/src/engine/webcomponents/needle-engine.loading.ts +6 -6
- package/src/engine/webcomponents/needle-engine.ts +12 -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 +20 -291
- package/src/engine-components/AudioSource.ts +130 -79
- package/src/engine-components/Camera.ts +16 -3
- package/src/engine-components/CameraUtils.ts +12 -5
- 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 +10 -2
- package/src/engine-components/Networking.ts +1 -1
- package/src/engine-components/OrbitControls.ts +42 -16
- 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/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/dist/needle-engine.bundle-1s2gOoKZ.min.js +0 -1732
- package/dist/needle-engine.bundle-j4nGJXCs.umd.cjs +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';
|
|
@@ -117,6 +119,12 @@ export declare const $componentName: unique symbol;
|
|
|
117
119
|
|
|
118
120
|
export declare const $physicsKey: unique symbol;
|
|
119
121
|
|
|
122
|
+
/* Excluded from this release type: $TXm */
|
|
123
|
+
|
|
124
|
+
/* Excluded from this release type: __CYjiNy */
|
|
125
|
+
|
|
126
|
+
/* Excluded from this release type: __gGoBKfJa */
|
|
127
|
+
|
|
120
128
|
export declare class __Ignore {
|
|
121
129
|
}
|
|
122
130
|
|
|
@@ -254,6 +262,31 @@ export declare class ActionModel implements IBehaviorElement {
|
|
|
254
262
|
writeTo(document: USDDocument, writer: USDWriter): void;
|
|
255
263
|
}
|
|
256
264
|
|
|
265
|
+
/**
|
|
266
|
+
* Options for an activation clip in the timeline builder
|
|
267
|
+
*/
|
|
268
|
+
export declare type ActivationClipOptions = {
|
|
269
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
270
|
+
start?: number;
|
|
271
|
+
/** Duration of the clip in seconds (required) */
|
|
272
|
+
duration: number;
|
|
273
|
+
/** Ease-in duration in seconds (default: 0) */
|
|
274
|
+
easeIn?: number;
|
|
275
|
+
/** Ease-out duration in seconds (default: 0) */
|
|
276
|
+
easeOut?: number;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Builder for activation tracks. Provides `.clip()` for defining activation windows.
|
|
281
|
+
* @category Animation and Sequencing
|
|
282
|
+
*/
|
|
283
|
+
export declare interface ActivationTrackBuilder extends TimelineBuilderBase {
|
|
284
|
+
/** Adds an activation clip that shows/hides the bound object */
|
|
285
|
+
clip(options: ActivationClipOptions): ActivationTrackBuilder;
|
|
286
|
+
/** Mutes this track so it is skipped during playback */
|
|
287
|
+
muted(muted?: boolean): ActivationTrackBuilder;
|
|
288
|
+
}
|
|
289
|
+
|
|
257
290
|
export declare const activeInHierarchyFieldName = "needle_isActiveInHierarchy";
|
|
258
291
|
|
|
259
292
|
/**
|
|
@@ -487,6 +520,62 @@ declare class Animation_2 extends Component implements IAnimationComponent {
|
|
|
487
520
|
}
|
|
488
521
|
export { Animation_2 as Animation }
|
|
489
522
|
|
|
523
|
+
/**
|
|
524
|
+
* A fluent builder for creating `AnimationClip` instances from code.
|
|
525
|
+
*
|
|
526
|
+
* Use {@link AnimationBuilder.create} to start a new builder, chain `.track()` calls
|
|
527
|
+
* to add animation tracks, and call `.build()` to produce the clip.
|
|
528
|
+
*
|
|
529
|
+
* @example Single track
|
|
530
|
+
* ```ts
|
|
531
|
+
* const clip = AnimationBuilder.create()
|
|
532
|
+
* .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
|
|
533
|
+
* .build();
|
|
534
|
+
* ```
|
|
535
|
+
*
|
|
536
|
+
* @example Multiple tracks
|
|
537
|
+
* ```ts
|
|
538
|
+
* const clip = AnimationBuilder.create("DoorOpen")
|
|
539
|
+
* .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
|
|
540
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
541
|
+
* .build(room);
|
|
542
|
+
* ```
|
|
543
|
+
*
|
|
544
|
+
* @category Animation and Sequencing
|
|
545
|
+
* @group Utilities
|
|
546
|
+
*/
|
|
547
|
+
export declare class AnimationBuilder {
|
|
548
|
+
private _name?;
|
|
549
|
+
private _tracks;
|
|
550
|
+
/** Creates a new AnimationBuilder instance */
|
|
551
|
+
static create(name?: string): AnimationBuilder;
|
|
552
|
+
constructor(name?: string);
|
|
553
|
+
/** Adds an animation track for an Object3D's position or scale */
|
|
554
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF_2<Vec3Value>, options?: TrackOptions): this;
|
|
555
|
+
/** Adds an animation track for an Object3D's quaternion */
|
|
556
|
+
track(target: Object3D, property: "quaternion", keyframes: KF_2<QuatValue>, options?: TrackOptions): this;
|
|
557
|
+
/** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
|
|
558
|
+
track(target: Object3D, property: "rotation", keyframes: KF_2<EulerValue>, options?: TrackOptions): this;
|
|
559
|
+
/** Adds an animation track for an Object3D's visibility */
|
|
560
|
+
track(target: Object3D, property: "visible", keyframes: KF_2<boolean>, options?: TrackOptions): this;
|
|
561
|
+
/** Adds an animation track for a material's numeric property */
|
|
562
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_2<number>, options?: TrackOptions): this;
|
|
563
|
+
/** Adds an animation track for a material's color property */
|
|
564
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
|
|
565
|
+
/** Adds an animation track for a light's numeric property */
|
|
566
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_2<number>, options?: TrackOptions): this;
|
|
567
|
+
/** Adds an animation track for a light's color */
|
|
568
|
+
track(target: Light_2, property: "color", keyframes: KF_2<ColorValue>, options?: TrackOptions): this;
|
|
569
|
+
/** Adds an animation track for a camera's numeric property */
|
|
570
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_2<number>, options?: TrackOptions): this;
|
|
571
|
+
/**
|
|
572
|
+
* Builds and returns the `AnimationClip`.
|
|
573
|
+
* @param root - Optional root Object3D for resolving track paths.
|
|
574
|
+
* When provided, tracks targeting a different object use `target.name` for named resolution.
|
|
575
|
+
*/
|
|
576
|
+
build(root?: Object3D): AnimationClip;
|
|
577
|
+
}
|
|
578
|
+
|
|
490
579
|
/**
|
|
491
580
|
* @category Animation and Sequencing
|
|
492
581
|
* @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
|
|
@@ -500,6 +589,34 @@ export declare type AnimationClipModel = {
|
|
|
500
589
|
rotation?: Quat | Quaternion;
|
|
501
590
|
};
|
|
502
591
|
|
|
592
|
+
/**
|
|
593
|
+
* Options for an animation clip in the timeline builder
|
|
594
|
+
*/
|
|
595
|
+
export declare type AnimationClipOptions = {
|
|
596
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
597
|
+
start?: number;
|
|
598
|
+
/** Duration of the clip in seconds. Defaults to the animation clip duration. */
|
|
599
|
+
duration?: number;
|
|
600
|
+
/** Playback speed multiplier (default: 1) */
|
|
601
|
+
speed?: number;
|
|
602
|
+
/** Whether the animation should loop within the clip (default: false) */
|
|
603
|
+
loop?: boolean;
|
|
604
|
+
/** Ease-in duration in seconds (default: 0) */
|
|
605
|
+
easeIn?: number;
|
|
606
|
+
/** Ease-out duration in seconds (default: 0) */
|
|
607
|
+
easeOut?: number;
|
|
608
|
+
/** Offset into the source animation clip in seconds (default: 0) */
|
|
609
|
+
clipIn?: number;
|
|
610
|
+
/** Whether to remove the start offset of the animation (default: false) */
|
|
611
|
+
removeStartOffset?: boolean;
|
|
612
|
+
/** Pre-extrapolation mode (default: None) */
|
|
613
|
+
preExtrapolation?: ClipExtrapolation;
|
|
614
|
+
/** Post-extrapolation mode (default: None) */
|
|
615
|
+
postExtrapolation?: ClipExtrapolation;
|
|
616
|
+
/** Play the clip in reverse */
|
|
617
|
+
reversed?: boolean;
|
|
618
|
+
};
|
|
619
|
+
|
|
503
620
|
/**
|
|
504
621
|
* AnimationCurve is a representation of a curve that can be used to animate values over time.
|
|
505
622
|
*
|
|
@@ -577,6 +694,19 @@ export declare class AnimationExtension implements IUSDExporterExtension {
|
|
|
577
694
|
|
|
578
695
|
declare type AnimationIdentifier = AnimationClip | number | string | undefined;
|
|
579
696
|
|
|
697
|
+
/** User-friendly interpolation mode names */
|
|
698
|
+
export declare type AnimationInterpolation = "linear" | "smooth" | "step";
|
|
699
|
+
|
|
700
|
+
/** A single keyframe: a time and a value */
|
|
701
|
+
export declare type AnimationKeyframe<V> = {
|
|
702
|
+
/** Time in seconds */
|
|
703
|
+
time: number;
|
|
704
|
+
/** The value at this time */
|
|
705
|
+
value: V;
|
|
706
|
+
/** Interpolation mode for this track (default: `"linear"`). Note: Three.js applies one mode per track; the first keyframe's mode is used. */
|
|
707
|
+
interpolation?: AnimationInterpolation;
|
|
708
|
+
};
|
|
709
|
+
|
|
580
710
|
/**
|
|
581
711
|
* Registry for animation related data. Use {@link registerAnimationMixer} to register an animation mixer instance.
|
|
582
712
|
* Can be accessed from {@link Context.animations} and is used internally e.g. when exporting GLTF files.
|
|
@@ -597,43 +727,39 @@ declare class AnimationsRegistry {
|
|
|
597
727
|
unregisterAnimationMixer(mixer: AnimationMixer | null | undefined): void;
|
|
598
728
|
}
|
|
599
729
|
|
|
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;
|
|
730
|
+
/**
|
|
731
|
+
* Builder for animation tracks.
|
|
732
|
+
* Provides `.clip()` for pre-built AnimationClips and `.track()` for inline animation definition.
|
|
733
|
+
*
|
|
734
|
+
* @category Animation and Sequencing
|
|
735
|
+
*/
|
|
736
|
+
export declare interface AnimationTrackBuilder extends TimelineBuilderBase {
|
|
737
|
+
/** Adds a pre-built AnimationClip */
|
|
738
|
+
clip(asset: AnimationClip, options?: AnimationClipOptions): AnimationTrackBuilder;
|
|
739
|
+
/** Adds a clip from a single {@link TrackDescriptor} */
|
|
740
|
+
clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): AnimationTrackBuilder;
|
|
741
|
+
/** Adds a clip from multiple {@link TrackDescriptor}s */
|
|
742
|
+
clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): AnimationTrackBuilder;
|
|
743
|
+
/** Adds an animation track for an Object3D's position or scale */
|
|
744
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): AnimationTrackBuilder;
|
|
745
|
+
/** Adds an animation track for an Object3D's quaternion */
|
|
746
|
+
track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
747
|
+
/** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) */
|
|
748
|
+
track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
749
|
+
/** Adds an animation track for an Object3D's visibility */
|
|
750
|
+
track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): AnimationTrackBuilder;
|
|
751
|
+
/** Adds an animation track for a material's numeric property */
|
|
752
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
|
|
753
|
+
/** Adds an animation track for a material's color property */
|
|
754
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
755
|
+
/** Adds an animation track for a light's numeric property */
|
|
756
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
|
|
757
|
+
/** Adds an animation track for a light's color */
|
|
758
|
+
track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): AnimationTrackBuilder;
|
|
759
|
+
/** Adds an animation track for a camera's numeric property */
|
|
760
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): AnimationTrackBuilder;
|
|
761
|
+
/** Mutes this track so it is skipped during playback */
|
|
762
|
+
muted(muted?: boolean): AnimationTrackBuilder;
|
|
637
763
|
}
|
|
638
764
|
|
|
639
765
|
declare class AnimationTriggers {
|
|
@@ -726,6 +852,12 @@ export declare class Animator extends Component implements IAnimationComponent {
|
|
|
726
852
|
* Identifies this component as an animation component in the engine
|
|
727
853
|
*/
|
|
728
854
|
get isAnimationComponent(): boolean;
|
|
855
|
+
/**
|
|
856
|
+
* The current animator mixer, used for low-level control of animations. Owned by the AnimatorController
|
|
857
|
+
* @returns The current AnimationMixer, or null if no controller is assigned
|
|
858
|
+
* @see AnimatorController.mixer
|
|
859
|
+
*/
|
|
860
|
+
get mixer(): AnimationMixer | null;
|
|
729
861
|
/**
|
|
730
862
|
* When enabled, animation will affect the root transform position and rotation
|
|
731
863
|
*/
|
|
@@ -1102,13 +1234,6 @@ export declare class AnimatorController {
|
|
|
1102
1234
|
* @param animator - The animator to bind this controller to
|
|
1103
1235
|
*/
|
|
1104
1236
|
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
1237
|
/**
|
|
1113
1238
|
* Updates the controller's state machine and animations.
|
|
1114
1239
|
* Called each frame by the animator component.
|
|
@@ -1151,11 +1276,15 @@ export declare class AnimatorController {
|
|
|
1151
1276
|
/**
|
|
1152
1277
|
* A fluent builder for creating {@link AnimatorController} instances from code.
|
|
1153
1278
|
*
|
|
1154
|
-
* Use {@link AnimatorController.build} to create a new builder.
|
|
1279
|
+
* Use {@link AnimatorControllerBuilder.create} or {@link AnimatorController.build} to create a new builder.
|
|
1155
1280
|
*
|
|
1156
|
-
*
|
|
1281
|
+
* The builder tracks state names and parameter types through the fluent chain,
|
|
1282
|
+
* providing autocomplete for state names in `.transition()` and type-aware
|
|
1283
|
+
* `.condition()` calls (e.g., trigger parameters don't require a mode argument).
|
|
1284
|
+
*
|
|
1285
|
+
* @example With pre-built AnimationClips
|
|
1157
1286
|
* ```ts
|
|
1158
|
-
* const controller =
|
|
1287
|
+
* const controller = AnimatorControllerBuilder.create("CharacterController")
|
|
1159
1288
|
* .floatParameter("Speed", 0)
|
|
1160
1289
|
* .triggerParameter("Jump")
|
|
1161
1290
|
* .state("Idle", { clip: idleClip, loop: true })
|
|
@@ -1166,36 +1295,70 @@ export declare class AnimatorController {
|
|
|
1166
1295
|
* .transition("Walk", "Idle", { duration: 0.25 })
|
|
1167
1296
|
* .condition("Speed", "less", 0.1)
|
|
1168
1297
|
* .transition("*", "Jump", { duration: 0.1 })
|
|
1169
|
-
* .condition("Jump"
|
|
1298
|
+
* .condition("Jump")
|
|
1170
1299
|
* .transition("Jump", "Idle", { hasExitTime: true, exitTime: 0.9, duration: 0.25 })
|
|
1171
1300
|
* .build();
|
|
1172
1301
|
* ```
|
|
1173
1302
|
*
|
|
1303
|
+
* @example With inline tracks (no pre-built clips needed)
|
|
1304
|
+
* ```ts
|
|
1305
|
+
* const controller = AnimatorControllerBuilder.create("Door")
|
|
1306
|
+
* .boolParameter("Open", false)
|
|
1307
|
+
* .state("Closed", { loop: true })
|
|
1308
|
+
* .track(door, "position", { from: [0, 0, 0], to: [0, 0, 0], duration: 1 })
|
|
1309
|
+
* .state("Open", { loop: true })
|
|
1310
|
+
* .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
|
|
1311
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
1312
|
+
* .transition("Closed", "Open", { duration: 0.25 })
|
|
1313
|
+
* .condition("Open", "if")
|
|
1314
|
+
* .transition("Open", "Closed", { duration: 0.25 })
|
|
1315
|
+
* .condition("Open", "ifNot")
|
|
1316
|
+
* .build(room);
|
|
1317
|
+
* ```
|
|
1318
|
+
*
|
|
1319
|
+
* @typeParam TStates - Union of state names added via `.state()`. Used for autocomplete and validation in `.transition()` and `.defaultState()`.
|
|
1320
|
+
* @typeParam TParams - Record mapping parameter names to their types (`"trigger"`, `"bool"`, `"float"`, `"int"`). Used for type-aware `.condition()` overloads.
|
|
1321
|
+
*
|
|
1174
1322
|
* @category Animation and Sequencing
|
|
1175
1323
|
* @group Utilities
|
|
1176
1324
|
*/
|
|
1177
|
-
export declare class AnimatorControllerBuilder {
|
|
1325
|
+
export declare class AnimatorControllerBuilder<TStates extends string = never, TParams extends Record<string, "trigger" | "bool" | "float" | "int"> = {}> {
|
|
1178
1326
|
private _name;
|
|
1179
1327
|
private _parameters;
|
|
1180
1328
|
private _states;
|
|
1181
1329
|
private _anyStateTransitions;
|
|
1182
1330
|
private _defaultStateName;
|
|
1183
1331
|
private _lastTransition;
|
|
1332
|
+
private _lastState;
|
|
1333
|
+
/**
|
|
1334
|
+
* Creates a new AnimatorControllerBuilder instance.
|
|
1335
|
+
* @param name - Optional name for the controller
|
|
1336
|
+
*/
|
|
1337
|
+
static create(name?: string): AnimatorControllerBuilder;
|
|
1184
1338
|
constructor(name?: string);
|
|
1185
1339
|
/** Adds a float parameter */
|
|
1186
|
-
floatParameter(name:
|
|
1340
|
+
floatParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "float">>;
|
|
1187
1341
|
/** Adds an integer parameter */
|
|
1188
|
-
intParameter(name:
|
|
1342
|
+
intParameter<N extends string>(name: N, defaultValue?: number): AnimatorControllerBuilder<TStates, TParams & Record<N, "int">>;
|
|
1189
1343
|
/** Adds a boolean parameter */
|
|
1190
|
-
boolParameter(name:
|
|
1344
|
+
boolParameter<N extends string>(name: N, defaultValue?: boolean): AnimatorControllerBuilder<TStates, TParams & Record<N, "bool">>;
|
|
1191
1345
|
/** Adds a trigger parameter */
|
|
1192
|
-
triggerParameter(name:
|
|
1346
|
+
triggerParameter<N extends string>(name: N): AnimatorControllerBuilder<TStates, TParams & Record<N, "trigger">>;
|
|
1193
1347
|
/**
|
|
1194
1348
|
* Adds a state to the controller. The first state added becomes the default state.
|
|
1349
|
+
*
|
|
1350
|
+
* When `options.clip` is provided, the state uses that clip directly.
|
|
1351
|
+
* When omitted, chain `.track()` calls to define animation tracks inline:
|
|
1352
|
+
* ```ts
|
|
1353
|
+
* .state("Open", { loop: true })
|
|
1354
|
+
* .track(door, "position", { from: [0,0,0], to: [2,0,0], duration: 1 })
|
|
1355
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
1356
|
+
* ```
|
|
1357
|
+
*
|
|
1195
1358
|
* @param name - Unique name for the state
|
|
1196
|
-
* @param options - State configuration including clip, loop, speed
|
|
1359
|
+
* @param options - State configuration including clip, loop, speed. When omitted, use `.track()` to add animation data.
|
|
1197
1360
|
*/
|
|
1198
|
-
state(name:
|
|
1361
|
+
state<N extends string>(name: N, options?: StateOptions): AnimatorControllerBuilder<TStates | N, TParams>;
|
|
1199
1362
|
/**
|
|
1200
1363
|
* Adds a transition between two states.
|
|
1201
1364
|
* Use `"*"` as the source to create a transition from any state.
|
|
@@ -1204,26 +1367,52 @@ export declare class AnimatorControllerBuilder {
|
|
|
1204
1367
|
* @param to - Destination state name
|
|
1205
1368
|
* @param options - Transition configuration
|
|
1206
1369
|
*/
|
|
1207
|
-
transition(from:
|
|
1370
|
+
transition(from: TStates | "*", to: TStates, options?: TransitionOptions): AnimatorControllerBuilder<TStates, TParams>;
|
|
1208
1371
|
/**
|
|
1209
1372
|
* Adds a condition to the most recently added transition.
|
|
1210
1373
|
* Multiple conditions on the same transition are AND-ed together.
|
|
1374
|
+
*
|
|
1375
|
+
* The required arguments depend on the parameter type:
|
|
1376
|
+
* - **Trigger**: `.condition("Jump")` — mode defaults to `"if"`, no threshold needed
|
|
1377
|
+
* - **Bool**: `.condition("Open", "if")` or `.condition("Open", "ifNot")`
|
|
1378
|
+
* - **Float/Int**: `.condition("Speed", "greater", 0.1)`
|
|
1379
|
+
*
|
|
1211
1380
|
* @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
1381
|
*/
|
|
1215
|
-
condition(parameter:
|
|
1382
|
+
condition(parameter: ParamNamesOfType<TParams, "trigger">, mode?: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
|
|
1383
|
+
condition(parameter: ParamNamesOfType<TParams, "bool">, mode: "if" | "ifNot"): AnimatorControllerBuilder<TStates, TParams>;
|
|
1384
|
+
condition(parameter: ParamNamesOfType<TParams, "float" | "int">, mode: "greater" | "less" | "equals" | "notEqual", threshold?: number): AnimatorControllerBuilder<TStates, TParams>;
|
|
1385
|
+
/** Adds an animation track for an Object3D's position or scale to the current state */
|
|
1386
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF<Vec3Value>, options?: TrackOptions): this;
|
|
1387
|
+
/** Adds an animation track for an Object3D's quaternion to the current state */
|
|
1388
|
+
track(target: Object3D, property: "quaternion", keyframes: KF<QuatValue>, options?: TrackOptions): this;
|
|
1389
|
+
/** Adds an animation track for an Object3D's rotation (Euler, converted to quaternion) to the current state */
|
|
1390
|
+
track(target: Object3D, property: "rotation", keyframes: KF<EulerValue>, options?: TrackOptions): this;
|
|
1391
|
+
/** Adds an animation track for an Object3D's visibility to the current state */
|
|
1392
|
+
track(target: Object3D, property: "visible", keyframes: KF<boolean>, options?: TrackOptions): this;
|
|
1393
|
+
/** Adds an animation track for a material's numeric property to the current state */
|
|
1394
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF<number>, options?: TrackOptions): this;
|
|
1395
|
+
/** Adds an animation track for a material's color property to the current state */
|
|
1396
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF<ColorValue>, options?: TrackOptions): this;
|
|
1397
|
+
/** Adds an animation track for a light's numeric property to the current state */
|
|
1398
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF<number>, options?: TrackOptions): this;
|
|
1399
|
+
/** Adds an animation track for a light's color to the current state */
|
|
1400
|
+
track(target: Light_2, property: "color", keyframes: KF<ColorValue>, options?: TrackOptions): this;
|
|
1401
|
+
/** Adds an animation track for a camera's numeric property to the current state */
|
|
1402
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF<number>, options?: TrackOptions): this;
|
|
1216
1403
|
/**
|
|
1217
1404
|
* Sets which state is the default/entry state.
|
|
1218
1405
|
* If not called, the first added state is used.
|
|
1219
1406
|
* @param name - Name of the state
|
|
1220
1407
|
*/
|
|
1221
|
-
defaultState(name:
|
|
1408
|
+
defaultState(name: TStates): AnimatorControllerBuilder<TStates, TParams>;
|
|
1222
1409
|
/**
|
|
1223
1410
|
* Builds and returns the {@link AnimatorController}.
|
|
1224
1411
|
* Resolves all state name references to indices.
|
|
1412
|
+
* @param root - Optional root Object3D for resolving {@link TrackDescriptor} track paths.
|
|
1413
|
+
* When provided, tracks targeting a different object use `target.name` for named resolution.
|
|
1225
1414
|
*/
|
|
1226
|
-
build(): AnimatorController;
|
|
1415
|
+
build(root?: Object3D): AnimatorController;
|
|
1227
1416
|
}
|
|
1228
1417
|
|
|
1229
1418
|
export declare type AnimatorControllerModel = {
|
|
@@ -1472,6 +1661,75 @@ export declare class Attractor extends Component {
|
|
|
1472
1661
|
|
|
1473
1662
|
declare type AttributeChangeCallback = (value: string | null) => void;
|
|
1474
1663
|
|
|
1664
|
+
/**
|
|
1665
|
+
* Represents an audio clip that can be loaded and played independently.
|
|
1666
|
+
* The AudioClip class encapsulates the URL of the audio resource and provides
|
|
1667
|
+
* methods for playback control (play, pause, stop) and querying duration.
|
|
1668
|
+
*/
|
|
1669
|
+
export declare class AudioClip {
|
|
1670
|
+
readonly url: string;
|
|
1671
|
+
/**
|
|
1672
|
+
* Creates a new AudioClip instance with the specified URL.
|
|
1673
|
+
* @param url The URL of the audio resource to load. This can be a path to an audio file or a MediaStream URL.
|
|
1674
|
+
*/
|
|
1675
|
+
constructor(url: string);
|
|
1676
|
+
/** Whether the clip is currently playing.
|
|
1677
|
+
* @returns `true` if the clip is actively playing audio.
|
|
1678
|
+
*/
|
|
1679
|
+
get isPlaying(): boolean;
|
|
1680
|
+
/**
|
|
1681
|
+
* The total duration of the audio clip in seconds.
|
|
1682
|
+
* Loads the audio metadata if not already available.
|
|
1683
|
+
* @returns A promise that resolves with the duration in seconds.
|
|
1684
|
+
*/
|
|
1685
|
+
getDuration(): Promise<number>;
|
|
1686
|
+
/**
|
|
1687
|
+
* Plays the audio clip from the current position.
|
|
1688
|
+
* @returns A promise that resolves when playback finishes, or rejects on error.
|
|
1689
|
+
* If the clip is looping, the promise will never resolve on its own – call {@link stop} or {@link pause} to end playback.
|
|
1690
|
+
*/
|
|
1691
|
+
play(): Promise<void>;
|
|
1692
|
+
/**
|
|
1693
|
+
* Pauses playback at the current position.
|
|
1694
|
+
* Call {@link play} to resume.
|
|
1695
|
+
*/
|
|
1696
|
+
pause(): void;
|
|
1697
|
+
/**
|
|
1698
|
+
* Stops playback and resets the position to the beginning.
|
|
1699
|
+
*/
|
|
1700
|
+
stop(): void;
|
|
1701
|
+
/** Whether the clip should loop when reaching the end. */
|
|
1702
|
+
get loop(): boolean;
|
|
1703
|
+
set loop(value: boolean);
|
|
1704
|
+
/** Playback volume from 0 (silent) to 1 (full). */
|
|
1705
|
+
get volume(): number;
|
|
1706
|
+
set volume(value: number);
|
|
1707
|
+
/** Current playback position in seconds. */
|
|
1708
|
+
get currentTime(): number;
|
|
1709
|
+
set currentTime(value: number);
|
|
1710
|
+
/** Normalized playback progress from 0 to 1.
|
|
1711
|
+
* @returns The current playback position as a value between 0 and 1, or 0 if the duration is unknown.
|
|
1712
|
+
*/
|
|
1713
|
+
get progress(): number;
|
|
1714
|
+
/**
|
|
1715
|
+
* Seeks to a normalized position (0–1) in the clip.
|
|
1716
|
+
* @param position A value between 0 (start) and 1 (end).
|
|
1717
|
+
*/
|
|
1718
|
+
seek(position: number): void;
|
|
1719
|
+
/** The underlying HTMLAudioElement, or `undefined` if not yet created.
|
|
1720
|
+
* Use this to connect the element to the Web Audio API via `createMediaElementSource()`.
|
|
1721
|
+
* @returns The HTMLAudioElement if the clip has been loaded or played, otherwise `undefined`.
|
|
1722
|
+
*/
|
|
1723
|
+
get audioElement(): HTMLAudioElement | undefined;
|
|
1724
|
+
private _audioElement?;
|
|
1725
|
+
private _duration?;
|
|
1726
|
+
private _loadPromise?;
|
|
1727
|
+
private _loop;
|
|
1728
|
+
private _volume;
|
|
1729
|
+
/** Lazily creates and loads the shared HTMLAudioElement. */
|
|
1730
|
+
private ensureAudioElement;
|
|
1731
|
+
}
|
|
1732
|
+
|
|
1475
1733
|
/**
|
|
1476
1734
|
* @category Animation and Sequencing
|
|
1477
1735
|
* @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
|
|
@@ -1486,6 +1744,26 @@ declare type AudioClipModel_2 = Models.ClipModel & {
|
|
|
1486
1744
|
_didTriggerPlay: boolean;
|
|
1487
1745
|
};
|
|
1488
1746
|
|
|
1747
|
+
/**
|
|
1748
|
+
* Options for an audio clip in the timeline builder
|
|
1749
|
+
*/
|
|
1750
|
+
export declare type AudioClipOptions = {
|
|
1751
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
1752
|
+
start?: number;
|
|
1753
|
+
/** Duration of the clip in seconds (required for audio since we can't infer it) */
|
|
1754
|
+
duration: number;
|
|
1755
|
+
/** Playback speed multiplier (default: 1) */
|
|
1756
|
+
speed?: number;
|
|
1757
|
+
/** Volume multiplier for this clip (default: 1) */
|
|
1758
|
+
volume?: number;
|
|
1759
|
+
/** Whether the audio should loop within the clip (default: false) */
|
|
1760
|
+
loop?: boolean;
|
|
1761
|
+
/** Ease-in duration in seconds (default: 0) */
|
|
1762
|
+
easeIn?: number;
|
|
1763
|
+
/** Ease-out duration in seconds (default: 0) */
|
|
1764
|
+
easeOut?: number;
|
|
1765
|
+
};
|
|
1766
|
+
|
|
1489
1767
|
export declare class AudioExtension implements IUSDExporterExtension {
|
|
1490
1768
|
static getName(clip: string): string;
|
|
1491
1769
|
get extensionName(): string;
|
|
@@ -1522,7 +1800,7 @@ export { AudioListener_2 as AudioListener }
|
|
|
1522
1800
|
/**
|
|
1523
1801
|
* Defines how audio volume attenuates over distance from the listener.
|
|
1524
1802
|
*/
|
|
1525
|
-
declare enum AudioRolloffMode {
|
|
1803
|
+
export declare enum AudioRolloffMode {
|
|
1526
1804
|
/**
|
|
1527
1805
|
* Logarithmic rolloff provides a natural, real-world attenuation where volume decreases
|
|
1528
1806
|
* exponentially with distance.
|
|
@@ -1627,9 +1905,10 @@ export declare class AudioSource extends Component {
|
|
|
1627
1905
|
*/
|
|
1628
1906
|
get isPlaying(): boolean;
|
|
1629
1907
|
/**
|
|
1630
|
-
* The total duration of the
|
|
1908
|
+
* The total duration of the currently loaded audio clip in seconds.
|
|
1631
1909
|
*
|
|
1632
1910
|
* @returns Duration in seconds or undefined if no clip is loaded
|
|
1911
|
+
* @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
1912
|
*/
|
|
1634
1913
|
get duration(): number | undefined;
|
|
1635
1914
|
/**
|
|
@@ -1654,7 +1933,8 @@ export declare class AudioSource extends Component {
|
|
|
1654
1933
|
/**
|
|
1655
1934
|
* Controls how the audio is positioned in space.
|
|
1656
1935
|
* Values range from 0 (2D, non-positional) to 1 (fully 3D positioned).
|
|
1657
|
-
*
|
|
1936
|
+
* Internally uses a dual-path audio graph to crossfade between a spatialized (PannerNode)
|
|
1937
|
+
* and a non-spatialized (direct) signal path.
|
|
1658
1938
|
*/
|
|
1659
1939
|
get spatialBlend(): number;
|
|
1660
1940
|
set spatialBlend(val: number);
|
|
@@ -1702,7 +1982,11 @@ export declare class AudioSource extends Component {
|
|
|
1702
1982
|
private audioLoader;
|
|
1703
1983
|
private shouldPlay;
|
|
1704
1984
|
private _lastClipStartedLoading;
|
|
1985
|
+
private _loadedClip;
|
|
1705
1986
|
private _audioElement;
|
|
1987
|
+
private _entryNode;
|
|
1988
|
+
private _spatialGain;
|
|
1989
|
+
private _bypassGain;
|
|
1706
1990
|
/**
|
|
1707
1991
|
* Returns the underlying {@link PositionalAudio} object, creating it if necessary.
|
|
1708
1992
|
* The audio source needs a user interaction to be initialized due to browser autoplay policies.
|
|
@@ -1730,6 +2014,15 @@ export declare class AudioSource extends Component {
|
|
|
1730
2014
|
private onApplicationMuteChanged;
|
|
1731
2015
|
private createAudio;
|
|
1732
2016
|
private __onAllowAudioCallback;
|
|
2017
|
+
/**
|
|
2018
|
+
* Sets up the dual-path audio graph for spatial blend crossfading.
|
|
2019
|
+
* Creates two parallel signal paths from source to output:
|
|
2020
|
+
* - 3D path: entry → panner → spatialGain → gain (spatialized)
|
|
2021
|
+
* - 2D path: entry → bypassGain → gain (non-spatialized)
|
|
2022
|
+
*/
|
|
2023
|
+
private setupSpatialBlendNodes;
|
|
2024
|
+
/** Updates the spatial/bypass gain values based on the current spatialBlend. */
|
|
2025
|
+
private updateSpatialBlendGains;
|
|
1733
2026
|
private applySpatialDistanceSettings;
|
|
1734
2027
|
private onNewClip;
|
|
1735
2028
|
/**
|
|
@@ -1737,8 +2030,9 @@ export declare class AudioSource extends Component {
|
|
|
1737
2030
|
* If no argument is provided, plays the currently assigned clip.
|
|
1738
2031
|
*
|
|
1739
2032
|
* @param clip - Optional audio clip or {@link MediaStream} to play
|
|
2033
|
+
* @returns A promise that resolves when playback starts successfully, or rejects on error
|
|
1740
2034
|
*/
|
|
1741
|
-
play(clip?: string | MediaStream | undefined):
|
|
2035
|
+
play(clip?: string | MediaStream | undefined): Promise<boolean>;
|
|
1742
2036
|
/**
|
|
1743
2037
|
* Pauses audio playback while maintaining the current position.
|
|
1744
2038
|
* Use play() to resume from the paused position.
|
|
@@ -1755,30 +2049,15 @@ export declare class AudioSource extends Component {
|
|
|
1755
2049
|
/* Excluded from this release type: update */
|
|
1756
2050
|
}
|
|
1757
2051
|
|
|
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;
|
|
2052
|
+
/**
|
|
2053
|
+
* Builder for audio tracks. Provides `.clip()` for adding audio clips by URL.
|
|
2054
|
+
* @category Animation and Sequencing
|
|
2055
|
+
*/
|
|
2056
|
+
export declare interface AudioTrackBuilder extends TimelineBuilderBase {
|
|
2057
|
+
/** Adds an audio clip by URL */
|
|
2058
|
+
clip(url: string, options: AudioClipOptions): AudioTrackBuilder;
|
|
2059
|
+
/** Mutes this track so it is skipped during playback */
|
|
2060
|
+
muted(muted?: boolean): AudioTrackBuilder;
|
|
1782
2061
|
}
|
|
1783
2062
|
|
|
1784
2063
|
/* Excluded from this release type: AuralMode */
|
|
@@ -1811,69 +2090,6 @@ export declare class Avatar extends Component {
|
|
|
1811
2090
|
private loadAvatarObjects;
|
|
1812
2091
|
}
|
|
1813
2092
|
|
|
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
2093
|
/**
|
|
1878
2094
|
* Marks a GameObject as being controlled or owned by a player in networked XR sessions.
|
|
1879
2095
|
* This is used internally by the networking system to identify player-controlled objects.
|
|
@@ -1934,35 +2150,6 @@ declare type AvatarMarkerEventArgs = {
|
|
|
1934
2150
|
gameObject: Object3D;
|
|
1935
2151
|
};
|
|
1936
2152
|
|
|
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
2153
|
export declare enum Axes {
|
|
1967
2154
|
None = 0,
|
|
1968
2155
|
X = 2,
|
|
@@ -2326,7 +2513,6 @@ export declare class BoxCollider extends Collider implements IBoxCollider {
|
|
|
2326
2513
|
center: Vector3;
|
|
2327
2514
|
/* Excluded from this release type: onEnable */
|
|
2328
2515
|
/* Excluded from this release type: onDisable */
|
|
2329
|
-
/* Excluded from this release type: onValidate */
|
|
2330
2516
|
/**
|
|
2331
2517
|
* Automatically fits the collider to the geometry of the object.
|
|
2332
2518
|
* Sets the size and center based on the object's bounding box.
|
|
@@ -2600,6 +2786,7 @@ declare class CallHandle extends EventDispatcher<any> {
|
|
|
2600
2786
|
* CallInfo represents a single callback method that can be invoked by the {@link EventList}.
|
|
2601
2787
|
*/
|
|
2602
2788
|
export declare class CallInfo {
|
|
2789
|
+
$serializedTypes: Record<string, any>;
|
|
2603
2790
|
/**
|
|
2604
2791
|
* When the CallInfo is enabled it will be invoked when the EventList is invoked
|
|
2605
2792
|
*/
|
|
@@ -2946,7 +3133,7 @@ export declare class Canvas extends UIRootComponent implements ICanvas {
|
|
|
2946
3133
|
private _receivers;
|
|
2947
3134
|
registerEventReceiver(receiver: ICanvasEventReceiver): void;
|
|
2948
3135
|
unregisterEventReceiver(receiver: ICanvasEventReceiver): void;
|
|
2949
|
-
onEnterXR(args: NeedleXREventArgs):
|
|
3136
|
+
onEnterXR(args: NeedleXREventArgs): void;
|
|
2950
3137
|
onLeaveXR(args: NeedleXREventArgs): void;
|
|
2951
3138
|
onBeforeRenderRoutine: () => void;
|
|
2952
3139
|
onAfterRenderRoutine: () => void;
|
|
@@ -3275,7 +3462,12 @@ export declare enum ClearFlags {
|
|
|
3275
3462
|
Skybox = 1,
|
|
3276
3463
|
/** Clear the background with a solid color. The alpha channel of the color determines the transparency */
|
|
3277
3464
|
SolidColor = 2,
|
|
3278
|
-
/**
|
|
3465
|
+
/**
|
|
3466
|
+
* No declared background intent. Sets the render clear color to fully
|
|
3467
|
+
* transparent so the canvas shows through when nothing else is configured,
|
|
3468
|
+
* but leaves `scene.background` untouched — backgrounds set by other code
|
|
3469
|
+
* (custom loaders, user assignment) are preserved.
|
|
3470
|
+
*/
|
|
3279
3471
|
Uninitialized = 4
|
|
3280
3472
|
}
|
|
3281
3473
|
|
|
@@ -3522,6 +3714,22 @@ export declare abstract class Collider extends Component implements ICollider {
|
|
|
3522
3714
|
* The layers that this collider will interact with. Used for filtering collision detection.
|
|
3523
3715
|
*/
|
|
3524
3716
|
filter?: number[];
|
|
3717
|
+
/**
|
|
3718
|
+
* The density of the collider, used for automatic mass calculation when the attached {@link Rigidbody} has `autoMass` enabled.
|
|
3719
|
+
* Rapier computes mass from density using the real-world formula: `mass = density × volume`.
|
|
3720
|
+
* The volume is derived from the collider shape (sphere, box, capsule, or convex hull).
|
|
3721
|
+
*
|
|
3722
|
+
* Reference values (relative to water = 1.0):
|
|
3723
|
+
* - Wood: 0.5–0.9
|
|
3724
|
+
* - Water: 1.0 (engine default)
|
|
3725
|
+
* - Rubber: 1.2
|
|
3726
|
+
* - Steel: 7.8
|
|
3727
|
+
*
|
|
3728
|
+
* @default undefined — uses the physics engine default of 1.0
|
|
3729
|
+
*/
|
|
3730
|
+
density?: number;
|
|
3731
|
+
/* Excluded from this release type: _propertiesDirty */
|
|
3732
|
+
/* Excluded from this release type: onValidate */
|
|
3525
3733
|
/* Excluded from this release type: awake */
|
|
3526
3734
|
/* Excluded from this release type: start */
|
|
3527
3735
|
/* Excluded from this release type: onEnable */
|
|
@@ -3625,6 +3833,9 @@ declare class ColorSerializer extends TypeSerializer {
|
|
|
3625
3833
|
|
|
3626
3834
|
export declare let colorSerializer: ColorSerializer;
|
|
3627
3835
|
|
|
3836
|
+
/** A Color value, either as a Three.js Color or as an `[r, g, b]` tuple (0–1) */
|
|
3837
|
+
declare type ColorValue = Color | [number, number, number];
|
|
3838
|
+
|
|
3628
3839
|
/**
|
|
3629
3840
|
* Utility method to check if two materials were created from the same glTF material
|
|
3630
3841
|
*/
|
|
@@ -3644,7 +3855,7 @@ export declare function compareAssociation<T extends Material>(obj1: T, obj2: T)
|
|
|
3644
3855
|
* **Input event methods:**
|
|
3645
3856
|
* {@link onPointerDown}, {@link onPointerUp}, {@link onPointerEnter}, {@link onPointerExit} and {@link onPointerMove}.
|
|
3646
3857
|
*
|
|
3647
|
-
* @example
|
|
3858
|
+
* @example Basic component
|
|
3648
3859
|
* ```typescript
|
|
3649
3860
|
* import { Behaviour } from "@needle-tools/engine";
|
|
3650
3861
|
* export class MyComponent extends Behaviour {
|
|
@@ -3657,6 +3868,25 @@ export declare function compareAssociation<T extends Material>(obj1: T, obj2: T)
|
|
|
3657
3868
|
* }
|
|
3658
3869
|
* ```
|
|
3659
3870
|
*
|
|
3871
|
+
* @example Automatic cleanup with autoCleanup
|
|
3872
|
+
* ```typescript
|
|
3873
|
+
* import { Behaviour, serializable, EventList } from "@needle-tools/engine";
|
|
3874
|
+
* export class ScoreTracker extends Behaviour {
|
|
3875
|
+
* @serializable(EventList)
|
|
3876
|
+
* onScoreChanged?: EventList<number>;
|
|
3877
|
+
*
|
|
3878
|
+
* start() {
|
|
3879
|
+
* // Registered during start → survives enable/disable, cleaned up on destroy
|
|
3880
|
+
* this.autoCleanup(this.onScoreChanged?.on(score => console.log("Score:", score)));
|
|
3881
|
+
* }
|
|
3882
|
+
*
|
|
3883
|
+
* onEnable() {
|
|
3884
|
+
* // Registered during onEnable → cleaned up on disable
|
|
3885
|
+
* this.autoCleanup(() => this.cleanupResources());
|
|
3886
|
+
* }
|
|
3887
|
+
* }
|
|
3888
|
+
* ```
|
|
3889
|
+
*
|
|
3660
3890
|
* @group Components
|
|
3661
3891
|
*/
|
|
3662
3892
|
declare abstract class Component implements IComponent, EventTarget, Partial<INeedleXRSessionEventReceiver>, Partial<IPointerEventHandler> {
|
|
@@ -3707,6 +3937,50 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
|
|
|
3707
3937
|
* @returns True if the component is enabled and all parent GameObjects are active
|
|
3708
3938
|
*/
|
|
3709
3939
|
get activeAndEnabled(): boolean;
|
|
3940
|
+
private __disableCleanups?;
|
|
3941
|
+
private __destroyCleanups?;
|
|
3942
|
+
/**
|
|
3943
|
+
* @experimental
|
|
3944
|
+
* Register a resource for automatic cleanup tied to this component's lifecycle.
|
|
3945
|
+
* Accepts {@link IDisposable} objects, cleanup functions, or event unsubscribe functions.
|
|
3946
|
+
* `null` and `undefined` are safe no-ops (convenient for conditional subscriptions).
|
|
3947
|
+
*
|
|
3948
|
+
* **Lifecycle-aware:** The cleanup store is chosen automatically based on when `autoCleanup` is called:
|
|
3949
|
+
* - Called during {@link onEnable} → cleaned up on {@link onDisable} (and re-registered on re-enable)
|
|
3950
|
+
* - Called during {@link awake} or {@link start} → cleaned up on {@link onDestroy} (survives enable/disable cycles)
|
|
3951
|
+
* - Called at any other time (e.g. from update) → cleaned up on {@link onDisable}
|
|
3952
|
+
*
|
|
3953
|
+
* @param disposable An {@link IDisposable}, a cleanup/unsubscribe function, or `null`/`undefined`
|
|
3954
|
+
*
|
|
3955
|
+
* @example EventList subscriptions
|
|
3956
|
+
* ```ts
|
|
3957
|
+
* import { Behaviour, serializable, EventList } from "@needle-tools/engine";
|
|
3958
|
+
*
|
|
3959
|
+
* export class MyComponent extends Behaviour {
|
|
3960
|
+
* @serializable(EventList)
|
|
3961
|
+
* onScoreChanged?: EventList<number>;
|
|
3962
|
+
*
|
|
3963
|
+
* onEnable() {
|
|
3964
|
+
* this.autoCleanup(this.onScoreChanged?.on(score => {
|
|
3965
|
+
* console.log("Score:", score);
|
|
3966
|
+
* }));
|
|
3967
|
+
* }
|
|
3968
|
+
* }
|
|
3969
|
+
* ```
|
|
3970
|
+
*
|
|
3971
|
+
* @example Lifetime subscriptions in awake
|
|
3972
|
+
* ```ts
|
|
3973
|
+
* import { Behaviour } from "@needle-tools/engine";
|
|
3974
|
+
*
|
|
3975
|
+
* export class Persistent extends Behaviour {
|
|
3976
|
+
* awake() {
|
|
3977
|
+
* // Registered during awake → survives enable/disable, cleaned up on destroy
|
|
3978
|
+
* this.autoCleanup(() => this.save());
|
|
3979
|
+
* }
|
|
3980
|
+
* }
|
|
3981
|
+
* ```
|
|
3982
|
+
*/
|
|
3983
|
+
protected autoCleanup(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
|
|
3710
3984
|
private get __isActive();
|
|
3711
3985
|
private get __isActiveInHierarchy();
|
|
3712
3986
|
private set __isActiveInHierarchy(value);
|
|
@@ -3725,11 +3999,6 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
|
|
|
3725
3999
|
* For example, URL to the glTF file this component was loaded from
|
|
3726
4000
|
*/
|
|
3727
4001
|
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
4002
|
/**
|
|
3734
4003
|
* Called once when the component becomes active for the first time.
|
|
3735
4004
|
* This is the first lifecycle callback to be invoked
|
|
@@ -3942,6 +4211,10 @@ declare abstract class Component implements IComponent, EventTarget, Partial<INe
|
|
|
3942
4211
|
destroy(): void;
|
|
3943
4212
|
/* Excluded from this release type: __didAwake */
|
|
3944
4213
|
/* Excluded from this release type: __didStart */
|
|
4214
|
+
/** True while start() has finished executing (used by autoCleanup to distinguish start from update) */
|
|
4215
|
+
private __didCompleteStart;
|
|
4216
|
+
/** True while onEnable() is executing (used by autoCleanup to route to disable store) */
|
|
4217
|
+
private __inEnableOrDisableCallback;
|
|
3945
4218
|
/* Excluded from this release type: __didEnable */
|
|
3946
4219
|
/* Excluded from this release type: __isEnabled */
|
|
3947
4220
|
/* Excluded from this release type: __destroyed */
|
|
@@ -4231,6 +4504,7 @@ export declare class ContactShadows extends Component {
|
|
|
4231
4504
|
set needsUpdate(val: boolean);
|
|
4232
4505
|
get needsUpdate(): boolean;
|
|
4233
4506
|
private _needsUpdate;
|
|
4507
|
+
private _needsFit;
|
|
4234
4508
|
/** All shadow objects are parented to this object.
|
|
4235
4509
|
* The gameObject itself should not be transformed because we want the ContactShadows object e.g. also have a GroundProjectedEnv component
|
|
4236
4510
|
* in which case ContactShadows scale would affect the projection
|
|
@@ -4484,19 +4758,31 @@ export declare class Context implements IContext {
|
|
|
4484
4758
|
private _mainCamera;
|
|
4485
4759
|
private _fallbackCamera;
|
|
4486
4760
|
/** access application state (e.g. if all audio should be muted) */
|
|
4487
|
-
application: Application;
|
|
4761
|
+
get application(): Application;
|
|
4762
|
+
private _application;
|
|
4488
4763
|
/** access animation mixer used by components in the scene */
|
|
4489
|
-
animations: AnimationsRegistry;
|
|
4764
|
+
get animations(): AnimationsRegistry;
|
|
4765
|
+
private _animations;
|
|
4490
4766
|
/** access timings (current frame number, deltaTime, timeScale, ...) */
|
|
4491
|
-
time: Time;
|
|
4767
|
+
get time(): Time;
|
|
4768
|
+
private _time;
|
|
4492
4769
|
/** access input data (e.g. click or touch events) */
|
|
4493
|
-
input: Input;
|
|
4770
|
+
get input(): Input;
|
|
4771
|
+
private _input;
|
|
4494
4772
|
/** access physics related methods (e.g. raycasting). To access the phyiscs engine use `context.physics.engine` */
|
|
4495
|
-
physics: Physics;
|
|
4773
|
+
get physics(): Physics;
|
|
4774
|
+
private _physics;
|
|
4496
4775
|
/** access postprocessing effects stack. Add/remove effects and configure adaptive performance settings */
|
|
4497
|
-
postprocessing: PostProcessing;
|
|
4776
|
+
get postprocessing(): PostProcessing;
|
|
4777
|
+
private _postprocessing;
|
|
4498
4778
|
/** access networking methods (use it to send or listen to messages or join a networking backend) */
|
|
4499
|
-
connection: NetworkConnection;
|
|
4779
|
+
get connection(): NetworkConnection;
|
|
4780
|
+
private _connection;
|
|
4781
|
+
/** context-level event bus for decoupled component communication
|
|
4782
|
+
* @see {@link ContextEventMap} for known event types
|
|
4783
|
+
*/
|
|
4784
|
+
get events(): EventBus;
|
|
4785
|
+
private _events;
|
|
4500
4786
|
/** @deprecated AssetDatabase is deprecated */
|
|
4501
4787
|
assets: AssetDatabase;
|
|
4502
4788
|
/** All registered lights in the scene, maintained by the Light component.
|
|
@@ -4755,6 +5041,18 @@ export declare type ContextEventArgs = {
|
|
|
4755
5041
|
files?: LoadedModel[];
|
|
4756
5042
|
};
|
|
4757
5043
|
|
|
5044
|
+
/** Typed event map for {@link Context.events}.
|
|
5045
|
+
* Known events get full autocomplete; custom events can be typed at the call site via generic parameter.
|
|
5046
|
+
*/
|
|
5047
|
+
export declare interface ContextEventMap {
|
|
5048
|
+
"scene-content-changed": {
|
|
5049
|
+
/** The component that triggered the change (e.g. SceneSwitcher, DropListener) */
|
|
5050
|
+
readonly source: IComponent;
|
|
5051
|
+
/** The root object that was added/loaded */
|
|
5052
|
+
readonly object: Object3D;
|
|
5053
|
+
};
|
|
5054
|
+
}
|
|
5055
|
+
|
|
4758
5056
|
/** Use to register to various Needle Engine context events and to get access to all current instances
|
|
4759
5057
|
* e.g. when being created in the DOM
|
|
4760
5058
|
* @example
|
|
@@ -4806,6 +5104,20 @@ export declare type ControlClipModel = {
|
|
|
4806
5104
|
updateDirector: boolean;
|
|
4807
5105
|
};
|
|
4808
5106
|
|
|
5107
|
+
/**
|
|
5108
|
+
* Options for a control clip in the timeline builder
|
|
5109
|
+
*/
|
|
5110
|
+
export declare type ControlClipOptions = {
|
|
5111
|
+
/** Start time of the clip in seconds. If omitted, placed after the previous clip on this track. */
|
|
5112
|
+
start?: number;
|
|
5113
|
+
/** Duration of the clip in seconds (required) */
|
|
5114
|
+
duration: number;
|
|
5115
|
+
/** Whether to control the activation of the source object (default: true) */
|
|
5116
|
+
controlActivation?: boolean;
|
|
5117
|
+
/** Whether to update a nested PlayableDirector on the source object (default: true) */
|
|
5118
|
+
updateDirector?: boolean;
|
|
5119
|
+
};
|
|
5120
|
+
|
|
4809
5121
|
/** true when selectstart was ever received.
|
|
4810
5122
|
* On VisionOS 1.1 we always have select events (as per the spec), so this is always true
|
|
4811
5123
|
*/
|
|
@@ -4816,12 +5128,15 @@ declare type ControllerAxes = "xr-standard-thumbstick" | "xr-standard-touchpad";
|
|
|
4816
5128
|
*/
|
|
4817
5129
|
export declare type ControllerChangedEvt = (args: NeedleXRControllerEventArgs) => void;
|
|
4818
5130
|
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
5131
|
+
/**
|
|
5132
|
+
* Builder for control tracks. Provides `.clip()` for controlling nested objects/timelines.
|
|
5133
|
+
* @category Animation and Sequencing
|
|
5134
|
+
*/
|
|
5135
|
+
export declare interface ControlTrackBuilder extends TimelineBuilderBase {
|
|
5136
|
+
/** Adds a control clip for a source object */
|
|
5137
|
+
clip(sourceObject: Object3D, options: ControlClipOptions): ControlTrackBuilder;
|
|
5138
|
+
/** Mutes this track so it is skipped during playback */
|
|
5139
|
+
muted(muted?: boolean): ControlTrackBuilder;
|
|
4825
5140
|
}
|
|
4826
5141
|
|
|
4827
5142
|
/**@obsolete use Graphics.copyTexture */
|
|
@@ -5009,7 +5324,6 @@ export declare class CursorFollow extends Component {
|
|
|
5009
5324
|
* - Cursor that follows terrain or mesh surfaces
|
|
5010
5325
|
*
|
|
5011
5326
|
* **Important notes:**
|
|
5012
|
-
* - Requires objects in the scene to have colliders for raycasting to work
|
|
5013
5327
|
* - Works best with {@link keepDistance} set to `false` to allow depth changes
|
|
5014
5328
|
* - Can be combined with {@link damping} for smooth surface following
|
|
5015
5329
|
* - The raycast uses the physics system's raycast functionality
|
|
@@ -5136,7 +5450,7 @@ export declare function decompressGpuTexture(texture: any, maxTextureSize?: numb
|
|
|
5136
5450
|
* return true;
|
|
5137
5451
|
* });
|
|
5138
5452
|
* */
|
|
5139
|
-
export declare function deepClone(obj: any, predicate?: deepClonePredicate): any;
|
|
5453
|
+
export declare function deepClone(obj: any, predicate?: deepClonePredicate, _visited?: WeakSet<object>): any;
|
|
5140
5454
|
|
|
5141
5455
|
declare type deepClonePredicate = (owner: any, propertyName: string, current: any) => boolean;
|
|
5142
5456
|
|
|
@@ -5364,7 +5678,7 @@ export declare namespace DeviceUtilities {
|
|
|
5364
5678
|
* Controls how the {@link PlayableDirector} behaves when playback reaches the end.
|
|
5365
5679
|
* @see {@link PlayableDirector.extrapolationMode}
|
|
5366
5680
|
*/
|
|
5367
|
-
declare enum DirectorWrapMode {
|
|
5681
|
+
export declare enum DirectorWrapMode {
|
|
5368
5682
|
/** Hold the last frame when playback reaches the end of the timeline. */
|
|
5369
5683
|
Hold = 0,
|
|
5370
5684
|
/** Loop back to the start and continue playing indefinitely. */
|
|
@@ -5373,6 +5687,101 @@ declare enum DirectorWrapMode {
|
|
|
5373
5687
|
None = 2
|
|
5374
5688
|
}
|
|
5375
5689
|
|
|
5690
|
+
/**
|
|
5691
|
+
* A store for managing disposable resources (event subscriptions, listeners, callbacks)
|
|
5692
|
+
* that should be cleaned up together.
|
|
5693
|
+
*
|
|
5694
|
+
* DisposableStore collects disposables and disposes them all at once when
|
|
5695
|
+
* {@link dispose} is called. After disposal, the store can be reused — new items
|
|
5696
|
+
* can be added and a subsequent {@link dispose} call will clean those up.
|
|
5697
|
+
*
|
|
5698
|
+
* This is the same pattern used internally by VSCode for lifecycle-bound resource management.
|
|
5699
|
+
*
|
|
5700
|
+
* @example Basic usage
|
|
5701
|
+
* ```ts
|
|
5702
|
+
* import { DisposableStore, on } from "@needle-tools/engine";
|
|
5703
|
+
*
|
|
5704
|
+
* const store = new DisposableStore();
|
|
5705
|
+
*
|
|
5706
|
+
* // Register a DOM event listener (typed!)
|
|
5707
|
+
* store.add(on(window, "resize", (ev) => console.log(ev)));
|
|
5708
|
+
*
|
|
5709
|
+
* // Register the return value of EventList.on()
|
|
5710
|
+
* store.add(myEventList.on(data => console.log(data)));
|
|
5711
|
+
*
|
|
5712
|
+
* // Register a raw cleanup function
|
|
5713
|
+
* store.add(() => someSDK.off("event", handler));
|
|
5714
|
+
*
|
|
5715
|
+
* // Later: dispose everything at once
|
|
5716
|
+
* store.dispose();
|
|
5717
|
+
* ```
|
|
5718
|
+
*
|
|
5719
|
+
* @example Use with Needle Engine components
|
|
5720
|
+
* ```ts
|
|
5721
|
+
* import { Behaviour, serializable, EventList, on } from "@needle-tools/engine";
|
|
5722
|
+
*
|
|
5723
|
+
* export class MyComponent extends Behaviour {
|
|
5724
|
+
* @serializable(EventList)
|
|
5725
|
+
* onClick?: EventList;
|
|
5726
|
+
*
|
|
5727
|
+
* onEnable() {
|
|
5728
|
+
* // DOM events — fully typed
|
|
5729
|
+
* this.autoCleanup(on(window, "resize", (ev) => this.onResize(ev)));
|
|
5730
|
+
*
|
|
5731
|
+
* // EventList — .on() returns a function, autoCleanup accepts it
|
|
5732
|
+
* this.autoCleanup(this.onClick?.on(() => console.log("clicked!")));
|
|
5733
|
+
* }
|
|
5734
|
+
* // No onDisable needed — cleaned up automatically!
|
|
5735
|
+
* }
|
|
5736
|
+
* ```
|
|
5737
|
+
*
|
|
5738
|
+
* @category Utilities
|
|
5739
|
+
* @group Lifecycle
|
|
5740
|
+
*/
|
|
5741
|
+
export declare class DisposableStore implements IDisposable {
|
|
5742
|
+
private _disposables;
|
|
5743
|
+
/** The number of registered disposables */
|
|
5744
|
+
get size(): number;
|
|
5745
|
+
/**
|
|
5746
|
+
* Register a disposable resource. Accepts:
|
|
5747
|
+
* - An {@link IDisposable} object (has a `dispose()` method) — e.g. from {@link on}
|
|
5748
|
+
* - A cleanup function (e.g. return value of `EventList.on()`)
|
|
5749
|
+
* - `null` or `undefined` (safe no-op for conditional subscriptions)
|
|
5750
|
+
*
|
|
5751
|
+
* When {@link dispose} is called, all registered resources are cleaned up.
|
|
5752
|
+
*
|
|
5753
|
+
* @param disposable The resource to register for disposal
|
|
5754
|
+
*
|
|
5755
|
+
* @example
|
|
5756
|
+
* ```ts
|
|
5757
|
+
* const store = new DisposableStore();
|
|
5758
|
+
*
|
|
5759
|
+
* // IDisposable object from on()
|
|
5760
|
+
* store.add(on(window, "resize", handler));
|
|
5761
|
+
*
|
|
5762
|
+
* // Function returned by EventList.on()
|
|
5763
|
+
* store.add(myEvent.on(handler));
|
|
5764
|
+
*
|
|
5765
|
+
* // Raw cleanup function
|
|
5766
|
+
* store.add(() => connection.close());
|
|
5767
|
+
*
|
|
5768
|
+
* // Conditional — safe with undefined
|
|
5769
|
+
* store.add(this.maybeEvent?.on(handler));
|
|
5770
|
+
* ```
|
|
5771
|
+
*/
|
|
5772
|
+
add(disposable: IDisposable | DisposeFn | Function | null | undefined): void;
|
|
5773
|
+
/**
|
|
5774
|
+
* Dispose all registered resources. Each registered disposable is cleaned up,
|
|
5775
|
+
* then the internal list is cleared. The store can be reused after disposal.
|
|
5776
|
+
*
|
|
5777
|
+
* Called automatically by the engine when a component's `onDisable` lifecycle fires.
|
|
5778
|
+
*/
|
|
5779
|
+
dispose(): void;
|
|
5780
|
+
}
|
|
5781
|
+
|
|
5782
|
+
/** A function that performs cleanup when called */
|
|
5783
|
+
export declare type DisposeFn = () => void;
|
|
5784
|
+
|
|
5376
5785
|
/** Recursive disposes all referenced resources by this object. Does not traverse children */
|
|
5377
5786
|
export declare function disposeObjectResources(obj: object | null | undefined): void;
|
|
5378
5787
|
|
|
@@ -5480,6 +5889,12 @@ export declare class DragControls extends Component implements IPointerEventHand
|
|
|
5480
5889
|
* providing visual feedback about the object's position relative to surfaces below it.
|
|
5481
5890
|
*/
|
|
5482
5891
|
showGizmo: boolean;
|
|
5892
|
+
/** Invoked once when a drag begins (after the minimum drag distance threshold is met). */
|
|
5893
|
+
dragStarted: EventList;
|
|
5894
|
+
/** Invoked every frame while the object is being dragged. */
|
|
5895
|
+
dragUpdated: EventList;
|
|
5896
|
+
/** Invoked once when the last pointer is released and the drag ends. */
|
|
5897
|
+
dragEnded: EventList;
|
|
5483
5898
|
/**
|
|
5484
5899
|
* Returns the object currently being dragged by this DragControls component, if any.
|
|
5485
5900
|
* @returns The object being dragged or null if no object is currently dragged
|
|
@@ -5920,6 +6335,45 @@ export declare class EnvironmentScene extends Scene {
|
|
|
5920
6335
|
createAreaLightMaterial(intensity: number): MeshBasicMaterial;
|
|
5921
6336
|
}
|
|
5922
6337
|
|
|
6338
|
+
/** An Euler value, either as a Three.js Euler or as a `[x, y, z]` tuple (radians) */
|
|
6339
|
+
declare type EulerValue = Euler | [number, number, number];
|
|
6340
|
+
|
|
6341
|
+
/** Typed event bus. Known {@link ContextEventMap} events get full autocomplete.
|
|
6342
|
+
* Custom events can be typed at the call site via generic parameter.
|
|
6343
|
+
* @example Known events
|
|
6344
|
+
* ```ts
|
|
6345
|
+
* context.events.on("scene-content-changed", e => e.object);
|
|
6346
|
+
* ```
|
|
6347
|
+
* @example Custom events — type at call site
|
|
6348
|
+
* ```ts
|
|
6349
|
+
* context.events.emit<{ pts: number }>("scored", { pts: 10 });
|
|
6350
|
+
* context.events.on<{ pts: number }>("scored", e => e.pts);
|
|
6351
|
+
* ```
|
|
6352
|
+
* @example Once
|
|
6353
|
+
* ```ts
|
|
6354
|
+
* context.events.on("scene-content-changed", e => { ... }, { once: true });
|
|
6355
|
+
* ```
|
|
6356
|
+
*/
|
|
6357
|
+
export declare class EventBus {
|
|
6358
|
+
private _listeners;
|
|
6359
|
+
/** Emit a known {@link ContextEventMap} event */
|
|
6360
|
+
emit<K extends keyof ContextEventMap & string>(type: K, detail?: ContextEventMap[K]): void;
|
|
6361
|
+
/** Emit a custom event with user-provided type */
|
|
6362
|
+
emit<T>(type: string, detail?: T): void;
|
|
6363
|
+
/** Subscribe to a known {@link ContextEventMap} event. Returns an unsubscribe function. */
|
|
6364
|
+
on<K extends keyof ContextEventMap & string>(type: K, callback: (args: ContextEventMap[K]) => void, options?: EventBusListenerOptions): () => void;
|
|
6365
|
+
/** Subscribe to a custom event with user-provided type. Returns an unsubscribe function. */
|
|
6366
|
+
on<T>(type: string, callback: (args: T) => void, options?: EventBusListenerOptions): () => void;
|
|
6367
|
+
/** Remove all listeners. Called when the context is cleared or destroyed. */
|
|
6368
|
+
clear(): void;
|
|
6369
|
+
}
|
|
6370
|
+
|
|
6371
|
+
/** Options for {@link EventBus.on}. */
|
|
6372
|
+
export declare interface EventBusListenerOptions {
|
|
6373
|
+
/** If true the listener is automatically removed after the first invocation. */
|
|
6374
|
+
once?: boolean;
|
|
6375
|
+
}
|
|
6376
|
+
|
|
5923
6377
|
/**
|
|
5924
6378
|
* EventList manages a list of callbacks that can be invoked together.
|
|
5925
6379
|
* Used for Unity-style events that can be configured in the editor (Unity or Blender).
|
|
@@ -5966,13 +6420,9 @@ export declare class EnvironmentScene extends Scene {
|
|
|
5966
6420
|
* @see {@link Button} for UI button events
|
|
5967
6421
|
*/
|
|
5968
6422
|
export declare class EventList<TArgs extends any = any> implements IEventList {
|
|
6423
|
+
$serializedTypes: Record<string, any>;
|
|
5969
6424
|
/** checked during instantiate to create a new instance */
|
|
5970
6425
|
readonly isEventList = true;
|
|
5971
|
-
/* Excluded from this release type: __internalOnInstantiate */
|
|
5972
|
-
private target?;
|
|
5973
|
-
private key?;
|
|
5974
|
-
/** set an event target to try invoke the EventTarget dispatchEvent when this EventList is invoked */
|
|
5975
|
-
setEventTarget(key: string, target: object): void;
|
|
5976
6426
|
/** How many callback methods are subscribed to this event */
|
|
5977
6427
|
get listenerCount(): number;
|
|
5978
6428
|
/** If the event is currently being invoked */
|
|
@@ -6005,13 +6455,41 @@ export declare class EventList<TArgs extends any = any> implements IEventList {
|
|
|
6005
6455
|
invoke(...args: Array<TArgs>): boolean;
|
|
6006
6456
|
/** Add a new event listener to this event
|
|
6007
6457
|
* @returns a function to remove the event listener
|
|
6458
|
+
* @see {@link removeEventListener} for more details and return value information
|
|
6459
|
+
* @see {@link off} for an alias with better readability when unsubscribing from events
|
|
6460
|
+
* @example
|
|
6461
|
+
* ```ts
|
|
6462
|
+
* const off = myEvent.addEventListener(args => console.log("Clicked!", args));
|
|
6463
|
+
* // later
|
|
6464
|
+
* off();
|
|
6465
|
+
* ```
|
|
6008
6466
|
*/
|
|
6009
6467
|
addEventListener(callback: (args: TArgs) => void): Function;
|
|
6468
|
+
/**
|
|
6469
|
+
* Alias for addEventListener for better readability when subscribing to events. You can use it like this:
|
|
6470
|
+
* ```ts
|
|
6471
|
+
* myEvent.on(args => console.log("Clicked!", args));
|
|
6472
|
+
* ```
|
|
6473
|
+
* @returns a function to remove the event listener
|
|
6474
|
+
* @see {@link addEventListener} for more details and return value information
|
|
6475
|
+
*/
|
|
6476
|
+
on(callback: (args: TArgs) => void): Function;
|
|
6010
6477
|
/**
|
|
6011
6478
|
* Remove an event listener from this event.
|
|
6012
6479
|
* @returns true if the event listener was found and removed, false otherwise
|
|
6013
6480
|
*/
|
|
6014
6481
|
removeEventListener(fn: Function | null | undefined): boolean;
|
|
6482
|
+
/**
|
|
6483
|
+
* Alias for removeEventListener for better readability when unsubscribing from events. You can use it like this:
|
|
6484
|
+
* ```ts
|
|
6485
|
+
* const off = myEvent.on(args => console.log("Clicked!", args));
|
|
6486
|
+
* // later
|
|
6487
|
+
* off();
|
|
6488
|
+
* ```
|
|
6489
|
+
*
|
|
6490
|
+
* @see {@link removeEventListener} for more details and return value information
|
|
6491
|
+
*/
|
|
6492
|
+
off(callback: Function | null | undefined): boolean;
|
|
6015
6493
|
/**
|
|
6016
6494
|
* Remove all event listeners from this event. Use with caution! This will remove all listeners!
|
|
6017
6495
|
*/
|
|
@@ -6042,6 +6520,7 @@ declare type EventListenerOptions_2 = {
|
|
|
6042
6520
|
signal?: AbortSignal;
|
|
6043
6521
|
};
|
|
6044
6522
|
|
|
6523
|
+
/** @deprecated No longer automatically dispatched. Use `eventList.on()` directly instead. */
|
|
6045
6524
|
export declare class EventListEvent<TArgs extends any> extends Event {
|
|
6046
6525
|
args?: TArgs;
|
|
6047
6526
|
}
|
|
@@ -6495,7 +6974,7 @@ declare type FitParameters = {
|
|
|
6495
6974
|
* @see {@link HingeJoint} for rotating connections
|
|
6496
6975
|
*/
|
|
6497
6976
|
export declare class FixedJoint extends Joint {
|
|
6498
|
-
protected createJoint(self: Rigidbody, other: Rigidbody):
|
|
6977
|
+
protected createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
6499
6978
|
}
|
|
6500
6979
|
|
|
6501
6980
|
declare type FocusRect = DOMRect | Element | {
|
|
@@ -7679,14 +8158,8 @@ export declare type GuidsMap = {
|
|
|
7679
8158
|
[key: string]: string;
|
|
7680
8159
|
};
|
|
7681
8160
|
|
|
7682
|
-
/* Excluded from this release type: hasCommercialLicense */
|
|
7683
|
-
|
|
7684
|
-
/* Excluded from this release type: hasIndieLicense */
|
|
7685
|
-
|
|
7686
8161
|
/* Excluded from this release type: hasPointerEventComponent */
|
|
7687
8162
|
|
|
7688
|
-
/* Excluded from this release type: hasProLicense */
|
|
7689
|
-
|
|
7690
8163
|
export declare function hideDebugConsole(): void;
|
|
7691
8164
|
|
|
7692
8165
|
export declare enum HideFlags {
|
|
@@ -7746,7 +8219,7 @@ export declare class HingeJoint extends Joint {
|
|
|
7746
8219
|
anchor?: Vector3;
|
|
7747
8220
|
/** Axis of rotation for the hinge (e.g., Vector3(0,1,0) for vertical axis) */
|
|
7748
8221
|
axis?: Vector3;
|
|
7749
|
-
protected createJoint(self: Rigidbody, other: Rigidbody):
|
|
8222
|
+
protected createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
7750
8223
|
}
|
|
7751
8224
|
|
|
7752
8225
|
declare type HitPointObject = Object3D & {
|
|
@@ -7969,7 +8442,7 @@ declare const HTMLElementBase: typeof HTMLElement;
|
|
|
7969
8442
|
|
|
7970
8443
|
export declare type IAnimationComponent = Pick<IComponent, "gameObject"> & {
|
|
7971
8444
|
isAnimationComponent: boolean;
|
|
7972
|
-
addClip?(clip: AnimationClip):
|
|
8445
|
+
addClip?(clip: AnimationClip): void;
|
|
7973
8446
|
};
|
|
7974
8447
|
|
|
7975
8448
|
/* Excluded from this release type: IApplyPrototypeExtension */
|
|
@@ -8043,6 +8516,12 @@ export declare interface ICollider extends IComponent {
|
|
|
8043
8516
|
* Default: undefined
|
|
8044
8517
|
*/
|
|
8045
8518
|
filter?: number[];
|
|
8519
|
+
/** The density of the collider used for automatic mass calculation.
|
|
8520
|
+
* When the attached Rigidbody has `autoMass` enabled, the mass is computed as `density × volume`.
|
|
8521
|
+
* Note: Make sure to call updateProperties after having changed this property
|
|
8522
|
+
* Default: undefined (uses physics engine default of 1.0)
|
|
8523
|
+
*/
|
|
8524
|
+
density?: number;
|
|
8046
8525
|
}
|
|
8047
8526
|
|
|
8048
8527
|
export declare type ICollisionContext = {
|
|
@@ -8069,7 +8548,6 @@ export declare interface IComponent extends IHasGuid {
|
|
|
8069
8548
|
/* Excluded from this release type: __internalEnable */
|
|
8070
8549
|
/* Excluded from this release type: __internalDisable */
|
|
8071
8550
|
/* Excluded from this release type: __internalDestroy */
|
|
8072
|
-
/* Excluded from this release type: resolveGuids */
|
|
8073
8551
|
/** experimental, called when the script is registered for the first time, this is called even if the component is not enabled. */
|
|
8074
8552
|
registering?(): any;
|
|
8075
8553
|
awake(): any;
|
|
@@ -8106,6 +8584,24 @@ export declare interface IConnectionData {
|
|
|
8106
8584
|
|
|
8107
8585
|
export declare type IContext = Context;
|
|
8108
8586
|
|
|
8587
|
+
/**
|
|
8588
|
+
* Interface for objects that hold resources and can be disposed.
|
|
8589
|
+
* Implement this interface on any object that needs deterministic cleanup.
|
|
8590
|
+
*
|
|
8591
|
+
* @example
|
|
8592
|
+
* ```ts
|
|
8593
|
+
* class MyResource implements IDisposable {
|
|
8594
|
+
* dispose() { /* release resources *\/ }
|
|
8595
|
+
* }
|
|
8596
|
+
* ```
|
|
8597
|
+
*
|
|
8598
|
+
* @category Utilities
|
|
8599
|
+
* @group Lifecycle
|
|
8600
|
+
*/
|
|
8601
|
+
export declare interface IDisposable {
|
|
8602
|
+
dispose(): void;
|
|
8603
|
+
}
|
|
8604
|
+
|
|
8109
8605
|
/** Implement to receive callbacks from {@type @needle-tools/editor-sync} package */
|
|
8110
8606
|
declare interface IEditorModification {
|
|
8111
8607
|
/**
|
|
@@ -8125,7 +8621,6 @@ export declare interface IEffectProvider {
|
|
|
8125
8621
|
|
|
8126
8622
|
export declare interface IEventList {
|
|
8127
8623
|
readonly isEventList: true;
|
|
8128
|
-
__internalOnInstantiate(map: InstantiateContext): IEventList;
|
|
8129
8624
|
}
|
|
8130
8625
|
|
|
8131
8626
|
export declare interface IGameObject extends Object3D {
|
|
@@ -8418,13 +8913,45 @@ export declare interface INeedleXRSessionEventReceiver extends Pick<IComponent,
|
|
|
8418
8913
|
export declare interface INetworkConnection {
|
|
8419
8914
|
get isConnected(): boolean;
|
|
8420
8915
|
get isInRoom(): boolean;
|
|
8421
|
-
send(key: string, data
|
|
8916
|
+
send(key: string, data?: IModel | object | boolean | string | number, queue?: SendQueue): unknown;
|
|
8422
8917
|
}
|
|
8423
8918
|
|
|
8424
8919
|
export declare interface INetworkingWebsocketUrlProvider {
|
|
8425
8920
|
getWebsocketUrl(): string | null;
|
|
8426
8921
|
}
|
|
8427
8922
|
|
|
8923
|
+
/**
|
|
8924
|
+
* @experimental
|
|
8925
|
+
* Interface for a network transport layer used by {@link NetworkConnection}.
|
|
8926
|
+
* The default implementation wraps a websocket via `websocket-ts`.
|
|
8927
|
+
* Custom implementations can be injected into {@link NetworkConnection.connect}
|
|
8928
|
+
* for testing or alternative transports.
|
|
8929
|
+
*
|
|
8930
|
+
* **Lifecycle:** After creating a transport and passing it to `connect()`,
|
|
8931
|
+
* `NetworkConnection` sets the four event callbacks (`onOpen`, `onClose`,
|
|
8932
|
+
* `onError`, `onMessage`) and then calls {@link start}. The transport
|
|
8933
|
+
* should call `onOpen` when the connection is ready.
|
|
8934
|
+
*/
|
|
8935
|
+
export declare interface INetworkTransport {
|
|
8936
|
+
/** Start the connection. Called by NetworkConnection after event callbacks are set.
|
|
8937
|
+
* May return a promise if setup is async (e.g. dynamic imports). */
|
|
8938
|
+
start(): void | Promise<void>;
|
|
8939
|
+
/** Send data (string for JSON messages, Uint8Array for binary) */
|
|
8940
|
+
send(data: string | Uint8Array): void;
|
|
8941
|
+
/** Close the transport */
|
|
8942
|
+
close(): void | Promise<void>;
|
|
8943
|
+
/** The URL this transport is connected to, if applicable */
|
|
8944
|
+
readonly url: string | undefined;
|
|
8945
|
+
/** Called when the transport connection opens */
|
|
8946
|
+
onOpen: (() => void) | null;
|
|
8947
|
+
/** Called when the transport connection closes */
|
|
8948
|
+
onClose: (() => void) | null;
|
|
8949
|
+
/** Called when an error occurs */
|
|
8950
|
+
onError: ((err: any) => void) | null;
|
|
8951
|
+
/** Called when a message is received. Data is either a string (JSON) or Blob (binary). */
|
|
8952
|
+
onMessage: ((data: string | Blob) => void) | null;
|
|
8953
|
+
}
|
|
8954
|
+
|
|
8428
8955
|
export declare class InheritVelocityModule {
|
|
8429
8956
|
enabled: boolean;
|
|
8430
8957
|
curve: MinMaxCurve;
|
|
@@ -8511,14 +9038,33 @@ export declare class Input implements IInput {
|
|
|
8511
9038
|
*/
|
|
8512
9039
|
private readonly _eventListeners;
|
|
8513
9040
|
/** Adds an event listener for the specified event type. The callback will be called when the event is triggered.
|
|
9041
|
+
*
|
|
9042
|
+
* Returns an unsubscribe function — call it to remove the listener.
|
|
9043
|
+
* Pass it to {@link Behaviour.autoCleanup} for automatic lifecycle management.
|
|
9044
|
+
*
|
|
8514
9045
|
* @param type The event type to listen for
|
|
8515
9046
|
* @param callback The callback to call when the event is triggered
|
|
8516
9047
|
* @param options The options for adding the event listener.
|
|
8517
|
-
* @
|
|
9048
|
+
* @returns A function that removes the event listener when called.
|
|
9049
|
+
*
|
|
9050
|
+
* @example With autoCleanup (recommended)
|
|
8518
9051
|
* ```ts
|
|
8519
|
-
*
|
|
9052
|
+
* export class MyComponent extends Behaviour {
|
|
9053
|
+
* onEnable() {
|
|
9054
|
+
* this.autoCleanup(this.context.input.addEventListener("pointerdown", (evt) => {
|
|
9055
|
+
* console.log("Pointer down", evt.pointerId, evt.pointerType);
|
|
9056
|
+
* }));
|
|
9057
|
+
* }
|
|
9058
|
+
* // Listener is automatically removed on disable — no manual cleanup needed!
|
|
9059
|
+
* }
|
|
9060
|
+
* ```
|
|
9061
|
+
* @example Manual unsubscribe
|
|
9062
|
+
* ```ts
|
|
9063
|
+
* const off = input.addEventListener("pointerdown", (evt) => {
|
|
8520
9064
|
* console.log("Pointer down", evt.pointerId, evt.pointerType);
|
|
8521
9065
|
* });
|
|
9066
|
+
* // later
|
|
9067
|
+
* off();
|
|
8522
9068
|
* ```
|
|
8523
9069
|
* @example Adding a listener that is called after all other listeners
|
|
8524
9070
|
* By using a higher value for the queue the listener will be called after other listeners (default queue is 0).
|
|
@@ -8534,8 +9080,8 @@ export declare class Input implements IInput {
|
|
|
8534
9080
|
* }, { once: true });
|
|
8535
9081
|
* ```
|
|
8536
9082
|
*/
|
|
8537
|
-
addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2):
|
|
8538
|
-
addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2):
|
|
9083
|
+
addEventListener(type: PointerEventNames, callback: PointerEventListener, options?: EventListenerOptions_2): () => void;
|
|
9084
|
+
addEventListener(type: KeyboardEventNames, callback: KeyboardEventListener, options?: EventListenerOptions_2): () => void;
|
|
8539
9085
|
/** Removes the event listener from the specified event type. If no queue is specified the listener will be removed from all queues.
|
|
8540
9086
|
* @param type The event type to remove the listener from
|
|
8541
9087
|
* @param callback The callback to remove
|
|
@@ -8981,7 +9527,7 @@ export declare function instantiate(instance: AssetReference, opts?: IInstantiat
|
|
|
8981
9527
|
export declare function instantiate(instance: IGameObject | Object3D, opts?: IInstantiateOptions | null): IGameObject;
|
|
8982
9528
|
|
|
8983
9529
|
/**
|
|
8984
|
-
* Provides access to the instantiated object
|
|
9530
|
+
* Provides access to the instantiated object map (used by EventList etc.)
|
|
8985
9531
|
*/
|
|
8986
9532
|
export declare type InstantiateContext = Readonly<InstantiateReferenceMap>;
|
|
8987
9533
|
|
|
@@ -9021,7 +9567,8 @@ export declare class InstantiateOptions implements IInstantiateOptions {
|
|
|
9021
9567
|
cloneAssign(other: InstantiateOptions | IInstantiateOptions): void;
|
|
9022
9568
|
}
|
|
9023
9569
|
|
|
9024
|
-
|
|
9570
|
+
/** Maps uuid/guid → { original, clone } for Object3D and Component instances */
|
|
9571
|
+
export declare type InstantiateReferenceMap = Record<string, ObjectCloneReference>;
|
|
9025
9572
|
|
|
9026
9573
|
/**
|
|
9027
9574
|
* An empty component that can be used to mark an object as interactable.
|
|
@@ -9092,8 +9639,10 @@ export declare interface IPhysicsEngine {
|
|
|
9092
9639
|
postStep(): any;
|
|
9093
9640
|
/** Indicates whether the physics engine is currently updating */
|
|
9094
9641
|
get isUpdating(): boolean;
|
|
9095
|
-
/**
|
|
9096
|
-
|
|
9642
|
+
/** Tears down the physics world and frees all resources. The world will be re-created on next use. */
|
|
9643
|
+
dispose(): void;
|
|
9644
|
+
/** @deprecated Use {@link dispose} instead. */
|
|
9645
|
+
clearCaches(): void;
|
|
9097
9646
|
/** Enables or disables the physics engine */
|
|
9098
9647
|
enabled: boolean;
|
|
9099
9648
|
/** Returns the underlying physics world object */
|
|
@@ -9140,6 +9689,11 @@ export declare interface IPhysicsEngine {
|
|
|
9140
9689
|
* @returns False to ignore this collider, true to include it
|
|
9141
9690
|
*/
|
|
9142
9691
|
filterPredicate?: (collider: ICollider) => boolean;
|
|
9692
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
9693
|
+
* By default trigger colliders are skipped.
|
|
9694
|
+
* @default false
|
|
9695
|
+
*/
|
|
9696
|
+
includeTriggers?: boolean;
|
|
9143
9697
|
}): RaycastResult;
|
|
9144
9698
|
/**
|
|
9145
9699
|
* Performs a raycast that also returns the normal vector at the hit point
|
|
@@ -9167,6 +9721,11 @@ export declare interface IPhysicsEngine {
|
|
|
9167
9721
|
* @returns False to ignore this collider, true to include it
|
|
9168
9722
|
*/
|
|
9169
9723
|
filterPredicate?: (collider: ICollider) => boolean;
|
|
9724
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
9725
|
+
* By default trigger colliders are skipped.
|
|
9726
|
+
* @default false
|
|
9727
|
+
*/
|
|
9728
|
+
includeTriggers?: boolean;
|
|
9170
9729
|
}): RaycastResult;
|
|
9171
9730
|
/**
|
|
9172
9731
|
* Finds all colliders within a sphere
|
|
@@ -9323,8 +9882,9 @@ export declare interface IPhysicsEngine {
|
|
|
9323
9882
|
* @returns The underlying physics body or null if not found
|
|
9324
9883
|
*/
|
|
9325
9884
|
getBody(obj: ICollider | IRigidbody): null | any;
|
|
9326
|
-
addFixedJoint(body1: IRigidbody, body2: IRigidbody): any;
|
|
9327
|
-
addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): any;
|
|
9885
|
+
addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<any> | any;
|
|
9886
|
+
addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: Vec3, axis: Vec3): Promise<any> | any;
|
|
9887
|
+
removeJoint(joint: any): void;
|
|
9328
9888
|
/** Enable to render collider shapes */
|
|
9329
9889
|
debugRenderColliders: boolean;
|
|
9330
9890
|
/** Enable to visualize raycasts in the scene with gizmos */
|
|
@@ -9545,6 +10105,18 @@ export declare function isDestroyed(go: Object3D): boolean;
|
|
|
9545
10105
|
/** True when the application runs on a local url */
|
|
9546
10106
|
export declare function isDevEnvironment(): boolean;
|
|
9547
10107
|
|
|
10108
|
+
/**
|
|
10109
|
+
* Type guard to check if an object implements {@link IDisposable}.
|
|
10110
|
+
*
|
|
10111
|
+
* @example
|
|
10112
|
+
* ```ts
|
|
10113
|
+
* if (isDisposable(obj)) {
|
|
10114
|
+
* obj.dispose(); // safe to call
|
|
10115
|
+
* }
|
|
10116
|
+
* ```
|
|
10117
|
+
*/
|
|
10118
|
+
export declare function isDisposable(value: unknown): value is IDisposable;
|
|
10119
|
+
|
|
9548
10120
|
export declare function isDisposed(obj: object): boolean;
|
|
9549
10121
|
|
|
9550
10122
|
export declare interface ISerializable {
|
|
@@ -9579,6 +10151,10 @@ export declare function isHotReloadEnabled(): boolean;
|
|
|
9579
10151
|
/**@returns true if the element is an needle engine icon element */
|
|
9580
10152
|
export declare function isIconElement(element: Node): boolean;
|
|
9581
10153
|
|
|
10154
|
+
export declare interface ISignalReceiver {
|
|
10155
|
+
readonly isSignalReceiver: true;
|
|
10156
|
+
}
|
|
10157
|
+
|
|
9582
10158
|
/** @deprecated use {@link DeviceUtilities.isiOS} instead */
|
|
9583
10159
|
export declare function isiOS(): boolean;
|
|
9584
10160
|
|
|
@@ -9613,6 +10189,8 @@ export declare function isResourceTrackingEnabled(): boolean;
|
|
|
9613
10189
|
/** @deprecated use {@link DeviceUtilities.isSafari} instead */
|
|
9614
10190
|
export declare function isSafari(): boolean;
|
|
9615
10191
|
|
|
10192
|
+
export declare function isTrackModel(obj: unknown): obj is TrackModel;
|
|
10193
|
+
|
|
9616
10194
|
export declare function isUsingInstancing(instance: Object3D): boolean;
|
|
9617
10195
|
|
|
9618
10196
|
export declare interface ITime {
|
|
@@ -9737,7 +10315,9 @@ declare abstract class Joint extends Component {
|
|
|
9737
10315
|
connectedBody?: Rigidbody;
|
|
9738
10316
|
get rigidBody(): Rigidbody | null;
|
|
9739
10317
|
private _rigidBody;
|
|
10318
|
+
private _jointHandle;
|
|
9740
10319
|
onEnable(): void;
|
|
10320
|
+
onDisable(): void;
|
|
9741
10321
|
private create;
|
|
9742
10322
|
protected abstract createJoint(self: Rigidbody, other: Rigidbody): any;
|
|
9743
10323
|
}
|
|
@@ -9779,6 +10359,15 @@ declare class Keyframe_2 {
|
|
|
9779
10359
|
}
|
|
9780
10360
|
export { Keyframe_2 as Keyframe }
|
|
9781
10361
|
|
|
10362
|
+
/** Keyframe array or tween shorthand */
|
|
10363
|
+
declare type KF<V> = AnimationKeyframe<V>[] | Tween<V>;
|
|
10364
|
+
|
|
10365
|
+
/** Keyframe array or tween shorthand */
|
|
10366
|
+
declare type KF_2<V> = AnimationKeyframe<V>[] | Tween<V>;
|
|
10367
|
+
|
|
10368
|
+
/** Keyframe array or tween shorthand */
|
|
10369
|
+
declare type KF_3<V> = AnimationKeyframe<V>[] | Tween<V>;
|
|
10370
|
+
|
|
9782
10371
|
declare type LabelHandle = {
|
|
9783
10372
|
setText(str: string): any;
|
|
9784
10373
|
};
|
|
@@ -10447,13 +11036,15 @@ export declare function markAsInstancedRendered(go: Object3D, instanced: boolean
|
|
|
10447
11036
|
time: number;
|
|
10448
11037
|
}
|
|
10449
11038
|
|
|
10450
|
-
|
|
10451
|
-
|
|
10452
|
-
|
|
10453
|
-
|
|
10454
|
-
|
|
10455
|
-
|
|
10456
|
-
|
|
11039
|
+
/**
|
|
11040
|
+
* Builder for marker tracks. Provides `.marker()` for adding markers.
|
|
11041
|
+
* @category Animation and Sequencing
|
|
11042
|
+
*/
|
|
11043
|
+
export declare interface MarkerTrackBuilder extends TimelineBuilderBase {
|
|
11044
|
+
/** Adds a marker referencing a signal asset by guid */
|
|
11045
|
+
marker(time: number, asset: string, options?: SignalMarkerOptions): MarkerTrackBuilder;
|
|
11046
|
+
/** Mutes this track so it is skipped during playback */
|
|
11047
|
+
muted(muted?: boolean): MarkerTrackBuilder;
|
|
10457
11048
|
}
|
|
10458
11049
|
|
|
10459
11050
|
export declare enum MarkerType {
|
|
@@ -10999,6 +11590,7 @@ export declare type Model = (GLTF | FBX | OBJ | CustomModel);
|
|
|
10999
11590
|
|
|
11000
11591
|
declare namespace Models {
|
|
11001
11592
|
export {
|
|
11593
|
+
isTrackModel,
|
|
11002
11594
|
TimelineAssetModel,
|
|
11003
11595
|
TrackType,
|
|
11004
11596
|
ClipExtrapolation,
|
|
@@ -11206,11 +11798,17 @@ export declare interface NeedleEngineAttributes {
|
|
|
11206
11798
|
'hash': string;
|
|
11207
11799
|
/** Set to automatically add OrbitControls to the loaded scene. */
|
|
11208
11800
|
'camera-controls': string;
|
|
11209
|
-
/** Override the default
|
|
11801
|
+
/** Override the default Draco decoder/decompressor path. Can be a URL or a local path to a directory containing the Draco decoder files.
|
|
11802
|
+
* @default "https://www.gstatic.com/draco/versioned/decoders/1.5.7/"
|
|
11803
|
+
* @example <needle-engine dracoDecoderPath="./decoders/draco/"></needle-engine>
|
|
11804
|
+
*/
|
|
11210
11805
|
'dracoDecoderPath': string;
|
|
11211
|
-
/** Override the default
|
|
11806
|
+
/** Override the default Draco decoder type. */
|
|
11212
11807
|
'dracoDecoderType': 'wasm' | 'js';
|
|
11213
|
-
/** Override the default KTX2 transcoder/decoder path.
|
|
11808
|
+
/** Override the default KTX2 transcoder/decoder path. Can be a URL or a local path to a directory containing the KTX2 transcoder files.
|
|
11809
|
+
* @default "https://cdn.needle.tools/static/three/0.179.1/basis2/"
|
|
11810
|
+
* @example <needle-engine ktx2DecoderPath="./decoders/ktx2/"></needle-engine>
|
|
11811
|
+
*/
|
|
11214
11812
|
'ktx2DecoderPath': string;
|
|
11215
11813
|
/** Prevent context from being disposed when element is removed from DOM. */
|
|
11216
11814
|
'keep-alive': 'true' | 'false';
|
|
@@ -12164,8 +12762,7 @@ export declare class NeedleXRSession implements INeedleXRSession {
|
|
|
12164
12762
|
get referenceSpace(): XRSpace | null;
|
|
12165
12763
|
/** @returns the XRFrame `viewerpose` using the xr `referenceSpace` */
|
|
12166
12764
|
get viewerPose(): XRViewerPose | undefined;
|
|
12167
|
-
/** @returns `true` if any image is currently being tracked */
|
|
12168
|
-
/** returns true if images are currently being tracked */
|
|
12765
|
+
/** @returns `true` if any image is currently being tracked or emulated */
|
|
12169
12766
|
get isTrackingImages(): boolean;
|
|
12170
12767
|
/** The currently active XR rig */
|
|
12171
12768
|
get rig(): IXRRig | null;
|
|
@@ -12211,6 +12808,8 @@ export declare class NeedleXRSession implements INeedleXRSession {
|
|
|
12211
12808
|
private readonly _xr_update_scripts;
|
|
12212
12809
|
/** scripts that are in the scene but inactive (e.g. disabled parent gameObject) */
|
|
12213
12810
|
private readonly _inactive_scripts;
|
|
12811
|
+
/** tracks scripts that have received onEnterXR — prevents spurious onLeaveXR calls */
|
|
12812
|
+
private readonly _scripts_in_xr;
|
|
12214
12813
|
private readonly _controllerAdded;
|
|
12215
12814
|
private readonly _controllerRemoved;
|
|
12216
12815
|
private readonly _originalCameraWorldPosition?;
|
|
@@ -12598,7 +13197,7 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12598
13197
|
/** 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) */
|
|
12599
13198
|
leaveRoom(room?: string | null): boolean;
|
|
12600
13199
|
/** Send a message to the networking backend - it will be broadcasted to all connected users (except yourself) in the same room by default */
|
|
12601
|
-
send<K extends NetworkEventKey>(key: K, data?: (K extends keyof NetworkEventMap ? NetworkEventData<K> : WebsocketSendType)
|
|
13200
|
+
send<K extends NetworkEventKey>(key: K, data?: (K extends keyof NetworkEventMap ? NetworkEventData<K> : WebsocketSendType), queue?: SendQueue): void;
|
|
12602
13201
|
/**
|
|
12603
13202
|
* Deletes the network state for a specific object on the server.
|
|
12604
13203
|
* This removes the object's state from the room, preventing it from being sent to newly joining users.
|
|
@@ -12620,61 +13219,69 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12620
13219
|
private _defaultMessagesBufferArray;
|
|
12621
13220
|
sendBufferedMessagesNow(): void;
|
|
12622
13221
|
/** Use to start listening to networking events.
|
|
12623
|
-
*
|
|
13222
|
+
* Returns an unsubscribe function that removes the listener when called.
|
|
13223
|
+
* The returned function can also be passed to {@link stopListen} or {@link Component.autoCleanup} for automatic lifecycle management.
|
|
12624
13224
|
*
|
|
12625
|
-
* @example
|
|
13225
|
+
* @example With autoCleanup (recommended)
|
|
12626
13226
|
* ```ts
|
|
12627
|
-
*
|
|
12628
|
-
*
|
|
12629
|
-
*
|
|
12630
|
-
*
|
|
13227
|
+
* export class MyComponent extends Behaviour {
|
|
13228
|
+
* onEnable() {
|
|
13229
|
+
* this.autoCleanup(this.context.connection.beginListen("joined-room", () => {
|
|
13230
|
+
* console.log("I joined a networked room");
|
|
13231
|
+
* }));
|
|
13232
|
+
* }
|
|
13233
|
+
* // Automatically unsubscribed on disable — no manual cleanup needed!
|
|
13234
|
+
* }
|
|
12631
13235
|
* ```
|
|
12632
13236
|
*
|
|
12633
|
-
* @example
|
|
13237
|
+
* @example Manual unsubscribe
|
|
13238
|
+
* ```ts
|
|
13239
|
+
* const unsub = this.context.connection.beginListen("joined-room", () => { });
|
|
13240
|
+
* // Later:
|
|
13241
|
+
* unsub(); // removes the listener
|
|
13242
|
+
* ```
|
|
13243
|
+
*
|
|
13244
|
+
* @example With stopListen (legacy pattern, still supported)
|
|
12634
13245
|
* ```ts
|
|
12635
|
-
* // Make sure to unsubscribe from events when the component is disabled
|
|
12636
13246
|
* export class MyComponent extends Behaviour {
|
|
12637
13247
|
* onEnable() {
|
|
12638
|
-
* this.connection.beginListen("joined-room", this.onJoinedRoom)
|
|
13248
|
+
* this.context.connection.beginListen("joined-room", this.onJoinedRoom);
|
|
12639
13249
|
* }
|
|
12640
13250
|
* onDisable() {
|
|
12641
|
-
* this.connection.stopListen("joined-room", this.onJoinedRoom)
|
|
13251
|
+
* this.context.connection.stopListen("joined-room", this.onJoinedRoom);
|
|
12642
13252
|
* }
|
|
12643
13253
|
* onJoinedRoom = () => {
|
|
12644
|
-
*
|
|
13254
|
+
* console.log("I joined a networked room");
|
|
12645
13255
|
* }
|
|
12646
13256
|
* }
|
|
12647
13257
|
* ```
|
|
12648
13258
|
* @link https://engine.needle.tools/docs/networking.html
|
|
12649
13259
|
*
|
|
12650
13260
|
*/
|
|
12651
|
-
beginListen<K extends NetworkEventKey>(key: K, callback: K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void):
|
|
13261
|
+
beginListen<K extends NetworkEventKey>(key: K, callback: K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void): DisposeFn;
|
|
12652
13262
|
/**@deprecated please use stopListen instead (2.65.2-pre) */
|
|
12653
13263
|
stopListening<K extends NetworkEventKey>(key: K, callback: (K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void) | null): void;
|
|
12654
|
-
/** Use to stop listening to networking events
|
|
13264
|
+
/** Use to stop listening to networking events.
|
|
13265
|
+
* Accepts either the original callback or the unsubscribe function returned by {@link beginListen}.
|
|
12655
13266
|
* To subscribe to events use the `{@link beginListen}` method.
|
|
12656
|
-
* See the example below for typical usage:
|
|
12657
13267
|
*
|
|
12658
|
-
*
|
|
13268
|
+
* @example
|
|
12659
13269
|
* ```ts
|
|
12660
|
-
* //
|
|
12661
|
-
*
|
|
12662
|
-
*
|
|
12663
|
-
* this.connection.beginListen("joined-room", this.onJoinedRoom)
|
|
12664
|
-
* }
|
|
12665
|
-
* onDisable() {
|
|
12666
|
-
* this.connection.stopListen("joined-room", this.onJoinedRoom)
|
|
12667
|
-
* }
|
|
12668
|
-
* onJoinedRoom = () => {
|
|
12669
|
-
* console.log("I joined a networked room")
|
|
12670
|
-
* }
|
|
12671
|
-
* }
|
|
13270
|
+
* // Both patterns work:
|
|
13271
|
+
* this.context.connection.stopListen("joined-room", this.onJoinedRoom); // original callback
|
|
13272
|
+
* this.context.connection.stopListen("joined-room", unsub); // unsubscribe fn from beginListen
|
|
12672
13273
|
* ```
|
|
12673
13274
|
*/
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12677
|
-
|
|
13275
|
+
private static _didLogStopListenHint;
|
|
13276
|
+
stopListen<K extends NetworkEventKey>(key: K, callback: (K extends keyof NetworkEventMap ? NetworkEventMap[K] : (...args: any[]) => void) | Function | null): void;
|
|
13277
|
+
/** Use to start listening to networking binary events.
|
|
13278
|
+
* Returns an unsubscribe function that removes the listener when called.
|
|
13279
|
+
* The returned function can also be passed to {@link stopListenBinary} or {@link Component.autoCleanup}.
|
|
13280
|
+
*/
|
|
13281
|
+
beginListenBinary(identifier: string, callback: BinaryCallback): DisposeFn;
|
|
13282
|
+
/** Use to stop listening to networking binary events.
|
|
13283
|
+
* Accepts either the original callback or the unsubscribe function returned by {@link beginListenBinary}.
|
|
13284
|
+
*/
|
|
12678
13285
|
stopListenBinary(identifier: string, callback: any): void;
|
|
12679
13286
|
private netWebSocketUrlProvider?;
|
|
12680
13287
|
/** Use to override the networking server backend url.
|
|
@@ -12683,16 +13290,19 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12683
13290
|
registerProvider(prov: INetworkingWebsocketUrlProvider): void;
|
|
12684
13291
|
/** Used to connect to the networking server
|
|
12685
13292
|
* @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.
|
|
13293
|
+
* @param transport Optional custom transport to use instead of the default websocket. Useful for testing or alternative transports.
|
|
12686
13294
|
*/
|
|
12687
|
-
connect(url?: string): Promise<boolean>;
|
|
13295
|
+
connect(url?: string, transport?: INetworkTransport): Promise<boolean>;
|
|
12688
13296
|
/** Disconnect from the networking backend + reset internal state */
|
|
12689
13297
|
disconnect(): void;
|
|
13298
|
+
/** Full teardown: disconnect, clear all listeners, and release all resources.
|
|
13299
|
+
* Called when the owning Context is destroyed. After dispose(), this instance should not be reused. */
|
|
13300
|
+
dispose(): void;
|
|
12690
13301
|
private _listeners;
|
|
12691
13302
|
private _listenersBinary;
|
|
12692
13303
|
private connected;
|
|
12693
|
-
private channelId;
|
|
12694
13304
|
private _connectionId;
|
|
12695
|
-
private
|
|
13305
|
+
private _transport;
|
|
12696
13306
|
private _waitingForSocket;
|
|
12697
13307
|
private _isInRoom;
|
|
12698
13308
|
private _currentRoomName;
|
|
@@ -12702,6 +13312,8 @@ export declare class NetworkConnection implements INetworkConnection {
|
|
|
12702
13312
|
private _state;
|
|
12703
13313
|
private _currentDelay;
|
|
12704
13314
|
private _connectingToWebsocketPromise;
|
|
13315
|
+
/** Wire up a transport's event callbacks and start it */
|
|
13316
|
+
private connectTransport;
|
|
12705
13317
|
private connectWebsocket;
|
|
12706
13318
|
private onMessage;
|
|
12707
13319
|
private handleIncomingBinaryMessage;
|
|
@@ -12830,7 +13442,7 @@ export declare interface NetworkEventMap {
|
|
|
12830
13442
|
* @see {@link RoomEvents} for room lifecycle events
|
|
12831
13443
|
* @see {@link isLocalNetwork} for local network detection
|
|
12832
13444
|
* @link https://engine.needle.tools/docs/how-to-guides/networking/
|
|
12833
|
-
* @summary
|
|
13445
|
+
* @summary Configures the websocket server URL for multiplayer networking
|
|
12834
13446
|
* @category Networking
|
|
12835
13447
|
* @group Components
|
|
12836
13448
|
*/
|
|
@@ -12967,7 +13579,7 @@ export declare type OBJ = {
|
|
|
12967
13579
|
scenes: Object3D[];
|
|
12968
13580
|
};
|
|
12969
13581
|
|
|
12970
|
-
declare type ObjectCloneReference = {
|
|
13582
|
+
export declare type ObjectCloneReference = {
|
|
12971
13583
|
readonly original: object;
|
|
12972
13584
|
readonly clone: object;
|
|
12973
13585
|
};
|
|
@@ -13174,6 +13786,61 @@ export declare function offXRSessionEnd(fn: (evt: XRSessionEventArgs) => void):
|
|
|
13174
13786
|
*/
|
|
13175
13787
|
export declare function offXRSessionStart(fn: (evt: XRSessionEventArgs) => void): void;
|
|
13176
13788
|
|
|
13789
|
+
/**
|
|
13790
|
+
* @experimental
|
|
13791
|
+
* Subscribe to a DOM event on any {@link EventTarget} (window, document, HTML elements, etc.)
|
|
13792
|
+
* and return an {@link IDisposable} that removes the listener when disposed.
|
|
13793
|
+
*
|
|
13794
|
+
* Provides full TypeScript event type inference — the callback parameter
|
|
13795
|
+
* is automatically typed based on the event name (e.g. `"resize"` → `UIEvent`,
|
|
13796
|
+
* `"click"` → `MouseEvent`).
|
|
13797
|
+
*
|
|
13798
|
+
* Use with {@link DisposableStore.add} for automatic lifecycle cleanup in components.
|
|
13799
|
+
*
|
|
13800
|
+
* @param target The EventTarget to listen on (window, document, an element, etc.)
|
|
13801
|
+
* @param type The event name (e.g. `"resize"`, `"click"`, `"keydown"`)
|
|
13802
|
+
* @param listener The event handler callback
|
|
13803
|
+
* @param options Optional addEventListener options (passive, capture, once, signal)
|
|
13804
|
+
* @returns An {@link IDisposable} that removes the event listener when disposed
|
|
13805
|
+
*
|
|
13806
|
+
* @example Standalone usage
|
|
13807
|
+
* ```ts
|
|
13808
|
+
* import { on } from "@needle-tools/engine";
|
|
13809
|
+
*
|
|
13810
|
+
* const sub = on(window, "resize", (ev) => {
|
|
13811
|
+
* // ev is typed as UIEvent
|
|
13812
|
+
* console.log("resized", ev.target);
|
|
13813
|
+
* });
|
|
13814
|
+
*
|
|
13815
|
+
* // Later: clean up
|
|
13816
|
+
* sub.dispose();
|
|
13817
|
+
* ```
|
|
13818
|
+
*
|
|
13819
|
+
* @example With autoCleanup in a component
|
|
13820
|
+
* ```ts
|
|
13821
|
+
* import { Behaviour, on } from "@needle-tools/engine";
|
|
13822
|
+
*
|
|
13823
|
+
* export class MyComponent extends Behaviour {
|
|
13824
|
+
* onEnable() {
|
|
13825
|
+
* this.autoCleanup(on(window, "resize", (ev) => { /* UIEvent *\/ }));
|
|
13826
|
+
* this.autoCleanup(on(document, "keydown", (ev) => { /* KeyboardEvent *\/ }));
|
|
13827
|
+
* this.autoCleanup(on(this.context.domElement, "click", (ev) => { /* MouseEvent *\/ }));
|
|
13828
|
+
* }
|
|
13829
|
+
* // All listeners removed automatically on disable!
|
|
13830
|
+
* }
|
|
13831
|
+
* ```
|
|
13832
|
+
*
|
|
13833
|
+
* @category Utilities
|
|
13834
|
+
* @group Lifecycle
|
|
13835
|
+
*/
|
|
13836
|
+
export declare function on<K extends keyof WindowEventMap>(target: Window, type: K, listener: (ev: WindowEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13837
|
+
|
|
13838
|
+
export declare function on<K extends keyof DocumentEventMap>(target: Document, type: K, listener: (ev: DocumentEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13839
|
+
|
|
13840
|
+
export declare function on<K extends keyof HTMLElementEventMap>(target: HTMLElement, type: K, listener: (ev: HTMLElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13841
|
+
|
|
13842
|
+
export declare function on(target: EventTarget, type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): IDisposable;
|
|
13843
|
+
|
|
13177
13844
|
/**
|
|
13178
13845
|
* Register a callback in the engine onAfterRender event
|
|
13179
13846
|
* This is called every frame after the main camera has rendered
|
|
@@ -13808,14 +14475,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
13808
14475
|
*/
|
|
13809
14476
|
private setLookTargetFromConstraint;
|
|
13810
14477
|
private lerpLookTarget;
|
|
14478
|
+
private canFocusAtPointer;
|
|
13811
14479
|
private setTargetFromRaycast;
|
|
13812
14480
|
/**
|
|
13813
14481
|
* Fits the camera to show the objects provided (defaults to the scene if no objects are passed in)
|
|
13814
14482
|
* @param options The options for fitting the camera. Use to provide objects to fit to, fit direction and size and other settings.
|
|
13815
14483
|
*/
|
|
13816
14484
|
fitCamera(options?: OrbitFitCameraOptions): any;
|
|
13817
|
-
/** @deprecated Use fitCamera(options) */
|
|
13818
|
-
fitCamera(objects?: Object3D | Array<Object3D>, options?: Omit<OrbitFitCameraOptions, "objects">): any;
|
|
13819
14485
|
private _haveAttachedKeyboardEvents;
|
|
13820
14486
|
}
|
|
13821
14487
|
|
|
@@ -14016,6 +14682,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14016
14682
|
value: number | boolean | string;
|
|
14017
14683
|
};
|
|
14018
14684
|
|
|
14685
|
+
/** Extracts parameter names of a given type from the builder's tracked parameter map */
|
|
14686
|
+
declare type ParamNamesOfType<TParams, PType extends string> = {
|
|
14687
|
+
[K in keyof TParams & string]: TParams[K] extends PType ? K : never;
|
|
14688
|
+
}[keyof TParams & string];
|
|
14689
|
+
|
|
14019
14690
|
declare type ParseNumber<T> = T extends `${infer U extends number}` ? U : never;
|
|
14020
14691
|
|
|
14021
14692
|
/** 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.
|
|
@@ -14647,13 +15318,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14647
15318
|
* The timeline asset containing tracks, clips, and markers that this director will play.
|
|
14648
15319
|
* Assign a timeline asset exported from Unity or Blender to enable playback.
|
|
14649
15320
|
*/
|
|
14650
|
-
playableAsset
|
|
15321
|
+
get playableAsset(): Models.TimelineAssetModel | undefined;
|
|
15322
|
+
set playableAsset(value: Models.TimelineAssetModel | undefined);
|
|
15323
|
+
private _playableAsset?;
|
|
14651
15324
|
/**
|
|
14652
15325
|
* When true, the timeline starts playing automatically when the component awakens.
|
|
14653
15326
|
* Set to false to control playback manually via `play()`.
|
|
14654
15327
|
* @default false
|
|
14655
15328
|
*/
|
|
14656
|
-
playOnAwake
|
|
15329
|
+
playOnAwake: boolean;
|
|
14657
15330
|
/**
|
|
14658
15331
|
* Determines how the timeline behaves when it reaches the end of its duration.
|
|
14659
15332
|
* @default DirectorWrapMode.Loop
|
|
@@ -14731,15 +15404,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14731
15404
|
/** Iterates over all tracks of the timeline
|
|
14732
15405
|
* @returns all tracks of the timeline
|
|
14733
15406
|
*/
|
|
14734
|
-
forEachTrack(): Generator<Tracks.
|
|
15407
|
+
forEachTrack(): Generator<Tracks.TimelineTrackHandler, void, unknown>;
|
|
14735
15408
|
/**
|
|
14736
15409
|
* @returns all animation tracks of the timeline
|
|
14737
15410
|
*/
|
|
14738
|
-
get animationTracks(): Tracks.
|
|
15411
|
+
get animationTracks(): Tracks.TimelineAnimationTrack[];
|
|
14739
15412
|
/**
|
|
14740
15413
|
* @returns all audio tracks of the timeline
|
|
14741
15414
|
*/
|
|
14742
|
-
get audioTracks(): Tracks.
|
|
15415
|
+
get audioTracks(): Tracks.TimelineAudioTrack[];
|
|
14743
15416
|
/**
|
|
14744
15417
|
* @returns all signal tracks of the timeline
|
|
14745
15418
|
*/
|
|
@@ -14747,7 +15420,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14747
15420
|
/**
|
|
14748
15421
|
* @returns all marker tracks of the timeline
|
|
14749
15422
|
*/
|
|
14750
|
-
get markerTracks(): Tracks.
|
|
15423
|
+
get markerTracks(): Tracks.TimelineMarkerTrack[];
|
|
15424
|
+
/**
|
|
15425
|
+
* @returns all activation tracks of the timeline
|
|
15426
|
+
*/
|
|
15427
|
+
get activationTracks(): Tracks.TimelineActivationTrack[];
|
|
15428
|
+
/**
|
|
15429
|
+
* @returns all tracks of the timeline
|
|
15430
|
+
*/
|
|
15431
|
+
get tracks(): ReadonlyArray<Tracks.TimelineTrackHandler>;
|
|
14751
15432
|
/**
|
|
14752
15433
|
* Iterates over all markers of the timeline, optionally filtering by type
|
|
14753
15434
|
*
|
|
@@ -14761,13 +15442,13 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14761
15442
|
*
|
|
14762
15443
|
*/
|
|
14763
15444
|
foreachMarker<T extends Record<string, any>>(type?: string | null): Generator<(T & Models.MarkerModel)>;
|
|
14764
|
-
private
|
|
14765
|
-
/* Excluded from this release type: resolveGuids */
|
|
15445
|
+
private _needsGraphRebuild;
|
|
14766
15446
|
private _isPlaying;
|
|
14767
15447
|
private _internalUpdateRoutine;
|
|
14768
15448
|
private _isPaused;
|
|
14769
15449
|
/** internal, true during the time stop() is being processed */
|
|
14770
15450
|
private _isStopping;
|
|
15451
|
+
/* Excluded from this release type: _isUserEvaluation */
|
|
14771
15452
|
private _time;
|
|
14772
15453
|
private _duration;
|
|
14773
15454
|
private _weight;
|
|
@@ -14776,6 +15457,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
14776
15457
|
private readonly _signalTracks;
|
|
14777
15458
|
private readonly _markerTracks;
|
|
14778
15459
|
private readonly _controlTracks;
|
|
15460
|
+
private readonly _activationTracks;
|
|
14779
15461
|
private readonly _customTracks;
|
|
14780
15462
|
private readonly _tracksArray;
|
|
14781
15463
|
private get _allTracks();
|
|
@@ -15767,6 +16449,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15767
16449
|
w: number;
|
|
15768
16450
|
};
|
|
15769
16451
|
|
|
16452
|
+
/** A Quaternion value, either as a Three.js Quaternion or as a `[x, y, z, w]` tuple */
|
|
16453
|
+
declare type QuatValue = Quaternion | [number, number, number, number];
|
|
16454
|
+
|
|
15770
16455
|
/** Generates a random number
|
|
15771
16456
|
* @deprecated use Mathf.random(min, max)
|
|
15772
16457
|
*/
|
|
@@ -15892,6 +16577,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15892
16577
|
* @default undefined
|
|
15893
16578
|
*/
|
|
15894
16579
|
useIgnoreRaycastLayer?: boolean;
|
|
16580
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
16581
|
+
* By default trigger colliders are skipped.
|
|
16582
|
+
* @default false
|
|
16583
|
+
*/
|
|
16584
|
+
includeTriggers?: boolean;
|
|
15895
16585
|
}): null | {
|
|
15896
16586
|
point: Vector3;
|
|
15897
16587
|
collider: ICollider;
|
|
@@ -15909,6 +16599,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15909
16599
|
* @default undefined
|
|
15910
16600
|
*/
|
|
15911
16601
|
useIgnoreRaycastLayer?: boolean;
|
|
16602
|
+
/** When true, trigger/sensor colliders will be included in the raycast results.
|
|
16603
|
+
* By default trigger colliders are skipped.
|
|
16604
|
+
* @default false
|
|
16605
|
+
*/
|
|
16606
|
+
includeTriggers?: boolean;
|
|
15912
16607
|
}): null | {
|
|
15913
16608
|
point: Vector3;
|
|
15914
16609
|
normal: Vector3;
|
|
@@ -15954,6 +16649,10 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
15954
16649
|
private _gravity;
|
|
15955
16650
|
get gravity(): Vec3;
|
|
15956
16651
|
set gravity(value: Vec3);
|
|
16652
|
+
/** Tears down the physics world and frees all WASM resources.
|
|
16653
|
+
* After calling this, the world will be re-created on next use. */
|
|
16654
|
+
dispose(): void;
|
|
16655
|
+
/** @deprecated Use {@link dispose} instead. */
|
|
15957
16656
|
clearCaches(): void;
|
|
15958
16657
|
addBoxCollider(collider: ICollider, size: Vector3): Promise<void>;
|
|
15959
16658
|
addSphereCollider(collider: ICollider): Promise<void>;
|
|
@@ -16000,7 +16699,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16000
16699
|
private getRigidbodyRelativeMatrix;
|
|
16001
16700
|
private static centerConnectionPos;
|
|
16002
16701
|
private static centerConnectionRot;
|
|
16003
|
-
|
|
16702
|
+
private _jointTempMatrix;
|
|
16703
|
+
addFixedJoint(body1: IRigidbody, body2: IRigidbody): Promise<ImpulseJoint | null>;
|
|
16004
16704
|
/** 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. */
|
|
16005
16705
|
addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: {
|
|
16006
16706
|
x: number;
|
|
@@ -16010,8 +16710,11 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16010
16710
|
x: number;
|
|
16011
16711
|
y: number;
|
|
16012
16712
|
z: number;
|
|
16013
|
-
}):
|
|
16713
|
+
}): Promise<ImpulseJoint | null>;
|
|
16714
|
+
removeJoint(joint: ImpulseJoint): void;
|
|
16715
|
+
/** Compute the relative transform from body1's local space to body2's local space (W2⁻¹ * W1), ignoring scale. */
|
|
16014
16716
|
private calculateJointRelativeMatrices;
|
|
16717
|
+
private normalizeMatrixColumns;
|
|
16015
16718
|
}
|
|
16016
16719
|
|
|
16017
16720
|
/**
|
|
@@ -16814,10 +17517,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16814
17517
|
*/
|
|
16815
17518
|
export declare class Rigidbody extends Component implements IRigidbody {
|
|
16816
17519
|
get isRigidbody(): boolean;
|
|
16817
|
-
/** When true the mass
|
|
17520
|
+
/** When true the mass is automatically computed from the attached colliders using `mass = density × volume`.
|
|
17521
|
+
* Each collider's {@link Collider.density} determines how heavy it contributes to the total mass.
|
|
17522
|
+
* Disable to set mass explicitly via the `mass` property.
|
|
17523
|
+
*/
|
|
16818
17524
|
autoMass: boolean;
|
|
16819
|
-
/**
|
|
16820
|
-
*
|
|
17525
|
+
/** The mass of the rigidbody in kg (when `autoMass` is disabled).
|
|
17526
|
+
* When `autoMass` is enabled, reading this returns the computed mass from `density × volume` of all attached colliders.
|
|
17527
|
+
* Setting this property automatically disables `autoMass`.
|
|
17528
|
+
*
|
|
17529
|
+
* **Prefer using {@link Collider.density}** with `autoMass` enabled instead — density scales
|
|
17530
|
+
* naturally with collider size, while explicit mass stays fixed regardless of shape changes.
|
|
16821
17531
|
*/
|
|
16822
17532
|
set mass(value: number);
|
|
16823
17533
|
get mass(): number;
|
|
@@ -16900,7 +17610,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
16900
17610
|
onEnable(): void;
|
|
16901
17611
|
onDisable(): void;
|
|
16902
17612
|
onDestroy(): void;
|
|
16903
|
-
onValidate(): void;
|
|
17613
|
+
onValidate(property?: string): void;
|
|
17614
|
+
private static _didWarnAutoMass;
|
|
16904
17615
|
beforePhysics(): Generator<undefined, void, unknown>;
|
|
16905
17616
|
/** Teleport the rigidbody to a new position in the world.
|
|
16906
17617
|
* Will reset forces before setting the object world position
|
|
@@ -18120,10 +18831,17 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18120
18831
|
|
|
18121
18832
|
export declare function sendDestroyed(guid: string, con: INetworkConnection, opts?: SyncDestroyOptions): void;
|
|
18122
18833
|
|
|
18834
|
+
/** Controls when a network message is actually sent to the server.
|
|
18835
|
+
* @see {@link NetworkConnection.send}
|
|
18836
|
+
*/
|
|
18123
18837
|
export declare enum SendQueue {
|
|
18838
|
+
/** 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). */
|
|
18124
18839
|
OnConnection = 0,
|
|
18840
|
+
/** Hold the message until the client has joined a room, then send it. Use for messages that require room context. */
|
|
18125
18841
|
OnRoomJoin = 1,
|
|
18842
|
+
/** Buffer the message and send it on the next `sendBufferedMessagesNow()` call (typically once per frame). This is the default for `send()`. */
|
|
18126
18843
|
Queued = 2,
|
|
18844
|
+
/** Send the message to the server immediately without buffering. */
|
|
18127
18845
|
Immediate = 3
|
|
18128
18846
|
}
|
|
18129
18847
|
|
|
@@ -18556,6 +19274,16 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18556
19274
|
asset: string;
|
|
18557
19275
|
}
|
|
18558
19276
|
|
|
19277
|
+
/**
|
|
19278
|
+
* Options for a signal marker in the timeline builder
|
|
19279
|
+
*/
|
|
19280
|
+
export declare type SignalMarkerOptions = {
|
|
19281
|
+
/** Whether the signal should fire if the playback starts past its time (default: false) */
|
|
19282
|
+
retroActive?: boolean;
|
|
19283
|
+
/** Whether the signal should only fire once (default: false) */
|
|
19284
|
+
emitOnce?: boolean;
|
|
19285
|
+
};
|
|
19286
|
+
|
|
18559
19287
|
/** SignalReceiver is a component that listens for signals and invokes a reaction when a signal is received.
|
|
18560
19288
|
* Signals can be added to a signal track on a {@link PlayableDirector}
|
|
18561
19289
|
*
|
|
@@ -18563,7 +19291,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18563
19291
|
* @category Animation and Sequencing
|
|
18564
19292
|
* @group Components
|
|
18565
19293
|
*/
|
|
18566
|
-
export declare class SignalReceiver extends Component {
|
|
19294
|
+
export declare class SignalReceiver extends Component implements ISignalReceiver {
|
|
19295
|
+
readonly isSignalReceiver = true;
|
|
18567
19296
|
private static receivers;
|
|
18568
19297
|
static invoke(guid: string): void;
|
|
18569
19298
|
events?: SignalReceiverEvent[];
|
|
@@ -18582,10 +19311,26 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
18582
19311
|
reaction: EventList<void>;
|
|
18583
19312
|
}
|
|
18584
19313
|
|
|
18585
|
-
|
|
19314
|
+
/**
|
|
19315
|
+
* Builder for signal tracks. Provides `.signal()` for callback-based signals and `.marker()` for asset-based markers.
|
|
19316
|
+
* @category Animation and Sequencing
|
|
19317
|
+
*/
|
|
19318
|
+
export declare interface SignalTrackBuilder extends TimelineBuilderBase {
|
|
19319
|
+
/** Adds a signal with a callback that fires at the given time */
|
|
19320
|
+
signal(time: number, callback: Function, options?: SignalMarkerOptions): SignalTrackBuilder;
|
|
19321
|
+
/** Adds a signal marker referencing a signal asset by guid */
|
|
19322
|
+
marker(time: number, asset: string, options?: SignalMarkerOptions): SignalTrackBuilder;
|
|
19323
|
+
/** Mutes this track so it is skipped during playback */
|
|
19324
|
+
muted(muted?: boolean): SignalTrackBuilder;
|
|
19325
|
+
}
|
|
19326
|
+
|
|
19327
|
+
export declare class SignalTrackHandler extends TimelineTrackHandler {
|
|
18586
19328
|
models: Models.SignalMarkerModel[];
|
|
18587
19329
|
didTrigger: boolean[];
|
|
18588
19330
|
receivers: Array<SignalReceiver | null>;
|
|
19331
|
+
private _lastTime;
|
|
19332
|
+
onEnable(): void;
|
|
19333
|
+
onMuteChanged(): void;
|
|
18589
19334
|
evaluate(time: number): void;
|
|
18590
19335
|
}
|
|
18591
19336
|
|
|
@@ -19085,10 +19830,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19085
19830
|
* Removes scale change monitoring when the collider is disabled.
|
|
19086
19831
|
*/
|
|
19087
19832
|
onDisable(): void;
|
|
19088
|
-
/**
|
|
19089
|
-
* Updates collider properties when validated in the editor or inspector.
|
|
19090
|
-
*/
|
|
19091
|
-
onValidate(): void;
|
|
19092
19833
|
}
|
|
19093
19834
|
|
|
19094
19835
|
export declare class SphereIntersection implements Intersection {
|
|
@@ -19841,8 +20582,15 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
19841
20582
|
* Configuration for an animation state in the builder
|
|
19842
20583
|
*/
|
|
19843
20584
|
export declare type StateOptions = {
|
|
19844
|
-
/**
|
|
19845
|
-
|
|
20585
|
+
/**
|
|
20586
|
+
* The animation clip for this state. Accepts:
|
|
20587
|
+
* - A pre-built `AnimationClip`
|
|
20588
|
+
* - A single {@link TrackDescriptor} from {@link track}
|
|
20589
|
+
* - An array of {@link TrackDescriptor}s (multiple tracks combined into one clip)
|
|
20590
|
+
*
|
|
20591
|
+
* When omitted, use {@link AnimatorControllerBuilder.track .track()} to define animation tracks inline.
|
|
20592
|
+
*/
|
|
20593
|
+
clip?: AnimationClip | TrackDescriptor | TrackDescriptor[];
|
|
19846
20594
|
/** Whether the animation should loop (default: false) */
|
|
19847
20595
|
loop?: boolean;
|
|
19848
20596
|
/** Base speed multiplier (default: 1) */
|
|
@@ -20408,6 +21156,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20408
21156
|
set font(val: string | null);
|
|
20409
21157
|
get font(): string | null;
|
|
20410
21158
|
private _font;
|
|
21159
|
+
private _assignedAtRuntime;
|
|
20411
21160
|
/**
|
|
20412
21161
|
* 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>`
|
|
20413
21162
|
* @default false
|
|
@@ -20663,6 +21412,57 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20663
21412
|
/* Excluded from this release type: update */
|
|
20664
21413
|
}
|
|
20665
21414
|
|
|
21415
|
+
/**
|
|
21416
|
+
* Handles activation (visibility) of bound objects for a timeline activation track.
|
|
21417
|
+
*
|
|
21418
|
+
* Each clip on the track defines a time range during which the bound objects should be active (visible).
|
|
21419
|
+
* @see TimelineTrackHandler for details on how tracks and clips work in general, and how to mutate them at runtime.
|
|
21420
|
+
* @see PlayableDirector for how to control timeline playback and time.
|
|
21421
|
+
* @see TimelineBuilder for how to create and configure timelines and tracks in the editor.
|
|
21422
|
+
*/
|
|
21423
|
+
export declare class TimelineActivationTrack extends TimelineTrackHandler {
|
|
21424
|
+
evaluate(time: number): void;
|
|
21425
|
+
}
|
|
21426
|
+
|
|
21427
|
+
export declare class TimelineAnimationTrack extends TimelineTrackHandler {
|
|
21428
|
+
/* Excluded from this release type: models */
|
|
21429
|
+
/* Excluded from this release type: trackOffset */
|
|
21430
|
+
/** The object that is being animated. */
|
|
21431
|
+
target?: Object3D;
|
|
21432
|
+
/** The AnimationMixer, should be shared with the animator if an animator is bound */
|
|
21433
|
+
mixer?: AnimationMixer;
|
|
21434
|
+
clips: Array<AnimationClip>;
|
|
21435
|
+
actions: Array<AnimationAction>;
|
|
21436
|
+
/**
|
|
21437
|
+
* You can use the weight to blend the timeline animation tracks with multiple animation tracks on the same object.
|
|
21438
|
+
* @default 1
|
|
21439
|
+
*/
|
|
21440
|
+
weight: number;
|
|
21441
|
+
/** holds data/info about clips differences */
|
|
21442
|
+
private _actionOffsets;
|
|
21443
|
+
private _didBind;
|
|
21444
|
+
private _animator;
|
|
21445
|
+
onDisable(): void;
|
|
21446
|
+
onDestroy(): void;
|
|
21447
|
+
onStateChanged(): void;
|
|
21448
|
+
createHooks(clipModel: Models.AnimationClipModel, clip: any): void;
|
|
21449
|
+
bind(): void;
|
|
21450
|
+
private ensureTrackOffsets;
|
|
21451
|
+
private _useclipOffsets;
|
|
21452
|
+
private _totalOffsetPosition;
|
|
21453
|
+
private _totalOffsetRotation;
|
|
21454
|
+
private _totalOffsetPosition2;
|
|
21455
|
+
private _totalOffsetRotation2;
|
|
21456
|
+
private _summedPos;
|
|
21457
|
+
private _tempPos;
|
|
21458
|
+
private _summedRot;
|
|
21459
|
+
private _tempRot;
|
|
21460
|
+
private _clipRotQuat;
|
|
21461
|
+
evaluate(time: number): void;
|
|
21462
|
+
private createRotationInterpolant;
|
|
21463
|
+
private createPositionInterpolant;
|
|
21464
|
+
}
|
|
21465
|
+
|
|
20666
21466
|
/**
|
|
20667
21467
|
* @category Animation and Sequencing
|
|
20668
21468
|
* @see {@link PlayableDirector} for the main component to control timelines in Needle Engine.
|
|
@@ -20672,6 +21472,325 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20672
21472
|
tracks: TrackModel[];
|
|
20673
21473
|
};
|
|
20674
21474
|
|
|
21475
|
+
/**
|
|
21476
|
+
* Handles audio playback for a timeline audio track.
|
|
21477
|
+
*
|
|
21478
|
+
* **Runtime mutation:** The track model is read fresh every frame during `evaluate()`.
|
|
21479
|
+
* You can mutate `track.volume`, `clip.start`, `clip.end`, `clip.asset.volume` etc.
|
|
21480
|
+
* at any time — changes take effect on the next frame without rebuilding the timeline.
|
|
21481
|
+
*
|
|
21482
|
+
* **Audio stopping:** Audio clips are automatically stopped when:
|
|
21483
|
+
* - Timeline time moves outside a clip's `[start, end]` range (e.g. jumping or normal playback advancing past a clip)
|
|
21484
|
+
* - The track is muted (via `muted = true`)
|
|
21485
|
+
* - The director is stopped (`director.stop()`)
|
|
21486
|
+
* - The director is paused (`director.pause()`)
|
|
21487
|
+
* - The director is disabled or destroyed
|
|
21488
|
+
*/
|
|
21489
|
+
export declare class TimelineAudioTrack extends TimelineTrackHandler {
|
|
21490
|
+
models: Array<AudioClipModel_2>;
|
|
21491
|
+
listener: AudioListener_3;
|
|
21492
|
+
audio: Array<Audio_2>;
|
|
21493
|
+
audioContextTimeOffset: Array<number>;
|
|
21494
|
+
lastTime: number;
|
|
21495
|
+
audioSource?: AudioSource;
|
|
21496
|
+
/** Track-level volume multiplier (0–1). Applied on top of per-clip volume each frame. */
|
|
21497
|
+
get volume(): number;
|
|
21498
|
+
set volume(val: number);
|
|
21499
|
+
private _audioLoader;
|
|
21500
|
+
private getAudioFilePath;
|
|
21501
|
+
onAllowAudioChanged(allow: boolean): void;
|
|
21502
|
+
addModel(model: Models.ClipModel): void;
|
|
21503
|
+
onDisable(): void;
|
|
21504
|
+
onDestroy(): void;
|
|
21505
|
+
onMuteChanged(): void;
|
|
21506
|
+
stop(): void;
|
|
21507
|
+
private _playableDirectorResumed;
|
|
21508
|
+
onPauseChanged(): void;
|
|
21509
|
+
evaluate(time: number): void;
|
|
21510
|
+
/** Call to load audio buffer for a specific time in the track. Can be used to preload the timeline audio */
|
|
21511
|
+
loadAudio(time: number, lookAhead?: number, lookBehind?: number): Promise<(AudioBuffer | null)[]> | null;
|
|
21512
|
+
private isInTimeRange;
|
|
21513
|
+
private static _audioBuffers;
|
|
21514
|
+
static dispose(): void;
|
|
21515
|
+
private handleAudioLoading;
|
|
21516
|
+
}
|
|
21517
|
+
|
|
21518
|
+
/**
|
|
21519
|
+
* A fluent builder for creating timeline assets ({@link TimelineAssetModel}) from code.
|
|
21520
|
+
*
|
|
21521
|
+
* Use {@link TimelineBuilder.create} to start building a timeline.
|
|
21522
|
+
*
|
|
21523
|
+
* @example Using build() for timelines without signal callbacks
|
|
21524
|
+
* ```ts
|
|
21525
|
+
* const timeline = TimelineBuilder.create("MySequence")
|
|
21526
|
+
* .animationTrack("Character", animator)
|
|
21527
|
+
* .clip(walkClip, { duration: 2, easeIn: 0.3 })
|
|
21528
|
+
* .clip(runClip, { duration: 3, easeIn: 0.5, easeOut: 0.5 })
|
|
21529
|
+
* .activationTrack("FX", particleObject)
|
|
21530
|
+
* .clip({ start: 1, duration: 2 })
|
|
21531
|
+
* .audioTrack("Music", audioSource)
|
|
21532
|
+
* .clip("music.mp3", { start: 0, duration: 5, volume: 0.8 })
|
|
21533
|
+
* .build();
|
|
21534
|
+
*
|
|
21535
|
+
* director.playableAsset = timeline;
|
|
21536
|
+
* director.play();
|
|
21537
|
+
* ```
|
|
21538
|
+
*
|
|
21539
|
+
* @example With inline tracks (no pre-built clips needed)
|
|
21540
|
+
* ```ts
|
|
21541
|
+
* TimelineBuilder.create("DoorSequence")
|
|
21542
|
+
* .animationTrack("Door", door)
|
|
21543
|
+
* .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
|
|
21544
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
21545
|
+
* .signalTrack("Events")
|
|
21546
|
+
* .signal(0.5, () => playSound("creak"))
|
|
21547
|
+
* .install(director);
|
|
21548
|
+
*
|
|
21549
|
+
* director.play();
|
|
21550
|
+
* ```
|
|
21551
|
+
*
|
|
21552
|
+
* @example Using install() with signal callbacks
|
|
21553
|
+
* ```ts
|
|
21554
|
+
* TimelineBuilder.create("WithSignals")
|
|
21555
|
+
* .animationTrack("Character", animator)
|
|
21556
|
+
* .clip(walkClip, { duration: 2 })
|
|
21557
|
+
* .signalTrack("Events")
|
|
21558
|
+
* .signal(1.0, () => console.log("1 second!"))
|
|
21559
|
+
* .signal(2.0, () => spawnParticles())
|
|
21560
|
+
* .install(director);
|
|
21561
|
+
*
|
|
21562
|
+
* director.play();
|
|
21563
|
+
* ```
|
|
21564
|
+
*
|
|
21565
|
+
* @category Animation and Sequencing
|
|
21566
|
+
* @group Utilities
|
|
21567
|
+
*/
|
|
21568
|
+
export declare class TimelineBuilder {
|
|
21569
|
+
private _name;
|
|
21570
|
+
private _tracks;
|
|
21571
|
+
private _currentTrack;
|
|
21572
|
+
private _pendingSignals;
|
|
21573
|
+
private _idProvider;
|
|
21574
|
+
private constructor();
|
|
21575
|
+
/**
|
|
21576
|
+
* Creates a new TimelineBuilder instance.
|
|
21577
|
+
* @param name - Name for the timeline asset
|
|
21578
|
+
* @param seed - Optional numeric seed for deterministic guid generation. Defaults to `Date.now()`.
|
|
21579
|
+
*/
|
|
21580
|
+
static create(name?: string, seed?: number): TimelineBuilderBase;
|
|
21581
|
+
/**
|
|
21582
|
+
* Adds an animation track. Chain `.clip()` calls to add pre-built clips,
|
|
21583
|
+
* or chain `.track()` calls to define animation data inline:
|
|
21584
|
+
*
|
|
21585
|
+
* @example With pre-built AnimationClip
|
|
21586
|
+
* ```ts
|
|
21587
|
+
* .animationTrack("Character", animator)
|
|
21588
|
+
* .clip(walkClip, { duration: 2, easeIn: 0.3 })
|
|
21589
|
+
* .clip(runClip, { duration: 3 })
|
|
21590
|
+
* ```
|
|
21591
|
+
*
|
|
21592
|
+
* @example With inline tracks
|
|
21593
|
+
* ```ts
|
|
21594
|
+
* .animationTrack("Door", door)
|
|
21595
|
+
* .track(door, "position", { from: [0, 0, 0], to: [2, 0, 0], duration: 1 })
|
|
21596
|
+
* .track(light, "intensity", { from: 0, to: 5, duration: 1 })
|
|
21597
|
+
* ```
|
|
21598
|
+
*
|
|
21599
|
+
* @param name - Display name for the track
|
|
21600
|
+
* @param binding - The Animator or Object3D to animate
|
|
21601
|
+
*/
|
|
21602
|
+
animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
|
|
21603
|
+
/**
|
|
21604
|
+
* Adds an audio track. Subsequent `.clip()` calls add audio clips to this track.
|
|
21605
|
+
* @param name - Display name for the track
|
|
21606
|
+
* @param binding - The AudioSource to play audio on (optional)
|
|
21607
|
+
* @param volume - Track volume multiplier (default: 1)
|
|
21608
|
+
*/
|
|
21609
|
+
audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
|
|
21610
|
+
/**
|
|
21611
|
+
* Adds an activation track. Subsequent `.clip()` calls define when the bound object is active.
|
|
21612
|
+
* @param name - Display name for the track
|
|
21613
|
+
* @param binding - The Object3D to show/hide
|
|
21614
|
+
*/
|
|
21615
|
+
activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
|
|
21616
|
+
/**
|
|
21617
|
+
* Adds a control track. Subsequent `.clip()` calls control nested timelines or objects.
|
|
21618
|
+
* @param name - Display name for the track
|
|
21619
|
+
*/
|
|
21620
|
+
controlTrack(name: string): ControlTrackBuilder;
|
|
21621
|
+
/**
|
|
21622
|
+
* Adds a signal track. Use `.signal()` or `.marker()` to add signal markers.
|
|
21623
|
+
* @param name - Display name for the track
|
|
21624
|
+
* @param binding - The SignalReceiver component (optional — if using `.signal()` with callbacks, one is created automatically by {@link install})
|
|
21625
|
+
*/
|
|
21626
|
+
signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
|
|
21627
|
+
/**
|
|
21628
|
+
* Adds a marker track. Use `.marker()` to add markers.
|
|
21629
|
+
* @param name - Display name for the track
|
|
21630
|
+
*/
|
|
21631
|
+
markerTrack(name: string): MarkerTrackBuilder;
|
|
21632
|
+
/**
|
|
21633
|
+
* Adds a clip to the current track. The clip type must match the track type.
|
|
21634
|
+
*
|
|
21635
|
+
* - On an **animation track**: pass an `AnimationClip`, a {@link TrackDescriptor}, or a `TrackDescriptor[]` — and optional {@link AnimationClipOptions}
|
|
21636
|
+
* - On an **audio track**: pass a clip URL (string) and {@link AudioClipOptions}
|
|
21637
|
+
* - On an **activation track**: pass {@link ActivationClipOptions}
|
|
21638
|
+
* - On a **control track**: pass an Object3D and {@link ControlClipOptions}
|
|
21639
|
+
*/
|
|
21640
|
+
clip(asset: AnimationClip, options?: AnimationClipOptions): this;
|
|
21641
|
+
clip(descriptor: TrackDescriptor, options?: AnimationClipOptions): this;
|
|
21642
|
+
clip(descriptors: TrackDescriptor[], options?: AnimationClipOptions): this;
|
|
21643
|
+
clip(url: string, options: AudioClipOptions): this;
|
|
21644
|
+
clip(options: ActivationClipOptions): this;
|
|
21645
|
+
clip(sourceObject: Object3D, options: ControlClipOptions): this;
|
|
21646
|
+
/**
|
|
21647
|
+
* Adds a signal marker to the current signal or marker track.
|
|
21648
|
+
* @param time - Time in seconds when the signal fires
|
|
21649
|
+
* @param asset - The signal asset identifier (guid string)
|
|
21650
|
+
* @param options - Optional marker configuration
|
|
21651
|
+
*/
|
|
21652
|
+
marker(time: number, asset: string, options?: SignalMarkerOptions): this;
|
|
21653
|
+
/**
|
|
21654
|
+
* Adds a signal with a callback to the current signal track.
|
|
21655
|
+
* This is a convenience method that automatically generates a signal asset guid,
|
|
21656
|
+
* adds the marker, and registers the callback so that {@link install} can wire up
|
|
21657
|
+
* the `SignalReceiver` on the director's GameObject.
|
|
21658
|
+
*
|
|
21659
|
+
* @param time - Time in seconds when the signal fires
|
|
21660
|
+
* @param callback - The function to invoke when the signal fires
|
|
21661
|
+
* @param options - Optional marker configuration
|
|
21662
|
+
*
|
|
21663
|
+
* @example
|
|
21664
|
+
* ```ts
|
|
21665
|
+
* const timeline = TimelineBuilder.create("Sequence")
|
|
21666
|
+
* .signalTrack("Events")
|
|
21667
|
+
* .signal(1.0, () => console.log("1 second reached!"))
|
|
21668
|
+
* .signal(3.5, () => console.log("halfway!"), { emitOnce: true })
|
|
21669
|
+
* .install(director);
|
|
21670
|
+
* ```
|
|
21671
|
+
*/
|
|
21672
|
+
signal(time: number, callback: Function, options?: SignalMarkerOptions): this;
|
|
21673
|
+
/**
|
|
21674
|
+
* Mutes the current track so it is skipped during playback.
|
|
21675
|
+
*/
|
|
21676
|
+
muted(muted?: boolean): this;
|
|
21677
|
+
/** Adds an animation track descriptor for an Object3D's position or scale to the current animation track */
|
|
21678
|
+
track(target: Object3D, property: "position" | "scale", keyframes: KF_3<Vec3Value>, options?: TrackOptions): this;
|
|
21679
|
+
/** Adds an animation track descriptor for an Object3D's quaternion to the current animation track */
|
|
21680
|
+
track(target: Object3D, property: "quaternion", keyframes: KF_3<QuatValue>, options?: TrackOptions): this;
|
|
21681
|
+
/** Adds an animation track descriptor for an Object3D's rotation (Euler, converted to quaternion) to the current animation track */
|
|
21682
|
+
track(target: Object3D, property: "rotation", keyframes: KF_3<EulerValue>, options?: TrackOptions): this;
|
|
21683
|
+
/** Adds an animation track descriptor for an Object3D's visibility to the current animation track */
|
|
21684
|
+
track(target: Object3D, property: "visible", keyframes: KF_3<boolean>, options?: TrackOptions): this;
|
|
21685
|
+
/** Adds an animation track descriptor for a material's numeric property to the current animation track */
|
|
21686
|
+
track(target: Material, property: "opacity" | "roughness" | "metalness" | "alphaTest" | "emissiveIntensity" | "envMapIntensity" | "bumpScale" | "displacementScale" | "displacementBias", keyframes: KF_3<number>, options?: TrackOptions): this;
|
|
21687
|
+
/** Adds an animation track descriptor for a material's color property to the current animation track */
|
|
21688
|
+
track(target: Material, property: "color" | "emissive", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
|
|
21689
|
+
/** Adds an animation track descriptor for a light's numeric property to the current animation track */
|
|
21690
|
+
track(target: Light_2, property: "intensity" | "distance" | "angle" | "penumbra" | "decay", keyframes: KF_3<number>, options?: TrackOptions): this;
|
|
21691
|
+
/** Adds an animation track descriptor for a light's color to the current animation track */
|
|
21692
|
+
track(target: Light_2, property: "color", keyframes: KF_3<ColorValue>, options?: TrackOptions): this;
|
|
21693
|
+
/** Adds an animation track descriptor for a camera's numeric property to the current animation track */
|
|
21694
|
+
track(target: PerspectiveCamera, property: "fov" | "near" | "far" | "zoom", keyframes: KF_3<number>, options?: TrackOptions): this;
|
|
21695
|
+
/**
|
|
21696
|
+
* Builds and returns the {@link TimelineAssetModel}.
|
|
21697
|
+
* Assign the result to `PlayableDirector.playableAsset` to play it.
|
|
21698
|
+
*
|
|
21699
|
+
* If you used `.signal()` with callbacks, use {@link install} instead — it calls `build()`
|
|
21700
|
+
* internally and also wires up the SignalReceiver on the director's GameObject.
|
|
21701
|
+
*/
|
|
21702
|
+
build(): TimelineAssetModel;
|
|
21703
|
+
/**
|
|
21704
|
+
* Builds the timeline asset, assigns it to the director, and wires up any
|
|
21705
|
+
* `.signal()` callbacks by creating/configuring a {@link SignalReceiver} on the
|
|
21706
|
+
* director's GameObject.
|
|
21707
|
+
*
|
|
21708
|
+
* @param director - The PlayableDirector to install the timeline on
|
|
21709
|
+
* @returns The built TimelineAssetModel (also assigned to `director.playableAsset`)
|
|
21710
|
+
*
|
|
21711
|
+
* @example
|
|
21712
|
+
* ```ts
|
|
21713
|
+
* TimelineBuilder.create("MyTimeline")
|
|
21714
|
+
* .animationTrack("Anim", animator)
|
|
21715
|
+
* .clip(walkClip, { duration: 2 })
|
|
21716
|
+
* .signalTrack("Events")
|
|
21717
|
+
* .signal(1.0, () => console.log("signal fired!"))
|
|
21718
|
+
* .install(director);
|
|
21719
|
+
*
|
|
21720
|
+
* director.play();
|
|
21721
|
+
* ```
|
|
21722
|
+
*/
|
|
21723
|
+
install(director: PlayableDirector): TimelineAssetModel;
|
|
21724
|
+
private pushTrack;
|
|
21725
|
+
/** Commits any pending `.track()` descriptors on the current animation track into a clip */
|
|
21726
|
+
private commitInlineTracks;
|
|
21727
|
+
}
|
|
21728
|
+
|
|
21729
|
+
/**
|
|
21730
|
+
* Shared methods available on all track builders and the TimelineBuilder entry point.
|
|
21731
|
+
* Provides track creation, build, and install methods.
|
|
21732
|
+
*
|
|
21733
|
+
* @category Animation and Sequencing
|
|
21734
|
+
*/
|
|
21735
|
+
export declare interface TimelineBuilderBase {
|
|
21736
|
+
/** Adds an animation track. Chain `.clip()` or `.track()` to add content. */
|
|
21737
|
+
animationTrack(name: string, binding?: Animator | Object3D | null): AnimationTrackBuilder;
|
|
21738
|
+
/** Adds an audio track. Chain `.clip()` to add audio clips. */
|
|
21739
|
+
audioTrack(name: string, binding?: AudioSource | Object3D | null, volume?: number): AudioTrackBuilder;
|
|
21740
|
+
/** Adds an activation track. Chain `.clip()` to define activation windows. */
|
|
21741
|
+
activationTrack(name: string, binding?: Object3D | null): ActivationTrackBuilder;
|
|
21742
|
+
/** Adds a control track. Chain `.clip()` to control nested objects/timelines. */
|
|
21743
|
+
controlTrack(name: string): ControlTrackBuilder;
|
|
21744
|
+
/** Adds a signal track. Chain `.signal()` or `.marker()` to add events. */
|
|
21745
|
+
signalTrack(name: string, binding?: SignalReceiver | Object3D | null): SignalTrackBuilder;
|
|
21746
|
+
/** Adds a marker track. Chain `.marker()` to add markers. */
|
|
21747
|
+
markerTrack(name: string): MarkerTrackBuilder;
|
|
21748
|
+
/** Builds and returns the {@link TimelineAssetModel}. */
|
|
21749
|
+
build(): TimelineAssetModel;
|
|
21750
|
+
/** Builds the timeline, assigns it to the director, and wires up signal callbacks. */
|
|
21751
|
+
install(director: PlayableDirector): TimelineAssetModel;
|
|
21752
|
+
}
|
|
21753
|
+
|
|
21754
|
+
export declare class TimelineControlTrack extends TimelineTrackHandler {
|
|
21755
|
+
models: Array<Models.ClipModel>;
|
|
21756
|
+
timelines: Array<PlayableDirector | null>;
|
|
21757
|
+
resolveSourceObjects(_context: Context): void;
|
|
21758
|
+
private _previousActiveModel;
|
|
21759
|
+
evaluate(time: number): void;
|
|
21760
|
+
}
|
|
21761
|
+
|
|
21762
|
+
export declare class TimelineMarkerTrack extends TimelineTrackHandler {
|
|
21763
|
+
models: Array<Models.MarkerModel & Record<string, any>>;
|
|
21764
|
+
needsSorting: boolean;
|
|
21765
|
+
foreachMarker<T>(type?: string | null): Generator<T, void, unknown>;
|
|
21766
|
+
onEnable(): void;
|
|
21767
|
+
evaluate(_time: number): void;
|
|
21768
|
+
private sort;
|
|
21769
|
+
}
|
|
21770
|
+
|
|
21771
|
+
/**
|
|
21772
|
+
* A TrackHandler is responsible for evaluating a specific type of timeline track.
|
|
21773
|
+
* A timeline track can be an animation track, audio track, signal track, control track etc and is controlled by a {@link PlayableDirector}.
|
|
21774
|
+
*/
|
|
21775
|
+
export declare abstract class TimelineTrackHandler {
|
|
21776
|
+
director: PlayableDirector;
|
|
21777
|
+
track: Models.TrackModel;
|
|
21778
|
+
get muted(): boolean;
|
|
21779
|
+
set muted(val: boolean);
|
|
21780
|
+
forEachClip(backwards?: boolean): IterableIterator<Models.ClipModel>;
|
|
21781
|
+
onEnable?(): any;
|
|
21782
|
+
onDisable?(): any;
|
|
21783
|
+
onDestroy?(): any;
|
|
21784
|
+
abstract evaluate(time: number): any;
|
|
21785
|
+
onMuteChanged?(): any;
|
|
21786
|
+
onPauseChanged?(): any;
|
|
21787
|
+
/** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
|
|
21788
|
+
onStateChanged?(isPlaying: boolean): any;
|
|
21789
|
+
getClipTime(time: number, model: Models.ClipModel): number;
|
|
21790
|
+
getClipTimeNormalized(time: number, model: Models.ClipModel): number;
|
|
21791
|
+
evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
|
|
21792
|
+
}
|
|
21793
|
+
|
|
20675
21794
|
declare type TonemappingAttributeOptions = "none" | "linear" | "neutral" | "agx";
|
|
20676
21795
|
|
|
20677
21796
|
/**
|
|
@@ -20700,27 +21819,20 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20700
21819
|
export declare function toSourceId(src: string | null): SourceIdentifier | undefined;
|
|
20701
21820
|
|
|
20702
21821
|
/**
|
|
20703
|
-
*
|
|
20704
|
-
*
|
|
21822
|
+
* An opaque descriptor for a single animation track.
|
|
21823
|
+
* Created by {@link track} and resolved into a Three.js KeyframeTrack
|
|
21824
|
+
* when passed to {@link createAnimation}, or inline to
|
|
21825
|
+
* {@link AnimatorControllerBuilder.state} / {@link TimelineBuilder.clip}.
|
|
21826
|
+
*
|
|
21827
|
+
* @category Animation and Sequencing
|
|
20705
21828
|
*/
|
|
20706
|
-
|
|
20707
|
-
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
onDisable?(): any;
|
|
20714
|
-
onDestroy?(): any;
|
|
20715
|
-
abstract evaluate(time: number): any;
|
|
20716
|
-
onMuteChanged?(): any;
|
|
20717
|
-
onPauseChanged?(): any;
|
|
20718
|
-
/** invoked when PlayableDirectory playmode state changes (paused, playing, stopped) */
|
|
20719
|
-
onStateChanged?(isPlaying: boolean): any;
|
|
20720
|
-
getClipTime(time: number, model: Models.ClipModel): number;
|
|
20721
|
-
getClipTimeNormalized(time: number, model: Models.ClipModel): number;
|
|
20722
|
-
evaluateWeight(time: number, index: number, models: Array<Models.ClipModel>, isActive?: boolean): number;
|
|
20723
|
-
}
|
|
21829
|
+
declare type TrackDescriptor = {
|
|
21830
|
+
readonly __isTrackDescriptor: true;
|
|
21831
|
+
/* Excluded from this release type: _target */
|
|
21832
|
+
/* Excluded from this release type: _property */
|
|
21833
|
+
/* Excluded from this release type: _keyframes */
|
|
21834
|
+
/* Excluded from this release type: _root */
|
|
21835
|
+
};
|
|
20724
21836
|
|
|
20725
21837
|
/**
|
|
20726
21838
|
* @category Animation and Sequencing
|
|
@@ -20746,14 +21858,26 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20746
21858
|
rotation: Quat | Quaternion;
|
|
20747
21859
|
};
|
|
20748
21860
|
|
|
21861
|
+
/** Options for a single track */
|
|
21862
|
+
declare type TrackOptions = {
|
|
21863
|
+
/**
|
|
21864
|
+
* Root object for resolving the track path.
|
|
21865
|
+
* - If `root === target` → self-targeting (`.property`)
|
|
21866
|
+
* - If `root !== target` → named targeting (`"targetName.property"` using `target.name`)
|
|
21867
|
+
* - If omitted → self-targeting by default
|
|
21868
|
+
*/
|
|
21869
|
+
root?: Object3D;
|
|
21870
|
+
};
|
|
21871
|
+
|
|
20749
21872
|
declare namespace Tracks {
|
|
20750
21873
|
export {
|
|
20751
|
-
|
|
20752
|
-
|
|
20753
|
-
|
|
20754
|
-
|
|
21874
|
+
TimelineTrackHandler,
|
|
21875
|
+
TimelineAnimationTrack,
|
|
21876
|
+
TimelineAudioTrack,
|
|
21877
|
+
TimelineMarkerTrack,
|
|
20755
21878
|
SignalTrackHandler,
|
|
20756
|
-
|
|
21879
|
+
TimelineActivationTrack,
|
|
21880
|
+
TimelineControlTrack
|
|
20757
21881
|
}
|
|
20758
21882
|
}
|
|
20759
21883
|
|
|
@@ -20959,10 +22083,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
20959
22083
|
export declare type TransitionOptions = {
|
|
20960
22084
|
/** Duration of the crossfade in seconds (default: 0) */
|
|
20961
22085
|
duration?: number;
|
|
20962
|
-
/** Normalized exit time 0-1
|
|
22086
|
+
/** Normalized exit time 0-1. When set, the transition waits until the source animation reaches this point before transitioning. */
|
|
20963
22087
|
exitTime?: number;
|
|
20964
|
-
/** Whether the transition waits for exitTime before transitioning (default: false) */
|
|
20965
|
-
hasExitTime?: boolean;
|
|
20966
22088
|
/** Normalized offset into the destination state's animation (default: 0) */
|
|
20967
22089
|
offset?: number;
|
|
20968
22090
|
/** Whether duration is in seconds (true) or normalized (false) (default: false) */
|
|
@@ -21032,6 +22154,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21032
22154
|
|
|
21033
22155
|
export declare function tryGetGuid(obj: any): string | undefined | null;
|
|
21034
22156
|
|
|
22157
|
+
/** Shorthand for a simple two-keyframe animation (start → end) */
|
|
22158
|
+
export declare type Tween<V> = {
|
|
22159
|
+
/** Start value (at time 0) */
|
|
22160
|
+
from: V;
|
|
22161
|
+
/** End value (at time = duration) */
|
|
22162
|
+
to: V;
|
|
22163
|
+
/** Duration in seconds (default: 1) */
|
|
22164
|
+
duration?: number;
|
|
22165
|
+
/** Interpolation mode (default: `"linear"`) */
|
|
22166
|
+
interpolation?: AnimationInterpolation;
|
|
22167
|
+
};
|
|
22168
|
+
|
|
21035
22169
|
declare type Type = new (...args: any[]) => any;
|
|
21036
22170
|
|
|
21037
22171
|
declare type TypeResolver<T> = (data: any) => Constructor<T> | null;
|
|
@@ -21555,6 +22689,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21555
22689
|
z: number;
|
|
21556
22690
|
};
|
|
21557
22691
|
|
|
22692
|
+
/** A Vector3 value, either as a Three.js Vector3 or as a `[x, y, z]` tuple */
|
|
22693
|
+
declare type Vec3Value = Vector3 | [number, number, number];
|
|
22694
|
+
|
|
21558
22695
|
export declare type Vec4 = {
|
|
21559
22696
|
x: number;
|
|
21560
22697
|
y: number;
|
|
@@ -21775,8 +22912,14 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
21775
22912
|
private _receivedInput;
|
|
21776
22913
|
/* Excluded from this release type: __constructor */
|
|
21777
22914
|
private _playErrors;
|
|
21778
|
-
/**
|
|
21779
|
-
|
|
22915
|
+
/**
|
|
22916
|
+
* Plays the assigned video clip, URL, or MediaStream.
|
|
22917
|
+
* If a `clip` argument is passed, it is used as the new video source (mirroring {@link AudioSource.play}).
|
|
22918
|
+
*
|
|
22919
|
+
* @param clip - Optional video URL string or {@link MediaStream} to play. If omitted, plays the currently assigned source.
|
|
22920
|
+
* @returns A promise that resolves to `true` when playback was successfully started, or `false` on error.
|
|
22921
|
+
*/
|
|
22922
|
+
play(clip?: string | MediaStream): Promise<boolean>;
|
|
21780
22923
|
/**
|
|
21781
22924
|
* Stop the video playback. This will reset the video to the beginning
|
|
21782
22925
|
*/
|
|
@@ -22046,9 +23189,9 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22046
23189
|
* voip.createMenuButton = true;
|
|
22047
23190
|
*
|
|
22048
23191
|
* // Manual control
|
|
22049
|
-
* voip.connect(); // Start sending
|
|
22050
|
-
* voip.disconnect(); // Stop sending
|
|
22051
|
-
* voip.setMuted(true); // Mute
|
|
23192
|
+
* voip.connect(); // Start sending your microphone
|
|
23193
|
+
* voip.disconnect(); // Stop sending your microphone
|
|
23194
|
+
* voip.setMuted(true); // Mute incoming audio (silence other users)
|
|
22052
23195
|
* ```
|
|
22053
23196
|
*
|
|
22054
23197
|
* @summary Voice over IP for networked audio communication
|
|
@@ -22107,8 +23250,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22107
23250
|
*/
|
|
22108
23251
|
get incomingStreams(): ReadonlyMap<string, HTMLAudioElement>;
|
|
22109
23252
|
/**
|
|
22110
|
-
*
|
|
22111
|
-
* they are considered "speaking". Default is
|
|
23253
|
+
* Normalized amplitude threshold for speaking detection (0–1). When a user's average
|
|
23254
|
+
* audio amplitude exceeds this, they are considered "speaking". Default is 0.1.
|
|
22112
23255
|
*/
|
|
22113
23256
|
speakingThreshold: number;
|
|
22114
23257
|
/**
|
|
@@ -22118,6 +23261,8 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22118
23261
|
onSpeakingChanged: EventList;
|
|
22119
23262
|
private _speakingStates;
|
|
22120
23263
|
private _analysers;
|
|
23264
|
+
private _sharedAudioContext?;
|
|
23265
|
+
private _lastSpeakingPollMs;
|
|
22121
23266
|
private _net?;
|
|
22122
23267
|
private _menubutton?;
|
|
22123
23268
|
/* Excluded from this release type: awake */
|
|
@@ -22127,21 +23272,27 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22127
23272
|
/** 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) */
|
|
22128
23273
|
private _allowSending;
|
|
22129
23274
|
private _outputStream;
|
|
23275
|
+
private _connectInFlight?;
|
|
22130
23276
|
/**
|
|
22131
23277
|
* @returns true if the component is currently sending audio
|
|
22132
23278
|
*/
|
|
22133
23279
|
get isSending(): boolean;
|
|
22134
23280
|
/** Start sending audio. */
|
|
22135
23281
|
connect(audioSource?: MediaTrackConstraints): Promise<boolean>;
|
|
23282
|
+
private _connectImpl;
|
|
22136
23283
|
/** Stop sending audio (muting your own microphone) */
|
|
22137
23284
|
disconnect(opts?: {
|
|
22138
23285
|
remember: boolean;
|
|
22139
23286
|
}): void;
|
|
22140
23287
|
/**
|
|
22141
|
-
* Mute or unmute the audio
|
|
23288
|
+
* Mute or unmute the audio you hear from other users (incoming streams).
|
|
23289
|
+
* This does NOT mute your own microphone — use {@link disconnect} to stop sending your microphone.
|
|
22142
23290
|
*/
|
|
22143
23291
|
setMuted(mute: boolean): void;
|
|
22144
|
-
/**
|
|
23292
|
+
/**
|
|
23293
|
+
* Returns true if incoming audio is currently muted (you can't hear other users).
|
|
23294
|
+
* When there are no incoming streams, returns false.
|
|
23295
|
+
*/
|
|
22145
23296
|
get isMuted(): boolean;
|
|
22146
23297
|
private updateButton;
|
|
22147
23298
|
/** @deprecated */
|
|
@@ -22153,6 +23304,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22153
23304
|
/* Excluded from this release type: update */
|
|
22154
23305
|
private setupAnalyser;
|
|
22155
23306
|
private cleanupAnalyser;
|
|
23307
|
+
private closeSharedAudioContext;
|
|
22156
23308
|
private onReceiveStream;
|
|
22157
23309
|
private onStreamEnded;
|
|
22158
23310
|
private onEnabledChanged;
|
|
@@ -22476,7 +23628,7 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22476
23628
|
private onApplyPose;
|
|
22477
23629
|
}
|
|
22478
23630
|
|
|
22479
|
-
declare type WebsocketSendType = IModel | object | boolean |
|
|
23631
|
+
declare type WebsocketSendType = IModel | object | boolean | string | number;
|
|
22480
23632
|
|
|
22481
23633
|
/**
|
|
22482
23634
|
* 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.
|
|
@@ -22870,6 +24022,25 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22870
24022
|
* @link https://github.com/immersive-web/marker-tracking/blob/main/explainer.md - WebXR Marker Tracking Specification
|
|
22871
24023
|
*/
|
|
22872
24024
|
export declare class WebXRImageTracking extends Component {
|
|
24025
|
+
/**
|
|
24026
|
+
* Event invoked every frame when images are being tracked.
|
|
24027
|
+
* @example
|
|
24028
|
+
* ```ts
|
|
24029
|
+
* const tracker = this.gameObject.getComponent(WebXRImageTracking);
|
|
24030
|
+
* tracker?.imageTracked.addEventListener(evt => {
|
|
24031
|
+
* for (const img of evt.trackedImages) {
|
|
24032
|
+
* console.log(img.url, img.state);
|
|
24033
|
+
* }
|
|
24034
|
+
* });
|
|
24035
|
+
* ```
|
|
24036
|
+
*/
|
|
24037
|
+
imageTracked: EventList<WebXRImageTrackingEvent>;
|
|
24038
|
+
/** @inheritdoc */
|
|
24039
|
+
addEventListener<K extends keyof WebXRImageTrackingEventMap>(type: K, listener: (evt: WebXRImageTrackingEventMap[K]) => any): void;
|
|
24040
|
+
addEventListener<T extends Event>(type: string, listener: (evt: T) => any): void;
|
|
24041
|
+
/** @inheritdoc */
|
|
24042
|
+
removeEventListener<K extends keyof WebXRImageTrackingEventMap>(type: K, listener: (evt: WebXRImageTrackingEventMap[K]) => any): void;
|
|
24043
|
+
removeEventListener<T extends Event>(type: string, listener: (evt: T) => any): void;
|
|
22873
24044
|
/**
|
|
22874
24045
|
* Set which marker should be primary (first in the list).
|
|
22875
24046
|
* Useful when deploying to QuickLook mode where one marker is tracked at a time.
|
|
@@ -22956,6 +24127,18 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
22956
24127
|
private onImageTrackingUpdate;
|
|
22957
24128
|
}
|
|
22958
24129
|
|
|
24130
|
+
/** Data passed to image tracking event listeners. */
|
|
24131
|
+
export declare interface WebXRImageTrackingEvent {
|
|
24132
|
+
/** The images currently being tracked this frame. */
|
|
24133
|
+
readonly trackedImages: readonly WebXRTrackedImage[];
|
|
24134
|
+
}
|
|
24135
|
+
|
|
24136
|
+
/** Event map for {@link WebXRImageTracking} events. Use with `addEventListener` for typed event handling. */
|
|
24137
|
+
export declare interface WebXRImageTrackingEventMap {
|
|
24138
|
+
/** Dispatched every frame when images are being tracked. The event detail contains the tracking data for the current frame. */
|
|
24139
|
+
"image-tracking": CustomEvent<WebXRImageTrackingEvent>;
|
|
24140
|
+
}
|
|
24141
|
+
|
|
22959
24142
|
/**
|
|
22960
24143
|
* Configuration model for a tracked image marker.
|
|
22961
24144
|
* Defines which image to track, its physical size, and which 3D content to display when detected.
|
|
@@ -23154,8 +24337,39 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
23154
24337
|
get widthInMeters(): number;
|
|
23155
24338
|
/** The ImageBitmap used for tracking */
|
|
23156
24339
|
get bitmap(): ImageBitmap;
|
|
23157
|
-
/**
|
|
24340
|
+
/**
|
|
24341
|
+
* The {@link WebXRImageTrackingModel} configuration for this tracked image.
|
|
24342
|
+
* Use this to access the assigned 3D object, marker settings, and other image tracking configuration.
|
|
24343
|
+
* Available on each {@link WebXRTrackedImage} received from the `image-tracking` {@link CustomEvent} (`event.detail`).
|
|
24344
|
+
* @example
|
|
24345
|
+
* ```ts
|
|
24346
|
+
* tracker.addEventListener("image-tracking", event => {
|
|
24347
|
+
* for (const img of event.detail.trackedImages) {
|
|
24348
|
+
* const model = img.model;
|
|
24349
|
+
* // Access the assigned 3D object
|
|
24350
|
+
* const obj = model.object;
|
|
24351
|
+
* // Access other settings
|
|
24352
|
+
* console.log(model.widthInMeters, model.hideWhenTrackingIsLost);
|
|
24353
|
+
* }
|
|
24354
|
+
* });
|
|
24355
|
+
* ```
|
|
24356
|
+
*/
|
|
23158
24357
|
get model(): WebXRImageTrackingModel;
|
|
24358
|
+
/**
|
|
24359
|
+
* The 3D object or prefab assigned to this tracked image marker in the {@link WebXRImageTrackingModel}.
|
|
24360
|
+
* Use this to access the object associated with an AR image tracking marker from the `image-tracking` {@link CustomEvent}.
|
|
24361
|
+
* Shorthand for `this.model.object`.
|
|
24362
|
+
* @example
|
|
24363
|
+
* ```ts
|
|
24364
|
+
* tracker.addEventListener("image-tracking", event => {
|
|
24365
|
+
* for (const img of event.detail.trackedImages) {
|
|
24366
|
+
* const obj = img.trackedModel;
|
|
24367
|
+
* // verbose alternative: img.model.object
|
|
24368
|
+
* }
|
|
24369
|
+
* });
|
|
24370
|
+
* ```
|
|
24371
|
+
*/
|
|
24372
|
+
get trackedModel(): AssetReference | undefined;
|
|
23159
24373
|
/**
|
|
23160
24374
|
* The measured size of the detected image in the real world.
|
|
23161
24375
|
* May differ from `widthInMeters` if the physical marker doesn't match the configured size.
|
|
@@ -23519,35 +24733,6 @@ export declare class OrbitControls extends Component implements ICameraControlle
|
|
|
23519
24733
|
export { }
|
|
23520
24734
|
|
|
23521
24735
|
|
|
23522
|
-
declare module 'three' {
|
|
23523
|
-
interface SkinnedMesh {
|
|
23524
|
-
staticGenerator?: StaticGeometryGenerator;
|
|
23525
|
-
staticGeometry?: BufferGeometry;
|
|
23526
|
-
staticGeometryLastUpdate?: number;
|
|
23527
|
-
}
|
|
23528
|
-
interface Mesh {
|
|
23529
|
-
acceleratedRaycast?: any;
|
|
23530
|
-
}
|
|
23531
|
-
interface SkinnedMesh {
|
|
23532
|
-
/** @deprecated use autoUpdateMeshBvhInterval */
|
|
23533
|
-
autoUpdateMeshBVH?: boolean;
|
|
23534
|
-
/**
|
|
23535
|
-
* Interval in milliseconds to automatically update the mesh BVH. When set to >= 0 the BVH will be updated every x milliseconds.
|
|
23536
|
-
* @default undefined (disabled)
|
|
23537
|
-
*/
|
|
23538
|
-
autoUpdateMeshBvhInterval?: number;
|
|
23539
|
-
bvhNeedsUpdate?: boolean;
|
|
23540
|
-
}
|
|
23541
|
-
}
|
|
23542
|
-
|
|
23543
|
-
|
|
23544
|
-
declare module 'three' {
|
|
23545
|
-
interface Vector3 {
|
|
23546
|
-
slerp(end: Vector3, t: number): Vector3;
|
|
23547
|
-
}
|
|
23548
|
-
}
|
|
23549
|
-
|
|
23550
|
-
|
|
23551
24736
|
declare module 'three' {
|
|
23552
24737
|
interface Object3D {
|
|
23553
24738
|
get guid(): string | undefined;
|
|
@@ -23686,3 +24871,32 @@ declare module 'three' {
|
|
|
23686
24871
|
contains(object: Object3D | null | undefined): boolean;
|
|
23687
24872
|
}
|
|
23688
24873
|
}
|
|
24874
|
+
|
|
24875
|
+
|
|
24876
|
+
declare module 'three' {
|
|
24877
|
+
interface Vector3 {
|
|
24878
|
+
slerp(end: Vector3, t: number): Vector3;
|
|
24879
|
+
}
|
|
24880
|
+
}
|
|
24881
|
+
|
|
24882
|
+
|
|
24883
|
+
declare module 'three' {
|
|
24884
|
+
interface SkinnedMesh {
|
|
24885
|
+
staticGenerator?: StaticGeometryGenerator;
|
|
24886
|
+
staticGeometry?: BufferGeometry;
|
|
24887
|
+
staticGeometryLastUpdate?: number;
|
|
24888
|
+
}
|
|
24889
|
+
interface Mesh {
|
|
24890
|
+
acceleratedRaycast?: any;
|
|
24891
|
+
}
|
|
24892
|
+
interface SkinnedMesh {
|
|
24893
|
+
/** @deprecated use autoUpdateMeshBvhInterval */
|
|
24894
|
+
autoUpdateMeshBVH?: boolean;
|
|
24895
|
+
/**
|
|
24896
|
+
* Interval in milliseconds to automatically update the mesh BVH. When set to >= 0 the BVH will be updated every x milliseconds.
|
|
24897
|
+
* @default undefined (disabled)
|
|
24898
|
+
*/
|
|
24899
|
+
autoUpdateMeshBvhInterval?: number;
|
|
24900
|
+
bvhNeedsUpdate?: boolean;
|
|
24901
|
+
}
|
|
24902
|
+
}
|