@zylem/game-lib 0.6.3 → 0.6.4
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/dist/actions.d.ts +5 -5
- package/dist/actions.js +196 -32
- package/dist/actions.js.map +1 -1
- package/dist/behavior/jumper-2d.d.ts +114 -0
- package/dist/behavior/jumper-2d.js +711 -0
- package/dist/behavior/jumper-2d.js.map +1 -0
- package/dist/behavior/platformer-3d.d.ts +14 -14
- package/dist/behavior/platformer-3d.js +347 -104
- package/dist/behavior/platformer-3d.js.map +1 -1
- package/dist/behavior/ricochet-2d.d.ts +4 -3
- package/dist/behavior/ricochet-2d.js +53 -22
- package/dist/behavior/ricochet-2d.js.map +1 -1
- package/dist/behavior/ricochet-3d.d.ts +117 -0
- package/dist/behavior/ricochet-3d.js +443 -0
- package/dist/behavior/ricochet-3d.js.map +1 -0
- package/dist/behavior/screen-visibility.d.ts +79 -0
- package/dist/behavior/screen-visibility.js +358 -0
- package/dist/behavior/screen-visibility.js.map +1 -0
- package/dist/behavior/screen-wrap.d.ts +4 -3
- package/dist/behavior/screen-wrap.js +100 -49
- package/dist/behavior/screen-wrap.js.map +1 -1
- package/dist/behavior/shooter-2d.d.ts +79 -0
- package/dist/behavior/shooter-2d.js +180 -0
- package/dist/behavior/shooter-2d.js.map +1 -0
- package/dist/behavior/thruster.d.ts +5 -4
- package/dist/behavior/thruster.js +133 -75
- package/dist/behavior/thruster.js.map +1 -1
- package/dist/behavior/top-down-movement.d.ts +56 -0
- package/dist/behavior/top-down-movement.js +125 -0
- package/dist/behavior/top-down-movement.js.map +1 -0
- package/dist/behavior/world-boundary-2d.d.ts +4 -3
- package/dist/behavior/world-boundary-2d.js +90 -36
- package/dist/behavior/world-boundary-2d.js.map +1 -1
- package/dist/behavior/world-boundary-3d.d.ts +76 -0
- package/dist/behavior/world-boundary-3d.js +274 -0
- package/dist/behavior/world-boundary-3d.js.map +1 -0
- package/dist/{behavior-descriptor-BWNWmIjv.d.ts → behavior-descriptor-BXnVR8Ki.d.ts} +22 -5
- package/dist/{blueprints-BWGz8fII.d.ts → blueprints-DmbK2dki.d.ts} +2 -2
- package/dist/camera-4XO5gbQH.d.ts +905 -0
- package/dist/camera.d.ts +1 -1
- package/dist/camera.js +876 -289
- package/dist/camera.js.map +1 -1
- package/dist/{composition-DrzFrbqI.d.ts → composition-BASvMKrW.d.ts} +1 -1
- package/dist/{core-DAkskq6Y.d.ts → core-CARRaS55.d.ts} +57 -14
- package/dist/core.d.ts +9 -8
- package/dist/core.js +4519 -1255
- package/dist/core.js.map +1 -1
- package/dist/{entities-DC9ce_vx.d.ts → entities-ChFirVL9.d.ts} +22 -28
- package/dist/entities.d.ts +4 -4
- package/dist/entities.js +1231 -314
- package/dist/entities.js.map +1 -1
- package/dist/{entity-BpbZqg19.d.ts → entity-vj-HTjzU.d.ts} +80 -11
- package/dist/{global-change-Dc8uCKi2.d.ts → global-change-2JvMaz44.d.ts} +1 -1
- package/dist/main.d.ts +718 -19
- package/dist/main.js +12129 -5959
- package/dist/main.js.map +1 -1
- package/dist/physics-pose-DCc4oE44.d.ts +25 -0
- package/dist/physics-protocol-BDD3P5W2.d.ts +200 -0
- package/dist/physics-worker.d.ts +21 -0
- package/dist/physics-worker.js +306 -0
- package/dist/physics-worker.js.map +1 -0
- package/dist/physics.d.ts +205 -0
- package/dist/physics.js +577 -0
- package/dist/physics.js.map +1 -0
- package/dist/{stage-types-BFsm3qsZ.d.ts → stage-types-C19IhuzA.d.ts} +253 -89
- package/dist/stage.d.ts +9 -8
- package/dist/stage.js +3782 -1041
- package/dist/stage.js.map +1 -1
- package/dist/sync-state-machine-CZyspBpj.d.ts +16 -0
- package/dist/{thruster-DhRaJnoL.d.ts → thruster-23lzoPZd.d.ts} +16 -8
- package/dist/world-DfgxoNMt.d.ts +105 -0
- package/package.json +25 -1
- package/dist/camera-B5e4c78l.d.ts +0 -468
- package/dist/world-Be5m1XC1.d.ts +0 -31
package/dist/actions.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { T as TransformState } from './entity-
|
|
2
|
-
export { A as Action, c as createTransformStore, i as getPosition, H as getRotation, j as getVelocity, m as move, h as moveForwardXY, a as moveX, e as moveXY, f as moveXZ, b as moveY, d as moveZ, r as resetTransformStore, g as resetVelocity, t as rotateEuler, p as rotateInDirection, u as rotateX, v as rotateY, q as rotateYEuler, x as rotateZ, s as setPosition, k as setPositionX, l as setPositionY, n as setPositionZ, G as setRotation, C as setRotationDegrees, E as setRotationDegreesX, D as setRotationDegreesY, F as setRotationDegreesZ, z as setRotationX, y as setRotationY, B as setRotationZ, o as wrapAround3D, w as wrapAroundXY } from './entity-
|
|
3
|
-
export { c as callFunc, d as delay, m as moveBy, a as moveTo, o as onPress, b as onRelease, p as parallel, e as repeat, f as repeatForever, r as rotateBy, s as sequence, t as throttle } from './composition-
|
|
1
|
+
import { T as TransformState } from './entity-vj-HTjzU.js';
|
|
2
|
+
export { A as Action, c as createTransformStore, i as getPosition, H as getRotation, j as getVelocity, m as move, h as moveForwardXY, a as moveX, e as moveXY, f as moveXZ, b as moveY, d as moveZ, r as resetTransformStore, g as resetVelocity, t as rotateEuler, p as rotateInDirection, u as rotateX, v as rotateY, q as rotateYEuler, x as rotateZ, s as setPosition, k as setPositionX, l as setPositionY, n as setPositionZ, G as setRotation, C as setRotationDegrees, E as setRotationDegreesX, D as setRotationDegreesY, F as setRotationDegreesZ, z as setRotationX, y as setRotationY, B as setRotationZ, o as wrapAround3D, w as wrapAroundXY } from './entity-vj-HTjzU.js';
|
|
3
|
+
export { c as callFunc, d as delay, m as moveBy, a as moveTo, o as onPress, b as onRelease, p as parallel, e as repeat, f as repeatForever, r as rotateBy, s as sequence, t as throttle } from './composition-BASvMKrW.js';
|
|
4
4
|
import { RigidBody } from '@dimforge/rapier3d-compat';
|
|
5
|
-
export { g as globalChange, a as globalChanges, v as variableChange, b as variableChanges } from './global-change-
|
|
5
|
+
export { g as globalChange, a as globalChanges, v as variableChange, b as variableChanges } from './global-change-2JvMaz44.js';
|
|
6
6
|
import 'three';
|
|
7
7
|
import 'bitecs';
|
|
8
8
|
import 'mitt';
|
|
9
|
-
import './behavior-descriptor-
|
|
9
|
+
import './behavior-descriptor-BXnVR8Ki.js';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Entity that can have transformations applied from a store
|
package/dist/actions.js
CHANGED
|
@@ -23,6 +23,25 @@ var BaseAction = class {
|
|
|
23
23
|
}
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
// src/lib/actions/capabilities/velocity-intents.ts
|
|
27
|
+
function setVelocityIntent(store, sourceId, vector, options = {}) {
|
|
28
|
+
const prev = store.velocityChannels[sourceId];
|
|
29
|
+
const mode = options.mode ?? prev?.mode ?? "replace";
|
|
30
|
+
const priority = options.priority ?? prev?.priority ?? 0;
|
|
31
|
+
const isAdditiveMerge = mode === "add" && prev?.mode === "add";
|
|
32
|
+
const x = vector.x == null ? prev?.x : isAdditiveMerge ? (prev?.x ?? 0) + vector.x : vector.x;
|
|
33
|
+
const y = vector.y == null ? prev?.y : isAdditiveMerge ? (prev?.y ?? 0) + vector.y : vector.y;
|
|
34
|
+
const z = vector.z == null ? prev?.z : isAdditiveMerge ? (prev?.z ?? 0) + vector.z : vector.z;
|
|
35
|
+
store.velocityChannels[sourceId] = {
|
|
36
|
+
x,
|
|
37
|
+
y,
|
|
38
|
+
z,
|
|
39
|
+
mode,
|
|
40
|
+
priority
|
|
41
|
+
};
|
|
42
|
+
store.dirty.velocityChannels = true;
|
|
43
|
+
}
|
|
44
|
+
|
|
26
45
|
// src/lib/actions/interval-actions.ts
|
|
27
46
|
function moveBy(opts) {
|
|
28
47
|
return new MoveByAction(opts);
|
|
@@ -43,10 +62,8 @@ var MoveByAction = class extends BaseAction {
|
|
|
43
62
|
const vy = this.dy / this.duration;
|
|
44
63
|
const vz = this.dz / this.duration;
|
|
45
64
|
const store = entity.transformStore;
|
|
46
|
-
store
|
|
47
|
-
store
|
|
48
|
-
store.velocity.z += vz;
|
|
49
|
-
store.dirty.velocity = true;
|
|
65
|
+
if (!store) return;
|
|
66
|
+
setVelocityIntent(store, "actions", { x: vx, y: vy, z: vz }, { mode: "add" });
|
|
50
67
|
}
|
|
51
68
|
};
|
|
52
69
|
function moveTo(opts) {
|
|
@@ -82,10 +99,8 @@ var MoveToAction = class extends BaseAction {
|
|
|
82
99
|
const vy = this.dy / this.duration;
|
|
83
100
|
const vz = this.dz / this.duration;
|
|
84
101
|
const store = entity.transformStore;
|
|
85
|
-
store
|
|
86
|
-
store
|
|
87
|
-
store.velocity.z += vz;
|
|
88
|
-
store.dirty.velocity = true;
|
|
102
|
+
if (!store) return;
|
|
103
|
+
setVelocityIntent(store, "actions", { x: vx, y: vy, z: vz }, { mode: "add" });
|
|
89
104
|
}
|
|
90
105
|
reset() {
|
|
91
106
|
super.reset();
|
|
@@ -378,10 +393,15 @@ function createTransformStore(initial) {
|
|
|
378
393
|
rotation: { x: 0, y: 0, z: 0, w: 1 },
|
|
379
394
|
velocity: { x: 0, y: 0, z: 0 },
|
|
380
395
|
angularVelocity: { x: 0, y: 0, z: 0 },
|
|
396
|
+
velocityChannels: {},
|
|
381
397
|
dirty: {
|
|
382
398
|
position: false,
|
|
383
399
|
rotation: false,
|
|
384
400
|
velocity: false,
|
|
401
|
+
velocityX: false,
|
|
402
|
+
velocityY: false,
|
|
403
|
+
velocityZ: false,
|
|
404
|
+
velocityChannels: false,
|
|
385
405
|
angularVelocity: false
|
|
386
406
|
}
|
|
387
407
|
};
|
|
@@ -409,25 +429,128 @@ function resetTransformStore(store) {
|
|
|
409
429
|
store.angularVelocity.x = 0;
|
|
410
430
|
store.angularVelocity.y = 0;
|
|
411
431
|
store.angularVelocity.z = 0;
|
|
432
|
+
for (const sourceId of Object.keys(store.velocityChannels)) {
|
|
433
|
+
delete store.velocityChannels[sourceId];
|
|
434
|
+
}
|
|
412
435
|
store.dirty.position = false;
|
|
413
436
|
store.dirty.rotation = false;
|
|
414
437
|
store.dirty.velocity = false;
|
|
438
|
+
store.dirty.velocityX = false;
|
|
439
|
+
store.dirty.velocityY = false;
|
|
440
|
+
store.dirty.velocityZ = false;
|
|
441
|
+
store.dirty.velocityChannels = false;
|
|
415
442
|
store.dirty.angularVelocity = false;
|
|
416
443
|
}
|
|
417
444
|
|
|
418
445
|
// src/lib/actions/capabilities/apply-transform.ts
|
|
446
|
+
function sortIntents(a, b) {
|
|
447
|
+
if (a.priority !== b.priority) return a.priority - b.priority;
|
|
448
|
+
return a.sourceId.localeCompare(b.sourceId);
|
|
449
|
+
}
|
|
450
|
+
function composeAxis(current, intents, axis) {
|
|
451
|
+
let touched = false;
|
|
452
|
+
let addSum = 0;
|
|
453
|
+
let hasReplace = false;
|
|
454
|
+
let replaceValue = current;
|
|
455
|
+
let replacePriority = Number.NEGATIVE_INFINITY;
|
|
456
|
+
for (const intent of intents) {
|
|
457
|
+
const axisValue = intent[axis];
|
|
458
|
+
if (axisValue == null) continue;
|
|
459
|
+
touched = true;
|
|
460
|
+
if (intent.mode === "add") {
|
|
461
|
+
addSum += axisValue;
|
|
462
|
+
continue;
|
|
463
|
+
}
|
|
464
|
+
if (!hasReplace || intent.priority >= replacePriority) {
|
|
465
|
+
hasReplace = true;
|
|
466
|
+
replacePriority = intent.priority;
|
|
467
|
+
replaceValue = axisValue;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return {
|
|
471
|
+
touched,
|
|
472
|
+
value: (hasReplace ? replaceValue : 0) + addSum
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function composeVelocity(current, intents) {
|
|
476
|
+
return {
|
|
477
|
+
x: composeAxis(current.x, intents, "x"),
|
|
478
|
+
y: composeAxis(current.y, intents, "y"),
|
|
479
|
+
z: composeAxis(current.z, intents, "z")
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
function clearVelocityChannels(store) {
|
|
483
|
+
for (const sourceId in store.velocityChannels) {
|
|
484
|
+
delete store.velocityChannels[sourceId];
|
|
485
|
+
}
|
|
486
|
+
store.dirty.velocityChannels = false;
|
|
487
|
+
}
|
|
419
488
|
function applyTransformChanges(entity, store) {
|
|
420
489
|
if (!entity.body) return;
|
|
421
|
-
|
|
422
|
-
|
|
490
|
+
const hasPosition = store.dirty.position;
|
|
491
|
+
const hasRotation = store.dirty.rotation;
|
|
492
|
+
const hasAngularVelocity = store.dirty.angularVelocity;
|
|
493
|
+
const hasPerAxis = store.dirty.velocityX || store.dirty.velocityY || store.dirty.velocityZ;
|
|
494
|
+
const hasLegacyVelocity = store.dirty.velocity;
|
|
495
|
+
const hasChannels = store.dirty.velocityChannels;
|
|
496
|
+
if (!hasPosition && !hasRotation && !hasAngularVelocity && !hasPerAxis && !hasLegacyVelocity && !hasChannels) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
const intents = [];
|
|
500
|
+
if (hasChannels) {
|
|
501
|
+
for (const sourceId in store.velocityChannels) {
|
|
502
|
+
const intent = store.velocityChannels[sourceId];
|
|
503
|
+
intents.push({
|
|
504
|
+
sourceId,
|
|
505
|
+
mode: intent.mode ?? "replace",
|
|
506
|
+
priority: intent.priority ?? 0,
|
|
507
|
+
x: intent.x,
|
|
508
|
+
y: intent.y,
|
|
509
|
+
z: intent.z
|
|
510
|
+
});
|
|
511
|
+
}
|
|
423
512
|
}
|
|
424
|
-
if (
|
|
513
|
+
if (hasLegacyVelocity) {
|
|
514
|
+
intents.push({
|
|
515
|
+
sourceId: "__legacy_velocity__",
|
|
516
|
+
mode: "replace",
|
|
517
|
+
priority: -100,
|
|
518
|
+
x: store.velocity.x,
|
|
519
|
+
y: store.velocity.y,
|
|
520
|
+
z: store.velocity.z
|
|
521
|
+
});
|
|
522
|
+
} else if (hasPerAxis) {
|
|
523
|
+
intents.push({
|
|
524
|
+
sourceId: "__legacy_per_axis__",
|
|
525
|
+
mode: "replace",
|
|
526
|
+
priority: -100,
|
|
527
|
+
x: store.dirty.velocityX ? store.velocity.x : void 0,
|
|
528
|
+
y: store.dirty.velocityY ? store.velocity.y : void 0,
|
|
529
|
+
z: store.dirty.velocityZ ? store.velocity.z : void 0
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
if (intents.length > 0) {
|
|
533
|
+
const current = entity.body.linvel();
|
|
534
|
+
if (intents.length > 1) {
|
|
535
|
+
intents.sort(sortIntents);
|
|
536
|
+
}
|
|
537
|
+
const composed = composeVelocity(current, intents);
|
|
538
|
+
entity.body.setLinvel(
|
|
539
|
+
{
|
|
540
|
+
x: composed.x.touched ? composed.x.value : current.x,
|
|
541
|
+
y: composed.y.touched ? composed.y.value : current.y,
|
|
542
|
+
z: composed.z.touched ? composed.z.value : current.z
|
|
543
|
+
},
|
|
544
|
+
true
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
if (hasRotation) {
|
|
425
548
|
entity.body.setRotation(store.rotation, true);
|
|
426
549
|
}
|
|
427
|
-
if (
|
|
550
|
+
if (hasAngularVelocity) {
|
|
428
551
|
entity.body.setAngvel(store.angularVelocity, true);
|
|
429
552
|
}
|
|
430
|
-
if (
|
|
553
|
+
if (hasPosition) {
|
|
431
554
|
const current = entity.body.translation();
|
|
432
555
|
entity.body.setTranslation(
|
|
433
556
|
{
|
|
@@ -438,43 +561,56 @@ function applyTransformChanges(entity, store) {
|
|
|
438
561
|
true
|
|
439
562
|
);
|
|
440
563
|
}
|
|
564
|
+
store.dirty.position = false;
|
|
565
|
+
store.dirty.rotation = false;
|
|
566
|
+
store.dirty.velocity = false;
|
|
567
|
+
store.dirty.velocityX = false;
|
|
568
|
+
store.dirty.velocityY = false;
|
|
569
|
+
store.dirty.velocityZ = false;
|
|
570
|
+
clearVelocityChannels(store);
|
|
571
|
+
store.dirty.angularVelocity = false;
|
|
441
572
|
}
|
|
442
573
|
|
|
443
574
|
// src/lib/actions/capabilities/moveable.ts
|
|
444
575
|
import { Vector3 } from "three";
|
|
445
576
|
function moveX(entity, delta) {
|
|
446
577
|
if (!entity.transformStore) return;
|
|
447
|
-
entity.transformStore
|
|
448
|
-
entity.transformStore.dirty.velocity = true;
|
|
578
|
+
setVelocityIntent(entity.transformStore, "actions", { x: delta }, { mode: "replace" });
|
|
449
579
|
}
|
|
450
580
|
function moveY(entity, delta) {
|
|
451
581
|
if (!entity.transformStore) return;
|
|
452
|
-
entity.transformStore
|
|
453
|
-
entity.transformStore.dirty.velocity = true;
|
|
582
|
+
setVelocityIntent(entity.transformStore, "actions", { y: delta }, { mode: "replace" });
|
|
454
583
|
}
|
|
455
584
|
function moveZ(entity, delta) {
|
|
456
585
|
if (!entity.transformStore) return;
|
|
457
|
-
entity.transformStore
|
|
458
|
-
entity.transformStore.dirty.velocity = true;
|
|
586
|
+
setVelocityIntent(entity.transformStore, "actions", { z: delta }, { mode: "replace" });
|
|
459
587
|
}
|
|
460
588
|
function moveXY(entity, deltaX, deltaY) {
|
|
461
589
|
if (!entity.transformStore) return;
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
590
|
+
setVelocityIntent(
|
|
591
|
+
entity.transformStore,
|
|
592
|
+
"actions",
|
|
593
|
+
{ x: deltaX, y: deltaY },
|
|
594
|
+
{ mode: "replace" }
|
|
595
|
+
);
|
|
465
596
|
}
|
|
466
597
|
function moveXZ(entity, deltaX, deltaZ) {
|
|
467
598
|
if (!entity.transformStore) return;
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
599
|
+
setVelocityIntent(
|
|
600
|
+
entity.transformStore,
|
|
601
|
+
"actions",
|
|
602
|
+
{ x: deltaX, z: deltaZ },
|
|
603
|
+
{ mode: "replace" }
|
|
604
|
+
);
|
|
471
605
|
}
|
|
472
606
|
function move(entity, vector) {
|
|
473
607
|
if (!entity.transformStore) return;
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
608
|
+
setVelocityIntent(
|
|
609
|
+
entity.transformStore,
|
|
610
|
+
"actions",
|
|
611
|
+
{ x: vector.x, y: vector.y, z: vector.z },
|
|
612
|
+
{ mode: "add" }
|
|
613
|
+
);
|
|
478
614
|
}
|
|
479
615
|
function resetVelocity(entity) {
|
|
480
616
|
if (!entity.body) return;
|
|
@@ -537,6 +673,17 @@ function wrapAround3D(entity, boundsX, boundsY, boundsZ) {
|
|
|
537
673
|
|
|
538
674
|
// src/lib/actions/capabilities/rotatable.ts
|
|
539
675
|
import { Euler, Vector3 as Vector32, MathUtils, Quaternion } from "three";
|
|
676
|
+
function syncImmediateRotation(entity) {
|
|
677
|
+
if (!entity.group || !entity.transformStore) return;
|
|
678
|
+
entity.group.setRotationFromQuaternion(
|
|
679
|
+
new Quaternion(
|
|
680
|
+
entity.transformStore.rotation.x,
|
|
681
|
+
entity.transformStore.rotation.y,
|
|
682
|
+
entity.transformStore.rotation.z,
|
|
683
|
+
entity.transformStore.rotation.w
|
|
684
|
+
)
|
|
685
|
+
);
|
|
686
|
+
}
|
|
540
687
|
function rotateInDirection(entity, moveVector) {
|
|
541
688
|
if (!entity.body) return;
|
|
542
689
|
const rotate = Math.atan2(-moveVector.x, moveVector.z);
|
|
@@ -546,9 +693,16 @@ function rotateYEuler(entity, amount) {
|
|
|
546
693
|
rotateEuler(entity, new Vector32(0, -amount, 0));
|
|
547
694
|
}
|
|
548
695
|
function rotateEuler(entity, rotation) {
|
|
549
|
-
if (!entity.
|
|
550
|
-
const
|
|
551
|
-
|
|
696
|
+
if (!entity.transformStore) return;
|
|
697
|
+
const quat = new Quaternion().setFromEuler(
|
|
698
|
+
new Euler(rotation.x, rotation.y, rotation.z)
|
|
699
|
+
);
|
|
700
|
+
entity.transformStore.rotation.w = quat.w;
|
|
701
|
+
entity.transformStore.rotation.x = quat.x;
|
|
702
|
+
entity.transformStore.rotation.y = quat.y;
|
|
703
|
+
entity.transformStore.rotation.z = quat.z;
|
|
704
|
+
entity.transformStore.dirty.rotation = true;
|
|
705
|
+
syncImmediateRotation(entity);
|
|
552
706
|
}
|
|
553
707
|
function rotateY(entity, delta) {
|
|
554
708
|
if (!entity.transformStore) return;
|
|
@@ -565,6 +719,7 @@ function rotateY(entity, delta) {
|
|
|
565
719
|
entity.transformStore.rotation.y = newY;
|
|
566
720
|
entity.transformStore.rotation.z = newZ;
|
|
567
721
|
entity.transformStore.dirty.rotation = true;
|
|
722
|
+
syncImmediateRotation(entity);
|
|
568
723
|
}
|
|
569
724
|
function rotateX(entity, delta) {
|
|
570
725
|
if (!entity.transformStore) return;
|
|
@@ -581,6 +736,7 @@ function rotateX(entity, delta) {
|
|
|
581
736
|
entity.transformStore.rotation.y = newY;
|
|
582
737
|
entity.transformStore.rotation.z = newZ;
|
|
583
738
|
entity.transformStore.dirty.rotation = true;
|
|
739
|
+
syncImmediateRotation(entity);
|
|
584
740
|
}
|
|
585
741
|
function rotateZ(entity, delta) {
|
|
586
742
|
if (!entity.transformStore) return;
|
|
@@ -597,6 +753,8 @@ function rotateZ(entity, delta) {
|
|
|
597
753
|
entity.transformStore.rotation.y = newY;
|
|
598
754
|
entity.transformStore.rotation.z = newZ;
|
|
599
755
|
entity.transformStore.dirty.rotation = true;
|
|
756
|
+
entity._rotation2DAngle = (entity._rotation2DAngle ?? 0) + delta;
|
|
757
|
+
syncImmediateRotation(entity);
|
|
600
758
|
}
|
|
601
759
|
function setRotationY(entity, y) {
|
|
602
760
|
if (!entity.transformStore) return;
|
|
@@ -608,6 +766,7 @@ function setRotationY(entity, y) {
|
|
|
608
766
|
entity.transformStore.rotation.y = yComponent;
|
|
609
767
|
entity.transformStore.rotation.z = 0;
|
|
610
768
|
entity.transformStore.dirty.rotation = true;
|
|
769
|
+
syncImmediateRotation(entity);
|
|
611
770
|
}
|
|
612
771
|
function setRotationDegreesY(entity, y) {
|
|
613
772
|
if (!entity.body) return;
|
|
@@ -623,6 +782,7 @@ function setRotationX(entity, x) {
|
|
|
623
782
|
entity.transformStore.rotation.y = 0;
|
|
624
783
|
entity.transformStore.rotation.z = 0;
|
|
625
784
|
entity.transformStore.dirty.rotation = true;
|
|
785
|
+
syncImmediateRotation(entity);
|
|
626
786
|
}
|
|
627
787
|
function setRotationDegreesX(entity, x) {
|
|
628
788
|
if (!entity.body) return;
|
|
@@ -638,6 +798,8 @@ function setRotationZ(entity, z) {
|
|
|
638
798
|
entity.transformStore.rotation.y = 0;
|
|
639
799
|
entity.transformStore.rotation.z = zComponent;
|
|
640
800
|
entity.transformStore.dirty.rotation = true;
|
|
801
|
+
entity._rotation2DAngle = z;
|
|
802
|
+
syncImmediateRotation(entity);
|
|
641
803
|
}
|
|
642
804
|
function setRotationDegreesZ(entity, z) {
|
|
643
805
|
if (!entity.body) return;
|
|
@@ -651,6 +813,8 @@ function setRotation(entity, x, y, z) {
|
|
|
651
813
|
entity.transformStore.rotation.y = quat.y;
|
|
652
814
|
entity.transformStore.rotation.z = quat.z;
|
|
653
815
|
entity.transformStore.dirty.rotation = true;
|
|
816
|
+
entity._rotation2DAngle = z;
|
|
817
|
+
syncImmediateRotation(entity);
|
|
654
818
|
}
|
|
655
819
|
function setRotationDegrees(entity, x, y, z) {
|
|
656
820
|
if (!entity.body) return;
|