@needle-tools/engine 4.3.0-alpha → 4.3.0-alpha.1
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 +3 -0
- package/dist/needle-engine.bundle.js +1467 -222
- package/dist/needle-engine.bundle.light.js +1467 -222
- package/dist/needle-engine.bundle.light.min.js +32 -32
- package/dist/needle-engine.bundle.light.umd.cjs +3 -3
- package/dist/needle-engine.bundle.min.js +3 -3
- package/dist/needle-engine.bundle.umd.cjs +3 -3
- package/dist/needle-engine.light.d.ts +9 -9
- package/lib/engine/engine_types.d.ts +162 -17
- package/lib/engine-components/Animator.d.ts +129 -21
- package/lib/engine-components/Animator.js +115 -21
- package/lib/engine-components/Animator.js.map +1 -1
- package/lib/engine-components/AnimatorController.d.ts +161 -32
- package/lib/engine-components/AnimatorController.js +176 -29
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/AudioListener.d.ts +16 -5
- package/lib/engine-components/AudioListener.js +16 -5
- package/lib/engine-components/AudioListener.js.map +1 -1
- package/lib/engine-components/AudioSource.d.ts +120 -28
- package/lib/engine-components/AudioSource.js +120 -37
- package/lib/engine-components/AudioSource.js.map +1 -1
- package/lib/engine-components/AvatarLoader.d.ts +61 -0
- package/lib/engine-components/AvatarLoader.js +61 -1
- package/lib/engine-components/AvatarLoader.js.map +1 -1
- package/lib/engine-components/AxesHelper.d.ts +19 -1
- package/lib/engine-components/AxesHelper.js +19 -1
- package/lib/engine-components/AxesHelper.js.map +1 -1
- package/lib/engine-components/BoxHelperComponent.d.ts +26 -0
- package/lib/engine-components/BoxHelperComponent.js +26 -0
- package/lib/engine-components/BoxHelperComponent.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +126 -37
- package/lib/engine-components/Camera.js +139 -37
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +20 -0
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/Collider.d.ts +95 -21
- package/lib/engine-components/Collider.js +100 -23
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Component.d.ts +554 -106
- package/lib/engine-components/Component.js +352 -81
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.d.ts +95 -21
- package/lib/engine-components/DragControls.js +126 -32
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/DropListener.d.ts +99 -16
- package/lib/engine-components/DropListener.js +119 -14
- package/lib/engine-components/DropListener.js.map +1 -1
- package/lib/engine-components/Light.d.ts +102 -5
- package/lib/engine-components/Light.js +102 -44
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/NeedleMenu.d.ts +28 -11
- package/lib/engine-components/NeedleMenu.js +28 -11
- package/lib/engine-components/NeedleMenu.js.map +1 -1
- package/lib/engine-components/Networking.d.ts +37 -5
- package/lib/engine-components/Networking.js +37 -5
- package/lib/engine-components/Networking.js.map +1 -1
- package/lib/engine-components/SceneSwitcher.js +44 -0
- package/lib/engine-components/SceneSwitcher.js.map +1 -1
- package/lib/engine-components/SpatialTrigger.d.ts +66 -1
- package/lib/engine-components/SpatialTrigger.js +74 -2
- package/lib/engine-components/SpatialTrigger.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.d.ts +66 -4
- package/lib/engine-components/SpectatorCamera.js +132 -6
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SyncedTransform.d.ts +45 -6
- package/lib/engine-components/SyncedTransform.js +45 -6
- package/lib/engine-components/SyncedTransform.js.map +1 -1
- package/lib/engine-components/TransformGizmo.d.ts +49 -3
- package/lib/engine-components/TransformGizmo.js +49 -3
- package/lib/engine-components/TransformGizmo.js.map +1 -1
- package/lib/engine-components/webxr/WebXR.d.ts +131 -22
- package/lib/engine-components/webxr/WebXR.js +132 -23
- package/lib/engine-components/webxr/WebXR.js.map +1 -1
- package/lib/engine-components-experimental/networking/PlayerSync.d.ts +82 -9
- package/lib/engine-components-experimental/networking/PlayerSync.js +76 -11
- package/lib/engine-components-experimental/networking/PlayerSync.js.map +1 -1
- package/package.json +1 -1
- package/src/engine/engine_types.ts +179 -18
- package/src/engine-components/Animator.ts +142 -22
- package/src/engine-components/AnimatorController.ts +184 -34
- package/src/engine-components/AudioListener.ts +16 -5
- package/src/engine-components/AudioSource.ts +126 -37
- package/src/engine-components/AvatarLoader.ts +61 -2
- package/src/engine-components/AxesHelper.ts +21 -1
- package/src/engine-components/BoxHelperComponent.ts +26 -0
- package/src/engine-components/Camera.ts +147 -41
- package/src/engine-components/CameraUtils.ts +20 -0
- package/src/engine-components/Collider.ts +102 -27
- package/src/engine-components/Component.ts +605 -129
- package/src/engine-components/DragControls.ts +134 -38
- package/src/engine-components/DropListener.ts +143 -23
- package/src/engine-components/Light.ts +105 -44
- package/src/engine-components/NeedleMenu.ts +29 -11
- package/src/engine-components/Networking.ts +37 -6
- package/src/engine-components/SceneSwitcher.ts +48 -1
- package/src/engine-components/SpatialTrigger.ts +80 -3
- package/src/engine-components/SpectatorCamera.ts +136 -18
- package/src/engine-components/SyncedTransform.ts +50 -7
- package/src/engine-components/TransformGizmo.ts +49 -4
- package/src/engine-components/webxr/WebXR.ts +144 -27
- package/src/engine-components-experimental/networking/PlayerSync.ts +85 -13
|
@@ -11,19 +11,39 @@ import { getObjectAnimated } from "./AnimationUtils.js";
|
|
|
11
11
|
import { AnimatorController } from "./AnimatorController.js";
|
|
12
12
|
import { Behaviour } from "./Component.js";
|
|
13
13
|
const debug = getParam("debuganimator");
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
14
|
+
/**
|
|
15
|
+
* The Animator component plays and manages animations on a GameObject.
|
|
16
|
+
* It works with an AnimatorController to handle state transitions and animation blending.
|
|
17
|
+
* A new AnimatorController can be created from code via `AnimatorController.createFromClips`.
|
|
16
18
|
* @category Animation and Sequencing
|
|
17
19
|
* @group Components
|
|
18
20
|
*/
|
|
19
21
|
export class Animator extends Behaviour {
|
|
22
|
+
/**
|
|
23
|
+
* Identifies this component as an animation component in the engine
|
|
24
|
+
*/
|
|
20
25
|
get isAnimationComponent() {
|
|
21
26
|
return true;
|
|
22
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* When enabled, animation will affect the root transform position and rotation
|
|
30
|
+
*/
|
|
23
31
|
applyRootMotion = false;
|
|
32
|
+
/**
|
|
33
|
+
* Indicates whether this animator contains root motion data
|
|
34
|
+
*/
|
|
24
35
|
hasRootMotion = false;
|
|
36
|
+
/**
|
|
37
|
+
* When enabled, the animator will maintain its state when the component is disabled
|
|
38
|
+
*/
|
|
25
39
|
keepAnimatorControllerStateOnDisable = false;
|
|
26
40
|
// set from needle animator extension
|
|
41
|
+
/**
|
|
42
|
+
* Sets or replaces the animator controller for this component.
|
|
43
|
+
* Handles binding the controller to this animator instance and ensures
|
|
44
|
+
* proper initialization when the controller changes.
|
|
45
|
+
* @param val The animator controller model or instance to use
|
|
46
|
+
*/
|
|
27
47
|
set runtimeAnimatorController(val) {
|
|
28
48
|
if (this._animatorController && this._animatorController.model === val) {
|
|
29
49
|
return;
|
|
@@ -51,50 +71,68 @@ export class Animator extends Behaviour {
|
|
|
51
71
|
else
|
|
52
72
|
this._animatorController = null;
|
|
53
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Gets the current animator controller instance
|
|
76
|
+
* @returns The current animator controller or null if none is assigned
|
|
77
|
+
*/
|
|
54
78
|
get runtimeAnimatorController() {
|
|
55
79
|
return this._animatorController;
|
|
56
80
|
}
|
|
57
|
-
/**
|
|
58
|
-
*
|
|
59
|
-
* @returns
|
|
60
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Retrieves information about the current animation state
|
|
83
|
+
* @returns The current state information, or undefined if no state is playing
|
|
84
|
+
*/
|
|
61
85
|
getCurrentStateInfo() {
|
|
62
86
|
return this.runtimeAnimatorController?.getCurrentStateInfo();
|
|
63
87
|
}
|
|
64
|
-
/**
|
|
65
|
-
*
|
|
66
|
-
|
|
88
|
+
/**
|
|
89
|
+
* The currently playing animation action that can be used to modify animation properties
|
|
90
|
+
* @returns The current animation action, or null if no animation is playing
|
|
91
|
+
*/
|
|
67
92
|
get currentAction() {
|
|
68
93
|
return this.runtimeAnimatorController?.currentAction || null;
|
|
69
94
|
}
|
|
70
|
-
/**
|
|
95
|
+
/**
|
|
96
|
+
* Indicates whether animation parameters have been modified since the last update
|
|
97
|
+
* @returns True if parameters have been changed
|
|
98
|
+
*/
|
|
71
99
|
get parametersAreDirty() { return this._parametersAreDirty; }
|
|
72
100
|
_parametersAreDirty = false;
|
|
73
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Indicates whether the animator state has changed since the last update
|
|
103
|
+
* @returns True if the animator has been changed
|
|
104
|
+
*/
|
|
74
105
|
get isDirty() { return this._isDirty; }
|
|
75
106
|
_isDirty = false;
|
|
76
107
|
/**@deprecated use play() */
|
|
77
108
|
Play(name, layer = -1, normalizedTime = Number.NEGATIVE_INFINITY, transitionDurationInSec = 0) { this.play(name, layer, normalizedTime, transitionDurationInSec); }
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @param
|
|
81
|
-
* @param
|
|
82
|
-
* @param
|
|
83
|
-
* @
|
|
84
|
-
|
|
109
|
+
/**
|
|
110
|
+
* Plays an animation on the animator
|
|
111
|
+
* @param name The name or hash of the animation to play
|
|
112
|
+
* @param layer The layer to play the animation on (-1 for default layer)
|
|
113
|
+
* @param normalizedTime The time position to start playing (0-1 range, NEGATIVE_INFINITY for current position)
|
|
114
|
+
* @param transitionDurationInSec The duration of the blend transition in seconds
|
|
115
|
+
*/
|
|
85
116
|
play(name, layer = -1, normalizedTime = Number.NEGATIVE_INFINITY, transitionDurationInSec = 0) {
|
|
86
117
|
this.runtimeAnimatorController?.play(name, layer, normalizedTime, transitionDurationInSec);
|
|
87
118
|
this._isDirty = true;
|
|
88
119
|
}
|
|
89
120
|
/**@deprecated use reset */
|
|
90
121
|
Reset() { this.reset(); }
|
|
91
|
-
/**
|
|
122
|
+
/**
|
|
123
|
+
* Resets the animator controller to its initial state
|
|
124
|
+
*/
|
|
92
125
|
reset() {
|
|
93
126
|
this._animatorController?.reset();
|
|
94
127
|
this._isDirty = true;
|
|
95
128
|
}
|
|
96
129
|
/**@deprecated use setBool */
|
|
97
130
|
SetBool(name, val) { this.setBool(name, val); }
|
|
131
|
+
/**
|
|
132
|
+
* Sets a boolean parameter in the animator
|
|
133
|
+
* @param name The name or hash of the parameter
|
|
134
|
+
* @param value The boolean value to set
|
|
135
|
+
*/
|
|
98
136
|
setBool(name, value) {
|
|
99
137
|
if (debug)
|
|
100
138
|
console.log("setBool", name, value);
|
|
@@ -104,17 +142,31 @@ export class Animator extends Behaviour {
|
|
|
104
142
|
}
|
|
105
143
|
/**@deprecated use getBool */
|
|
106
144
|
GetBool(name) { return this.getBool(name); }
|
|
145
|
+
/**
|
|
146
|
+
* Gets a boolean parameter from the animator
|
|
147
|
+
* @param name The name or hash of the parameter
|
|
148
|
+
* @returns The value of the boolean parameter, or false if not found
|
|
149
|
+
*/
|
|
107
150
|
getBool(name) {
|
|
108
151
|
const res = this.runtimeAnimatorController?.getBool(name) ?? false;
|
|
109
152
|
if (debug)
|
|
110
153
|
console.log("getBool", name, res);
|
|
111
154
|
return res;
|
|
112
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* Toggles a boolean parameter between true and false
|
|
158
|
+
* @param name The name or hash of the parameter
|
|
159
|
+
*/
|
|
113
160
|
toggleBool(name) {
|
|
114
161
|
this.setBool(name, !this.getBool(name));
|
|
115
162
|
}
|
|
116
163
|
/**@deprecated use setFloat */
|
|
117
164
|
SetFloat(name, val) { this.setFloat(name, val); }
|
|
165
|
+
/**
|
|
166
|
+
* Sets a float parameter in the animator
|
|
167
|
+
* @param name The name or hash of the parameter
|
|
168
|
+
* @param val The float value to set
|
|
169
|
+
*/
|
|
118
170
|
setFloat(name, val) {
|
|
119
171
|
if (this.runtimeAnimatorController?.getFloat(name) !== val)
|
|
120
172
|
this._parametersAreDirty = true;
|
|
@@ -124,6 +176,11 @@ export class Animator extends Behaviour {
|
|
|
124
176
|
}
|
|
125
177
|
/**@deprecated use getFloat */
|
|
126
178
|
GetFloat(name) { return this.getFloat(name); }
|
|
179
|
+
/**
|
|
180
|
+
* Gets a float parameter from the animator
|
|
181
|
+
* @param name The name or hash of the parameter
|
|
182
|
+
* @returns The value of the float parameter, or -1 if not found
|
|
183
|
+
*/
|
|
127
184
|
getFloat(name) {
|
|
128
185
|
const res = this.runtimeAnimatorController?.getFloat(name) ?? -1;
|
|
129
186
|
if (debug)
|
|
@@ -132,6 +189,11 @@ export class Animator extends Behaviour {
|
|
|
132
189
|
}
|
|
133
190
|
/**@deprecated use setInteger */
|
|
134
191
|
SetInteger(name, val) { this.setInteger(name, val); }
|
|
192
|
+
/**
|
|
193
|
+
* Sets an integer parameter in the animator
|
|
194
|
+
* @param name The name or hash of the parameter
|
|
195
|
+
* @param val The integer value to set
|
|
196
|
+
*/
|
|
135
197
|
setInteger(name, val) {
|
|
136
198
|
if (this.runtimeAnimatorController?.getInteger(name) !== val)
|
|
137
199
|
this._parametersAreDirty = true;
|
|
@@ -141,6 +203,11 @@ export class Animator extends Behaviour {
|
|
|
141
203
|
}
|
|
142
204
|
/**@deprecated use getInteger */
|
|
143
205
|
GetInteger(name) { return this.getInteger(name); }
|
|
206
|
+
/**
|
|
207
|
+
* Gets an integer parameter from the animator
|
|
208
|
+
* @param name The name or hash of the parameter
|
|
209
|
+
* @returns The value of the integer parameter, or -1 if not found
|
|
210
|
+
*/
|
|
144
211
|
getInteger(name) {
|
|
145
212
|
const res = this.runtimeAnimatorController?.getInteger(name) ?? -1;
|
|
146
213
|
if (debug)
|
|
@@ -149,6 +216,10 @@ export class Animator extends Behaviour {
|
|
|
149
216
|
}
|
|
150
217
|
/**@deprecated use setTrigger */
|
|
151
218
|
SetTrigger(name) { this.setTrigger(name); }
|
|
219
|
+
/**
|
|
220
|
+
* Activates a trigger parameter in the animator
|
|
221
|
+
* @param name The name or hash of the trigger parameter
|
|
222
|
+
*/
|
|
152
223
|
setTrigger(name) {
|
|
153
224
|
this._parametersAreDirty = true;
|
|
154
225
|
if (debug)
|
|
@@ -157,6 +228,10 @@ export class Animator extends Behaviour {
|
|
|
157
228
|
}
|
|
158
229
|
/**@deprecated use resetTrigger */
|
|
159
230
|
ResetTrigger(name) { this.resetTrigger(name); }
|
|
231
|
+
/**
|
|
232
|
+
* Resets a trigger parameter in the animator
|
|
233
|
+
* @param name The name or hash of the trigger parameter
|
|
234
|
+
*/
|
|
160
235
|
resetTrigger(name) {
|
|
161
236
|
this._parametersAreDirty = true;
|
|
162
237
|
if (debug)
|
|
@@ -165,6 +240,11 @@ export class Animator extends Behaviour {
|
|
|
165
240
|
}
|
|
166
241
|
/**@deprecated use getTrigger */
|
|
167
242
|
GetTrigger(name) { this.getTrigger(name); }
|
|
243
|
+
/**
|
|
244
|
+
* Gets the state of a trigger parameter from the animator
|
|
245
|
+
* @param name The name or hash of the trigger parameter
|
|
246
|
+
* @returns The state of the trigger parameter
|
|
247
|
+
*/
|
|
168
248
|
getTrigger(name) {
|
|
169
249
|
const res = this.runtimeAnimatorController?.getTrigger(name);
|
|
170
250
|
if (debug)
|
|
@@ -173,12 +253,19 @@ export class Animator extends Behaviour {
|
|
|
173
253
|
}
|
|
174
254
|
/**@deprecated use isInTransition */
|
|
175
255
|
IsInTransition() { return this.isInTransition(); }
|
|
176
|
-
/**
|
|
256
|
+
/**
|
|
257
|
+
* Checks if the animator is currently in a transition between states
|
|
258
|
+
* @returns True if the animator is currently blending between animations
|
|
259
|
+
*/
|
|
177
260
|
isInTransition() {
|
|
178
261
|
return this.runtimeAnimatorController?.isInTransition() ?? false;
|
|
179
262
|
}
|
|
180
263
|
/**@deprecated use setSpeed */
|
|
181
264
|
SetSpeed(speed) { return this.setSpeed(speed); }
|
|
265
|
+
/**
|
|
266
|
+
* Sets the playback speed of the animator
|
|
267
|
+
* @param speed The new playback speed multiplier
|
|
268
|
+
*/
|
|
182
269
|
setSpeed(speed) {
|
|
183
270
|
if (speed === this._speed)
|
|
184
271
|
return;
|
|
@@ -188,12 +275,19 @@ export class Animator extends Behaviour {
|
|
|
188
275
|
if (this._animatorController?.animator == this)
|
|
189
276
|
this._animatorController.setSpeed(speed);
|
|
190
277
|
}
|
|
191
|
-
/**
|
|
278
|
+
/**
|
|
279
|
+
* Sets a random playback speed between the min and max values
|
|
280
|
+
* @param minMax Object with x (minimum) and y (maximum) speed values
|
|
281
|
+
*/
|
|
192
282
|
set minMaxSpeed(minMax) {
|
|
193
283
|
this._speed = Mathf.lerp(minMax.x, minMax.y, Math.random());
|
|
194
284
|
if (this._animatorController?.animator == this)
|
|
195
285
|
this._animatorController.setSpeed(this._speed);
|
|
196
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Sets a random normalized time offset for animations between min (x) and max (y) values
|
|
289
|
+
* @param minMax Object with x (min) and y (max) values for the offset range
|
|
290
|
+
*/
|
|
197
291
|
set minMaxOffsetNormalized(minMax) {
|
|
198
292
|
this._normalizedStartOffset = Mathf.lerp(minMax.x, minMax.y, Math.random());
|
|
199
293
|
if (this.runtimeAnimatorController?.animator == this)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Animator.js","sourceRoot":"","sources":["../../src/engine-components/Animator.ts"],"names":[],"mappings":";;;;;;AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAE3E,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,KAAK,GAAG,QAAQ,CAAC,eAAe,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Animator.js","sourceRoot":"","sources":["../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AG,KAAK,CAAC;YACtD,IAAI,KAAK,EAAE;gBACP,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,KAAK,KAAK,CAAC,CAAC;gBACzD,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC;gBACvC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,KAAK,KAAK,CAAC,CAAC;gBACzD,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBAC1C,IAAI,CAAC,yBAAyB,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACrD,IAAI,CAAC,yBAAyB,CAAC,qBAAqB,GAAG,IAAI,CAAC,sBAAsB,CAAC;aACtF;;gBACI,OAAO,CAAC,IAAI,CAAC,qCAAqC,EAAE,IAAI,CAAC,yBAAyB,CAAC,CAAC;SAC5F;IACL,CAAC;IAED,SAAS;QACL,IAAI,CAAC,IAAI,CAAC,oCAAoC;YAC1C,IAAI,CAAC,mBAAmB,EAAE,KAAK,EAAE,CAAC;IAC1C,CAAC;IAED,cAAc;QACV,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACtB,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QAEjC,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAChE,IAAI,oBAAoB;YAAE,OAAO;QAEjC,IAAI,IAAI,CAAC,mBAAmB,EAAE;YAC1B,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACtC;IACL,CAAC;CACJ;AAlVG;IADC,YAAY,EAAE;iDACkB;AAMjC;IADC,YAAY,EAAE;+CACgB;AAM/B;IADC,YAAY,EAAE;sEACuC;AAUtD;IADC,YAAY,EAAE;yDAyBd"}
|
|
@@ -3,78 +3,203 @@ import { Context } from "../engine/engine_setup.js";
|
|
|
3
3
|
import type { AnimatorControllerModel, State } from "../engine/extensions/NEEDLE_animator_controller_model.js";
|
|
4
4
|
import { AnimatorStateInfo } from "../engine/extensions/NEEDLE_animator_controller_model.js";
|
|
5
5
|
import { Animator } from "./Animator.js";
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for creating an AnimatorController
|
|
8
|
+
*/
|
|
6
9
|
declare type CreateAnimatorControllerOptions = {
|
|
7
|
-
/** Should each
|
|
10
|
+
/** Should each animation state loop */
|
|
8
11
|
looping?: boolean;
|
|
9
|
-
/** Set to false to disable generating transitions between
|
|
12
|
+
/** Set to false to disable generating transitions between animation clips */
|
|
10
13
|
autoTransition?: boolean;
|
|
11
|
-
/**
|
|
14
|
+
/** Duration in seconds for transitions between states */
|
|
12
15
|
transitionDuration?: number;
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
|
|
18
|
+
* Controls the playback of animations using a state machine architecture.
|
|
19
|
+
*
|
|
20
|
+
* The AnimatorController manages animation states, transitions between states,
|
|
21
|
+
* and parameters that affect those transitions. It is used by the {@link Animator}
|
|
22
|
+
* component to control animation behavior on 3D models.
|
|
23
|
+
*
|
|
24
|
+
* Use the static method {@link AnimatorController.createFromClips} to create
|
|
25
|
+
* an animator controller from a set of animation clips.
|
|
26
|
+
*/
|
|
19
27
|
export declare class AnimatorController {
|
|
20
|
-
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Creates an AnimatorController from a set of animation clips.
|
|
30
|
+
* Each clip becomes a state in the controller's state machine.
|
|
31
|
+
*
|
|
32
|
+
* @param clips - The animation clips to use for creating states
|
|
33
|
+
* @param options - Configuration options for the controller including looping behavior and transitions
|
|
34
|
+
* @returns A new AnimatorController instance
|
|
35
|
+
*/
|
|
25
36
|
static createFromClips(clips: AnimationClip[], options?: CreateAnimatorControllerOptions): AnimatorController;
|
|
37
|
+
/**
|
|
38
|
+
* Plays an animation state by name or hash.
|
|
39
|
+
*
|
|
40
|
+
* @param name - The name or hash identifier of the state to play
|
|
41
|
+
* @param layerIndex - The layer index (defaults to 0)
|
|
42
|
+
* @param normalizedTime - The normalized time to start the animation from (0-1)
|
|
43
|
+
* @param durationInSec - Transition duration in seconds
|
|
44
|
+
*/
|
|
26
45
|
play(name: string | number, layerIndex?: number, normalizedTime?: number, durationInSec?: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* Resets the controller to its initial state.
|
|
48
|
+
*/
|
|
27
49
|
reset(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Sets a boolean parameter value by name or hash.
|
|
52
|
+
*
|
|
53
|
+
* @param name - The name or hash identifier of the parameter
|
|
54
|
+
* @param value - The boolean value to set
|
|
55
|
+
*/
|
|
28
56
|
setBool(name: string | number, value: boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* Gets a boolean parameter value by name or hash.
|
|
59
|
+
*
|
|
60
|
+
* @param name - The name or hash identifier of the parameter
|
|
61
|
+
* @returns The boolean value of the parameter, or false if not found
|
|
62
|
+
*/
|
|
29
63
|
getBool(name: string | number): boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Sets a float parameter value by name or hash.
|
|
66
|
+
*
|
|
67
|
+
* @param name - The name or hash identifier of the parameter
|
|
68
|
+
* @param val - The float value to set
|
|
69
|
+
* @returns True if the parameter was found and set, false otherwise
|
|
70
|
+
*/
|
|
30
71
|
setFloat(name: string | number, val: number): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Gets a float parameter value by name or hash.
|
|
74
|
+
*
|
|
75
|
+
* @param name - The name or hash identifier of the parameter
|
|
76
|
+
* @returns The float value of the parameter, or 0 if not found
|
|
77
|
+
*/
|
|
31
78
|
getFloat(name: string | number): number;
|
|
79
|
+
/**
|
|
80
|
+
* Sets an integer parameter value by name or hash.
|
|
81
|
+
*
|
|
82
|
+
* @param name - The name or hash identifier of the parameter
|
|
83
|
+
* @param val - The integer value to set
|
|
84
|
+
*/
|
|
32
85
|
setInteger(name: string | number, val: number): void;
|
|
86
|
+
/**
|
|
87
|
+
* Gets an integer parameter value by name or hash.
|
|
88
|
+
*
|
|
89
|
+
* @param name - The name or hash identifier of the parameter
|
|
90
|
+
* @returns The integer value of the parameter, or 0 if not found
|
|
91
|
+
*/
|
|
33
92
|
getInteger(name: string | number): number;
|
|
93
|
+
/**
|
|
94
|
+
* Sets a trigger parameter to active (true).
|
|
95
|
+
* Trigger parameters are automatically reset after they are consumed by a transition.
|
|
96
|
+
*
|
|
97
|
+
* @param name - The name or hash identifier of the trigger parameter
|
|
98
|
+
*/
|
|
34
99
|
setTrigger(name: string | number): void;
|
|
100
|
+
/**
|
|
101
|
+
* Resets a trigger parameter to inactive (false).
|
|
102
|
+
*
|
|
103
|
+
* @param name - The name or hash identifier of the trigger parameter
|
|
104
|
+
*/
|
|
35
105
|
resetTrigger(name: string | number): void;
|
|
106
|
+
/**
|
|
107
|
+
* Gets the current state of a trigger parameter.
|
|
108
|
+
*
|
|
109
|
+
* @param name - The name or hash identifier of the trigger parameter
|
|
110
|
+
* @returns The boolean state of the trigger, or false if not found
|
|
111
|
+
*/
|
|
36
112
|
getTrigger(name: string | number): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Checks if the controller is currently in a transition between states.
|
|
115
|
+
*
|
|
116
|
+
* @returns True if a transition is in progress, false otherwise
|
|
117
|
+
*/
|
|
37
118
|
isInTransition(): boolean;
|
|
38
119
|
/** Set the speed of the animator controller. Larger values will make the animation play faster. */
|
|
39
120
|
setSpeed(speed: number): void;
|
|
40
121
|
private _speed;
|
|
41
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Finds an animation state by name or hash.
|
|
124
|
+
* @deprecated Use findState instead
|
|
125
|
+
*
|
|
126
|
+
* @param name - The name or hash identifier of the state to find
|
|
127
|
+
* @returns The found state or null if not found
|
|
128
|
+
*/
|
|
42
129
|
FindState(name: string | number | undefined | null): State | null;
|
|
130
|
+
/**
|
|
131
|
+
* Finds an animation state by name or hash.
|
|
132
|
+
*
|
|
133
|
+
* @param name - The name or hash identifier of the state to find
|
|
134
|
+
* @returns The found state or null if not found
|
|
135
|
+
*/
|
|
43
136
|
findState(name: string | number | undefined | null): State | null;
|
|
44
|
-
/**
|
|
45
|
-
*
|
|
46
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Gets information about the current playing animation state.
|
|
139
|
+
*
|
|
140
|
+
* @returns An AnimatorStateInfo object with data about the current state, or null if no state is active
|
|
141
|
+
*/
|
|
47
142
|
getCurrentStateInfo(): AnimatorStateInfo | null;
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Gets the animation action currently playing.
|
|
145
|
+
*
|
|
146
|
+
* @returns The current animation action, or null if no action is playing
|
|
147
|
+
*/
|
|
52
148
|
get currentAction(): AnimationAction | null;
|
|
53
|
-
/**
|
|
149
|
+
/**
|
|
150
|
+
* The normalized time (0-1) to start playing the first state at.
|
|
151
|
+
* This affects the initial state when the animator is first enabled.
|
|
152
|
+
*/
|
|
54
153
|
normalizedStartOffset: number;
|
|
55
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* The Animator component this controller is bound to.
|
|
156
|
+
*/
|
|
56
157
|
animator?: Animator;
|
|
57
|
-
/**
|
|
158
|
+
/**
|
|
159
|
+
* The data model describing the animation states and transitions.
|
|
160
|
+
*/
|
|
58
161
|
model: AnimatorControllerModel;
|
|
59
|
-
/**
|
|
162
|
+
/**
|
|
163
|
+
* Gets the engine context from the bound animator.
|
|
164
|
+
*/
|
|
60
165
|
get context(): Context | undefined | null;
|
|
61
|
-
/**
|
|
166
|
+
/**
|
|
167
|
+
* Gets the animation mixer used by this controller.
|
|
168
|
+
*/
|
|
62
169
|
get mixer(): AnimationMixer;
|
|
63
170
|
/**
|
|
64
|
-
*
|
|
171
|
+
* Cleans up resources used by this controller.
|
|
172
|
+
* Stops all animations and unregisters the mixer from the animation system.
|
|
65
173
|
*/
|
|
66
174
|
dispose(): void;
|
|
67
|
-
/**
|
|
175
|
+
/**
|
|
176
|
+
* Binds this controller to an animator component.
|
|
177
|
+
* Creates a new animation mixer and sets up animation actions.
|
|
178
|
+
*
|
|
179
|
+
* @param animator - The animator to bind this controller to
|
|
180
|
+
*/
|
|
68
181
|
bind(animator: Animator): void;
|
|
69
|
-
/**
|
|
182
|
+
/**
|
|
183
|
+
* Creates a deep copy of this controller.
|
|
184
|
+
* Clones the model data but does not copy runtime state.
|
|
185
|
+
*
|
|
186
|
+
* @returns A new AnimatorController instance with the same configuration
|
|
187
|
+
*/
|
|
70
188
|
clone(): AnimatorController | null;
|
|
71
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* Updates the controller's state machine and animations.
|
|
191
|
+
* Called each frame by the animator component.
|
|
192
|
+
*
|
|
193
|
+
* @param weight - The weight to apply to the animations (for blending)
|
|
194
|
+
*/
|
|
72
195
|
update(weight: number): void;
|
|
73
196
|
private _mixer;
|
|
74
197
|
private _activeState?;
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Gets the currently active animation state.
|
|
200
|
+
*
|
|
201
|
+
* @returns The active state or undefined if no state is active
|
|
202
|
+
*/
|
|
78
203
|
get activeState(): State | undefined;
|
|
79
204
|
constructor(model: AnimatorControllerModel);
|
|
80
205
|
private _activeStates;
|
|
@@ -92,6 +217,10 @@ export declare class AnimatorController {
|
|
|
92
217
|
private createAction;
|
|
93
218
|
private evaluateCondition;
|
|
94
219
|
private createActions;
|
|
220
|
+
/**
|
|
221
|
+
* Yields all animation actions managed by this controller.
|
|
222
|
+
* Iterates through all states in all layers and returns their actions.
|
|
223
|
+
*/
|
|
95
224
|
enumerateActions(): Generator<AnimationAction, void, unknown>;
|
|
96
225
|
private rootMotionHandler?;
|
|
97
226
|
}
|