@auraindustry/aurajs 0.1.3 → 0.1.5

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.
Files changed (108) hide show
  1. package/README.md +7 -0
  2. package/benchmarks/perf-thresholds.json +27 -0
  3. package/package.json +6 -1
  4. package/src/ai-guidance.mjs +302 -0
  5. package/src/authored-project.mjs +498 -2
  6. package/src/build-contract/capabilities.mjs +87 -1
  7. package/src/build-contract/constants.mjs +1 -0
  8. package/src/build-contract.mjs +2 -0
  9. package/src/bundler.mjs +143 -13
  10. package/src/cli.mjs +681 -13
  11. package/src/commands/packs.mjs +741 -0
  12. package/src/commands/project-authoring.mjs +128 -1
  13. package/src/conformance/cases/app-and-ui-runtime-cases.mjs +1 -2
  14. package/src/conformance/cases/core-runtime-cases.mjs +6 -2
  15. package/src/conformance/cases/scene3d-and-media-cases.mjs +238 -0
  16. package/src/conformance/cases/systems-and-gameplay-cases.mjs +265 -4
  17. package/src/conformance-mobile.mjs +166 -0
  18. package/src/conformance.mjs +89 -30
  19. package/src/evidence-bundle.mjs +242 -0
  20. package/src/headless-test/runtime-coordinator.mjs +186 -33
  21. package/src/headless-test.mjs +2 -0
  22. package/src/helpers/2d/index.mjs +183 -0
  23. package/src/helpers/index.mjs +26 -0
  24. package/src/helpers/starter-utils/adventure-objectives.js +102 -0
  25. package/src/helpers/starter-utils/adventure-world-2d.js +221 -0
  26. package/src/helpers/starter-utils/animation-2d.js +337 -0
  27. package/src/helpers/starter-utils/animation-packaging-2d.js +203 -0
  28. package/src/helpers/starter-utils/atlas-assets-2d.js +111 -0
  29. package/src/helpers/starter-utils/autoplay-debug-2d.js +215 -0
  30. package/src/helpers/starter-utils/avatar-3d.js +404 -0
  31. package/src/helpers/starter-utils/combat-feedback-2d.js +320 -0
  32. package/src/helpers/starter-utils/combat-runtime-2d.js +290 -0
  33. package/src/helpers/starter-utils/core.js +150 -0
  34. package/src/helpers/starter-utils/dialogue-2d.js +351 -0
  35. package/src/helpers/starter-utils/enemy-archetypes-2d.js +68 -0
  36. package/src/helpers/starter-utils/index.js +26 -0
  37. package/src/helpers/starter-utils/inventory-2d.js +268 -0
  38. package/src/helpers/starter-utils/journal-2d.js +267 -0
  39. package/src/helpers/starter-utils/platformer-3d.js +132 -0
  40. package/src/helpers/starter-utils/scene-audio-2d.js +236 -0
  41. package/src/helpers/starter-utils/streamed-world-2d.js +378 -0
  42. package/src/helpers/starter-utils/tilemap-nav-2d.js +499 -0
  43. package/src/helpers/starter-utils/tilemap-world-2d.js +205 -0
  44. package/src/helpers/starter-utils/triggers.js +662 -0
  45. package/src/helpers/starter-utils/tween-2d.js +615 -0
  46. package/src/helpers/starter-utils/wave-director.js +101 -0
  47. package/src/helpers/starter-utils/world-compositor-2d.js +253 -0
  48. package/src/helpers/starter-utils/world-persistence-2d.js +180 -0
  49. package/src/mobile/android/build.mjs +606 -0
  50. package/src/mobile/android/host-artifact.mjs +280 -0
  51. package/src/mobile/ios/build.mjs +1323 -0
  52. package/src/mobile/ios/host-artifact.mjs +819 -0
  53. package/src/mobile/shared/capabilities.mjs +174 -0
  54. package/src/packs/catalog.mjs +259 -0
  55. package/src/perf-benchmark-runner.mjs +17 -12
  56. package/src/perf-benchmark.mjs +408 -4
  57. package/src/publish-command.mjs +303 -6
  58. package/src/replay-runtime.mjs +257 -0
  59. package/src/scaffold/config.mjs +2 -0
  60. package/src/scaffold/fs.mjs +8 -1
  61. package/src/scaffold/project-docs.mjs +43 -1
  62. package/src/scaffold.mjs +4 -0
  63. package/src/session-runtime.mjs +4 -3
  64. package/src/web-conformance.mjs +0 -36
  65. package/templates/create/2d-adventure/config/gameplay/adventure.config.js +9 -6
  66. package/templates/create/2d-adventure/content/gameplay/dialogue.js +85 -0
  67. package/templates/create/2d-adventure/content/gameplay/world.js +32 -36
  68. package/templates/create/2d-adventure/content/gameplay/world.tilemap.json +273 -0
  69. package/templates/create/2d-adventure/docs/design/loop.md +4 -3
  70. package/templates/create/2d-adventure/prefabs/relic.prefab.js +10 -10
  71. package/templates/create/2d-adventure/prefabs/world.prefab.js +127 -74
  72. package/templates/create/2d-adventure/scenes/gameplay.scene.js +603 -112
  73. package/templates/create/2d-adventure/src/runtime/capabilities.js +16 -0
  74. package/templates/create/2d-adventure/ui/hud.screen.js +187 -4
  75. package/templates/create/2d-adventure/ui/journal.screen.js +183 -0
  76. package/templates/create/3d/scenes/gameplay.scene.js +30 -3
  77. package/templates/create/3d/src/runtime/capabilities.js +5 -0
  78. package/templates/create/3d/src/runtime/materials.js +10 -0
  79. package/templates/create/3d-adventure/scenes/gameplay.scene.js +30 -3
  80. package/templates/create/3d-adventure/src/runtime/capabilities.js +5 -0
  81. package/templates/create/3d-adventure/src/runtime/materials.js +11 -0
  82. package/templates/create/3d-collectathon/scenes/gameplay.scene.js +30 -3
  83. package/templates/create/3d-collectathon/src/runtime/capabilities.js +5 -0
  84. package/templates/create/3d-collectathon/src/runtime/materials.js +10 -0
  85. package/templates/create/shared/src/runtime/ui-forms.js +552 -0
  86. package/templates/create/shared/src/starter-utils/adventure-world-2d.js +221 -0
  87. package/templates/create/shared/src/starter-utils/animation-packaging-2d.js +203 -0
  88. package/templates/create/shared/src/starter-utils/atlas-assets-2d.js +111 -0
  89. package/templates/create/shared/src/starter-utils/autoplay-debug-2d.js +215 -0
  90. package/templates/create/shared/src/starter-utils/combat-runtime-2d.js +290 -0
  91. package/templates/create/shared/src/starter-utils/dialogue-2d.js +351 -0
  92. package/templates/create/shared/src/starter-utils/index.js +15 -1
  93. package/templates/create/shared/src/starter-utils/inventory-2d.js +268 -0
  94. package/templates/create/shared/src/starter-utils/journal-2d.js +267 -0
  95. package/templates/create/shared/src/starter-utils/scene-audio-2d.js +236 -0
  96. package/templates/create/shared/src/starter-utils/streamed-world-2d.js +378 -0
  97. package/templates/create/shared/src/starter-utils/tilemap-nav-2d.js +499 -0
  98. package/templates/create/shared/src/starter-utils/tilemap-world-2d.js +205 -0
  99. package/templates/create/shared/src/starter-utils/world-compositor-2d.js +253 -0
  100. package/templates/create/shared/src/starter-utils/world-persistence-2d.js +180 -0
  101. package/templates/create-bin/play.js +36 -7
  102. package/templates/skills/auramaxx/SKILL.md +46 -0
  103. package/templates/skills/auramaxx/project-requirements.md +68 -0
  104. package/templates/skills/auramaxx/starter-recipes.md +104 -0
  105. package/templates/skills/auramaxx/validation-checklist.md +49 -0
  106. package/templates/skills/aurajs/SKILL.md +0 -96
  107. package/templates/skills/aurajs/api-contract-3d.md +0 -7
  108. package/templates/skills/aurajs/api-contract.md +0 -7
@@ -0,0 +1,404 @@
1
+ import { clamp } from './core.js';
2
+
3
+ function finite(value, fallback = 0) {
4
+ const numeric = Number(value);
5
+ return Number.isFinite(numeric) ? numeric : fallback;
6
+ }
7
+
8
+ function normalizeVec3(value, fallback = {}) {
9
+ return {
10
+ x: finite(value?.x, finite(fallback?.x, 0)),
11
+ y: finite(value?.y, finite(fallback?.y, 0)),
12
+ z: finite(value?.z, finite(fallback?.z, 0)),
13
+ };
14
+ }
15
+
16
+ function normalizeScale(value, fallback = {}) {
17
+ return {
18
+ x: Math.max(0.001, finite(value?.x, Math.max(0.001, finite(fallback?.x, 1)))),
19
+ y: Math.max(0.001, finite(value?.y, Math.max(0.001, finite(fallback?.y, 1)))),
20
+ z: Math.max(0.001, finite(value?.z, Math.max(0.001, finite(fallback?.z, 1)))),
21
+ };
22
+ }
23
+
24
+ function normalizeClipMapEntry(entry) {
25
+ if (Number.isInteger(entry) && entry > 0) {
26
+ return { clipId: entry };
27
+ }
28
+ if (!entry || typeof entry !== 'object') {
29
+ return null;
30
+ }
31
+ return {
32
+ clipId: Number.isInteger(entry.clipId) && entry.clipId > 0 ? entry.clipId : null,
33
+ importId: Number.isInteger(entry.importId) && entry.importId > 0 ? entry.importId : null,
34
+ animation: typeof entry.animation === 'string' && entry.animation.trim().length > 0
35
+ ? entry.animation.trim()
36
+ : null,
37
+ loop: typeof entry.loop === 'boolean' ? entry.loop : null,
38
+ speed: Number.isFinite(Number(entry.speed)) ? Number(entry.speed) : null,
39
+ transitionSeconds: Math.max(0, finite(entry.transitionSeconds, 0.16)),
40
+ };
41
+ }
42
+
43
+ function cloneState(avatar) {
44
+ return {
45
+ bodyId: avatar.bodyId,
46
+ locomotion: avatar.locomotion,
47
+ grounded: avatar.grounded,
48
+ onSlope: avatar.onSlope,
49
+ velocityY: avatar.velocityY,
50
+ facingYaw: avatar.facingYaw,
51
+ position: { ...avatar.position },
52
+ movement: { ...avatar.motion },
53
+ camera: {
54
+ position: { ...avatar.cameraState.position },
55
+ target: { ...avatar.cameraState.target },
56
+ },
57
+ visual: {
58
+ activeClipKey: avatar.visual.activeClipKey,
59
+ activeClipId: avatar.visual.activeClipId,
60
+ sceneNodeId: avatar.visual.sceneNodeId,
61
+ renderTransform: getAvatarRenderTransform3D(avatar),
62
+ },
63
+ };
64
+ }
65
+
66
+ function clipCandidatesForLocomotion(locomotion) {
67
+ switch (locomotion) {
68
+ case 'run':
69
+ return ['run', 'walk', 'idle', 'default'];
70
+ case 'fall':
71
+ return ['fall', 'jump', 'idle', 'default'];
72
+ case 'jump':
73
+ return ['jump', 'fall', 'idle', 'default'];
74
+ case 'walk':
75
+ return ['walk', 'run', 'idle', 'default'];
76
+ default:
77
+ return [locomotion, 'idle', 'default'];
78
+ }
79
+ }
80
+
81
+ function resolveAvatarClipEntry(avatar, locomotion) {
82
+ const clipMap = avatar.visual.clipMap || {};
83
+ for (const candidate of clipCandidatesForLocomotion(locomotion)) {
84
+ if (!Object.prototype.hasOwnProperty.call(clipMap, candidate)) {
85
+ continue;
86
+ }
87
+ return normalizeClipMapEntry(clipMap[candidate]);
88
+ }
89
+ return null;
90
+ }
91
+
92
+ function ensureClipId(aura, avatar, locomotion) {
93
+ const entry = resolveAvatarClipEntry(avatar, locomotion);
94
+ if (!entry) return null;
95
+ if (Number.isInteger(entry.clipId) && entry.clipId > 0) {
96
+ return { ...entry, clipId: entry.clipId };
97
+ }
98
+ if (!entry.importId || !entry.animation || typeof aura?.scene3d?.playImportedAnimation !== 'function') {
99
+ return null;
100
+ }
101
+
102
+ const cacheKey = `${entry.importId}:${entry.animation}:${entry.loop === false ? '0' : '1'}:${entry.speed ?? 1}`;
103
+ const cached = avatar.visual.importedClipCache[cacheKey];
104
+ if (Number.isInteger(cached) && cached > 0) {
105
+ return { ...entry, clipId: cached };
106
+ }
107
+
108
+ const playback = aura.scene3d.playImportedAnimation(entry.importId, entry.animation, {
109
+ loop: entry.loop !== false,
110
+ speed: entry.speed ?? 1,
111
+ });
112
+ if (playback?.ok === true && Number.isInteger(playback.clipId) && playback.clipId > 0) {
113
+ avatar.visual.importedClipCache[cacheKey] = playback.clipId;
114
+ return { ...entry, clipId: playback.clipId };
115
+ }
116
+ return null;
117
+ }
118
+
119
+ function applyClipState(aura, avatar, locomotion) {
120
+ if (!aura?.scene3d || typeof aura.scene3d !== 'object') return;
121
+ const entry = ensureClipId(aura, avatar, locomotion);
122
+ if (!entry || !Number.isInteger(entry.clipId) || entry.clipId <= 0) return;
123
+
124
+ const nextClipId = entry.clipId;
125
+ const previousClipId = avatar.visual.activeClipId;
126
+ const stateChanged = avatar.visual.activeClipKey !== locomotion || previousClipId !== nextClipId;
127
+ if (!stateChanged) return;
128
+
129
+ if (typeof entry.loop === 'boolean' && typeof aura.scene3d.setClipLoop === 'function') {
130
+ aura.scene3d.setClipLoop(nextClipId, entry.loop);
131
+ }
132
+
133
+ const transitionSeconds = Math.max(0, finite(entry.transitionSeconds, 0.16));
134
+ if (
135
+ Number.isInteger(previousClipId)
136
+ && previousClipId > 0
137
+ && previousClipId !== nextClipId
138
+ && transitionSeconds > 0
139
+ && typeof aura.scene3d.crossfadeClips === 'function'
140
+ ) {
141
+ aura.scene3d.crossfadeClips(previousClipId, nextClipId, {
142
+ duration: transitionSeconds,
143
+ });
144
+ } else if (typeof aura.scene3d.playClip === 'function') {
145
+ aura.scene3d.playClip(nextClipId);
146
+ }
147
+
148
+ avatar.visual.activeClipKey = locomotion;
149
+ avatar.visual.activeClipId = nextClipId;
150
+ }
151
+
152
+ function syncSceneNodeTransform(aura, avatar) {
153
+ if (!Number.isInteger(avatar.visual.sceneNodeId) || avatar.visual.sceneNodeId <= 0) {
154
+ return;
155
+ }
156
+ if (typeof aura?.scene3d?.setLocalTransform !== 'function') {
157
+ return;
158
+ }
159
+ aura.scene3d.setLocalTransform(avatar.visual.sceneNodeId, getAvatarRenderTransform3D(avatar));
160
+ }
161
+
162
+ function syncCamera(aura, avatar) {
163
+ if (avatar.camera.enabled !== true) return;
164
+ if (typeof aura?.camera3d?.setPosition !== 'function' || typeof aura?.camera3d?.lookAt !== 'function') {
165
+ return;
166
+ }
167
+
168
+ let cameraOffset = avatar.camera.offset;
169
+ if (avatar.camera.rotateWithFacing === true) {
170
+ const cosine = Math.cos(avatar.facingYaw);
171
+ const sine = Math.sin(avatar.facingYaw);
172
+ cameraOffset = {
173
+ x: (avatar.camera.offset.x * cosine) - (avatar.camera.offset.z * sine),
174
+ y: avatar.camera.offset.y,
175
+ z: (avatar.camera.offset.x * sine) + (avatar.camera.offset.z * cosine),
176
+ };
177
+ }
178
+
179
+ const target = {
180
+ x: avatar.position.x + avatar.camera.lookOffset.x,
181
+ y: avatar.position.y + avatar.camera.lookOffset.y,
182
+ z: avatar.position.z + avatar.camera.lookOffset.z,
183
+ };
184
+ const position = {
185
+ x: avatar.position.x + cameraOffset.x,
186
+ y: avatar.position.y + cameraOffset.y,
187
+ z: avatar.position.z + cameraOffset.z,
188
+ };
189
+
190
+ avatar.cameraState = { position, target };
191
+ aura.camera3d.setPosition(position.x, position.y, position.z);
192
+ aura.camera3d.lookAt(target.x, target.y, target.z);
193
+ }
194
+
195
+ function resolveLocomotion(avatar, magnitude) {
196
+ if (!avatar.grounded) {
197
+ return avatar.velocityY > 0.2 ? 'jump' : 'fall';
198
+ }
199
+ if (magnitude >= 0.85) return 'run';
200
+ if (magnitude >= 0.1) return 'walk';
201
+ return 'idle';
202
+ }
203
+
204
+ export function createCharacterAvatar3D(options = {}) {
205
+ const radius = Math.max(0.1, finite(options.radius, 0.45));
206
+ const height = Math.max(radius * 2, finite(options.height, 1.1));
207
+ const visualScale = normalizeScale(options.visual?.scale, {
208
+ x: radius * 2,
209
+ y: height,
210
+ z: radius * 2,
211
+ });
212
+
213
+ return {
214
+ bodyId: null,
215
+ position: normalizeVec3(options.position, { x: 0, y: height * 0.5, z: 0 }),
216
+ grounded: false,
217
+ onSlope: false,
218
+ velocityY: 0,
219
+ facingYaw: finite(options.facingYaw, 0),
220
+ locomotion: 'idle',
221
+ motion: {
222
+ moveX: 0,
223
+ moveZ: 0,
224
+ magnitude: 0,
225
+ speed: 0,
226
+ },
227
+ input: {
228
+ moveX: 0,
229
+ moveZ: 0,
230
+ jump: false,
231
+ run: false,
232
+ },
233
+ movement: {
234
+ radius,
235
+ height,
236
+ stepHeight: Math.max(0.05, finite(options.stepHeight, 0.45)),
237
+ slopeLimit: Math.max(1, finite(options.slopeLimit, 48)),
238
+ gravity: Math.max(0, finite(options.gravity, 20)),
239
+ moveSpeed: Math.max(0, finite(options.moveSpeed, 5.3)),
240
+ runSpeed: Math.max(0, finite(options.runSpeed, Math.max(6.4, finite(options.moveSpeed, 5.3)))),
241
+ jumpSpeed: Math.max(0, finite(options.jumpSpeed, 8.2)),
242
+ },
243
+ visual: {
244
+ offset: normalizeVec3(options.visual?.offset),
245
+ scale: visualScale,
246
+ sceneNodeId: Number.isInteger(options.visual?.sceneNodeId) ? options.visual.sceneNodeId : null,
247
+ clipMap: options.visual?.clipMap && typeof options.visual.clipMap === 'object'
248
+ ? { ...options.visual.clipMap }
249
+ : {},
250
+ importedClipCache: {},
251
+ activeClipKey: null,
252
+ activeClipId: null,
253
+ },
254
+ camera: {
255
+ enabled: options.camera?.enabled !== false,
256
+ offset: normalizeVec3(options.camera?.offset, { x: 7.4, y: 6.0, z: 8.8 }),
257
+ lookOffset: normalizeVec3(options.camera?.lookOffset, { x: 0, y: 0.2, z: 0 }),
258
+ rotateWithFacing: options.camera?.rotateWithFacing === true,
259
+ },
260
+ cameraState: {
261
+ position: normalizeVec3(options.position, { x: 0, y: height * 0.5, z: 0 }),
262
+ target: normalizeVec3(options.position, { x: 0, y: height * 0.5, z: 0 }),
263
+ },
264
+ };
265
+ }
266
+
267
+ export function setAvatarInput3D(avatar, input = {}) {
268
+ avatar.input.moveX = clamp(finite(input.moveX, avatar.input.moveX), -1, 1);
269
+ avatar.input.moveZ = clamp(finite(input.moveZ, avatar.input.moveZ), -1, 1);
270
+ avatar.input.jump = input.jump === true;
271
+ avatar.input.run = input.run === true;
272
+ return avatar.input;
273
+ }
274
+
275
+ export function setAvatarVisual3D(avatar, options = {}) {
276
+ avatar.visual.offset = normalizeVec3(options.offset, avatar.visual.offset);
277
+ avatar.visual.scale = normalizeScale(options.scale, avatar.visual.scale);
278
+ if (Object.prototype.hasOwnProperty.call(options, 'sceneNodeId')) {
279
+ avatar.visual.sceneNodeId = Number.isInteger(options.sceneNodeId) ? options.sceneNodeId : null;
280
+ }
281
+ if (options.clipMap && typeof options.clipMap === 'object') {
282
+ avatar.visual.clipMap = { ...options.clipMap };
283
+ avatar.visual.activeClipKey = null;
284
+ avatar.visual.activeClipId = null;
285
+ avatar.visual.importedClipCache = {};
286
+ }
287
+ return avatar.visual;
288
+ }
289
+
290
+ export function spawnCharacterAvatar3D(aura, avatar, options = {}) {
291
+ const position = normalizeVec3(options.position, avatar.position);
292
+ avatar.position = position;
293
+
294
+ if (!Number.isInteger(avatar.bodyId) || avatar.bodyId <= 0) {
295
+ avatar.bodyId = aura.character3d.create({
296
+ x: position.x,
297
+ y: position.y,
298
+ z: position.z,
299
+ radius: avatar.movement.radius,
300
+ height: avatar.movement.height,
301
+ stepHeight: avatar.movement.stepHeight,
302
+ slopeLimit: avatar.movement.slopeLimit,
303
+ gravity: avatar.movement.gravity,
304
+ });
305
+ } else if (typeof aura?.character3d?.setPosition === 'function') {
306
+ aura.character3d.setPosition(avatar.bodyId, position.x, position.y, position.z);
307
+ }
308
+
309
+ const nextState = typeof aura?.character3d?.getState === 'function'
310
+ ? aura.character3d.getState(avatar.bodyId)
311
+ : null;
312
+ if (nextState && typeof nextState === 'object') {
313
+ avatar.position = normalizeVec3(nextState, position);
314
+ avatar.grounded = nextState.grounded === true;
315
+ avatar.velocityY = finite(nextState.velocityY, 0);
316
+ avatar.onSlope = nextState.onSlope === true;
317
+ }
318
+
319
+ syncSceneNodeTransform(aura, avatar);
320
+ syncCamera(aura, avatar);
321
+ return avatar.bodyId;
322
+ }
323
+
324
+ export function tickCharacterAvatar3D(aura, avatar, dt) {
325
+ const frameDt = Math.max(0, finite(dt, 0));
326
+ if (!Number.isInteger(avatar.bodyId) || avatar.bodyId <= 0) {
327
+ spawnCharacterAvatar3D(aura, avatar);
328
+ }
329
+
330
+ const rawMoveX = clamp(finite(avatar.input.moveX, 0), -1, 1);
331
+ const rawMoveZ = clamp(finite(avatar.input.moveZ, 0), -1, 1);
332
+ let moveX = rawMoveX;
333
+ let moveZ = rawMoveZ;
334
+ const magnitude = Math.hypot(moveX, moveZ);
335
+ if (magnitude > 1e-6) {
336
+ moveX /= magnitude;
337
+ moveZ /= magnitude;
338
+ avatar.facingYaw = Math.atan2(moveX, moveZ);
339
+ }
340
+
341
+ const speed = avatar.input.run === true ? avatar.movement.runSpeed : avatar.movement.moveSpeed;
342
+ if (typeof aura?.character3d?.move === 'function') {
343
+ aura.character3d.move(avatar.bodyId, {
344
+ x: moveX * speed * frameDt,
345
+ y: 0,
346
+ z: moveZ * speed * frameDt,
347
+ });
348
+ }
349
+
350
+ if (avatar.input.jump === true && typeof aura?.character3d?.jump === 'function') {
351
+ aura.character3d.jump(avatar.bodyId, avatar.movement.jumpSpeed);
352
+ }
353
+
354
+ if (typeof aura?.character3d?.update === 'function') {
355
+ aura.character3d.update(frameDt);
356
+ }
357
+ const state = typeof aura?.character3d?.getState === 'function'
358
+ ? aura.character3d.getState(avatar.bodyId)
359
+ : null;
360
+ if (state && typeof state === 'object') {
361
+ avatar.position = normalizeVec3(state, avatar.position);
362
+ avatar.grounded = state.grounded === true;
363
+ avatar.velocityY = finite(state.velocityY, 0);
364
+ avatar.onSlope = state.onSlope === true;
365
+ }
366
+
367
+ avatar.motion = {
368
+ moveX,
369
+ moveZ,
370
+ magnitude,
371
+ speed: magnitude > 1e-6 ? speed : 0,
372
+ };
373
+ avatar.locomotion = resolveLocomotion(avatar, magnitude);
374
+ applyClipState(aura, avatar, avatar.locomotion);
375
+
376
+ if (typeof aura?.scene3d?.updateClips === 'function') {
377
+ aura.scene3d.updateClips(frameDt);
378
+ }
379
+
380
+ syncSceneNodeTransform(aura, avatar);
381
+ syncCamera(aura, avatar);
382
+ avatar.input.jump = false;
383
+ return cloneState(avatar);
384
+ }
385
+
386
+ export function getAvatarRenderTransform3D(avatar) {
387
+ return {
388
+ position: {
389
+ x: avatar.position.x + avatar.visual.offset.x,
390
+ y: avatar.position.y + avatar.visual.offset.y,
391
+ z: avatar.position.z + avatar.visual.offset.z,
392
+ },
393
+ rotation: {
394
+ x: 0,
395
+ y: avatar.facingYaw,
396
+ z: 0,
397
+ },
398
+ scale: { ...avatar.visual.scale },
399
+ };
400
+ }
401
+
402
+ export function getAvatarState3D(avatar) {
403
+ return cloneState(avatar);
404
+ }