incanto 0.65.0 → 0.66.0

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 (55) hide show
  1. package/dist/2d.d.ts +38 -3
  2. package/dist/2d.js +3 -3
  3. package/dist/3d.d.ts +130 -3
  4. package/dist/3d.js +4 -4
  5. package/dist/{audio-player-BrEHwbK1.d.ts → audio-player-_UAcHxnC.d.ts} +1 -1
  6. package/dist/{behavior-CmMuQ6CL.d.ts → behavior-BXNLfIJk.d.ts} +19 -0
  7. package/dist/{create-game-W2xzTJhs.js → create-game-DYJCIzO0.js} +66 -5
  8. package/dist/{create-game-DIyh5Zy9.js → create-game-Dd7H4bJV.js} +5 -5
  9. package/dist/debug.d.ts +1 -1
  10. package/dist/{environment-presets-BvHs6HEk.js → environment-presets-BlPsEmq6.js} +69 -5
  11. package/dist/{gameplay-D-H986A4.js → gameplay-D1RADWu3.js} +267 -7
  12. package/dist/gameplay.d.ts +78 -3
  13. package/dist/gameplay.js +2 -2
  14. package/dist/index.d.ts +4 -4
  15. package/dist/index.js +3 -3
  16. package/dist/{loader-CTB441z4.d.ts → loader-Cga7FVP4.d.ts} +1 -1
  17. package/dist/net.d.ts +2 -2
  18. package/dist/net.js +1 -1
  19. package/dist/{physics-2d-CmnunaR2.js → physics-2d-Cji5A6sX.js} +29 -3
  20. package/dist/{physics-3d-DULB1lD1.js → physics-3d-BkHjwJgI.js} +46 -4
  21. package/dist/{quiet-rapier-BAJ4K94N.js → quiet-rapier-C6fW4zcW.js} +14 -1
  22. package/dist/react.d.ts +1 -1
  23. package/dist/react.js +1 -1
  24. package/dist/{register-CgeR4ckF.js → register-BmuqYTiY.js} +29 -0
  25. package/dist/{register-DO5_Qp0Q.js → register-D0CxCveZ.js} +37 -3
  26. package/dist/{replay-CThvwkcQ.d.ts → replay-BHoB6fCU.d.ts} +1 -1
  27. package/dist/{replay-CEw2xAhG.js → replay-IsZbNu6d.js} +1 -1
  28. package/dist/{split-screen-gb0c3xdb.js → split-screen-D_i7GRcY.js} +1 -1
  29. package/dist/{split-screen-DxZzC1nm.d.ts → split-screen-eJUFjhi1.d.ts} +2 -2
  30. package/dist/{src-DYffzHbd.js → src-BTLbXFPZ.js} +1 -1
  31. package/dist/{teardown-BordHL9o.js → teardown-byR9USax.js} +1 -1
  32. package/dist/{test-CXZuXs8k.js → test-DgrD0jHD.js} +11 -11
  33. package/dist/test.d.ts +4 -4
  34. package/dist/test.js +2 -2
  35. package/dist/vite.js +2 -2
  36. package/editor/assets/{agent8-DO5qzIOD.js → agent8-9N-Pd_YS.js} +1 -1
  37. package/editor/assets/{debug-DntG9CVD.js → debug-CkbJICYp.js} +1 -1
  38. package/editor/assets/{index-CqEUVaPN.js → index-CeDhIPTC.js} +72 -72
  39. package/editor/index.html +1 -1
  40. package/package.json +1 -1
  41. package/schemas/scene.schema.json +19 -0
  42. package/skills/incanto-gameplay-behaviors.md +85 -6
  43. package/skills/incanto-node-reference.md +59 -1
  44. package/skills/incanto-physics-and-input.md +69 -0
  45. package/skills/incanto-web-integration.md +24 -3
  46. package/templates-app/beacon-isle-3d/package.json +1 -1
  47. package/templates-app/platformer-2d/package.json +1 -1
  48. package/templates-app/star-survivor/package.json +1 -1
  49. package/templates-app/tps-3d/package.json +1 -1
  50. package/templates-app/village-quest-3d/package.json +1 -1
  51. package/templates-app/beacon-isle-3d/coverage.json +0 -9
  52. package/templates-app/platformer-2d/coverage.json +0 -5
  53. package/templates-app/star-survivor/coverage.json +0 -5
  54. package/templates-app/tps-3d/coverage.json +0 -5
  55. package/templates-app/village-quest-3d/coverage.json +0 -9
package/editor/index.html CHANGED
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
6
  <title>Incanto Scene Editor</title>
7
7
  <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><rect width='16' height='16' rx='3' fill='%236ee7dc'/><text x='8' y='12' text-anchor='middle' font-size='11' font-family='monospace' fill='%230e1018'>i</text></svg>" />
8
- <script type="module" crossorigin src="./assets/index-CqEUVaPN.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-CeDhIPTC.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/GameServer-C56iOUgF.js">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incanto",
3
- "version": "0.65.0",
3
+ "version": "0.66.0",
4
4
  "description": "Vibe-coding-first web game engine SDK — JSON-driven scenes on three.js",
5
5
  "keywords": [
6
6
  "game-engine",
@@ -2350,6 +2350,10 @@
2350
2350
  "type": "number",
2351
2351
  "default": 0.01
2352
2352
  },
2353
+ "stepHeight": {
2354
+ "type": "number",
2355
+ "default": 0.35
2356
+ },
2353
2357
  "mouseLook": {
2354
2358
  "type": "boolean",
2355
2359
  "default": true
@@ -3423,6 +3427,9 @@
3423
3427
  "damping": {
3424
3428
  "type": "number",
3425
3429
  "default": 5
3430
+ },
3431
+ "collide": {
3432
+ "default": null
3426
3433
  }
3427
3434
  },
3428
3435
  "additionalProperties": false
@@ -3577,6 +3584,9 @@
3577
3584
  "damping": {
3578
3585
  "type": "number",
3579
3586
  "default": 5
3587
+ },
3588
+ "collide": {
3589
+ "default": null
3580
3590
  }
3581
3591
  },
3582
3592
  "additionalProperties": false
@@ -5670,6 +5680,15 @@
5670
5680
  "minItems": 3,
5671
5681
  "maxItems": 3,
5672
5682
  "default": [0, 0, 0]
5683
+ },
5684
+ "angularVelocity": {
5685
+ "type": "array",
5686
+ "items": {
5687
+ "type": "number"
5688
+ },
5689
+ "minItems": 3,
5690
+ "maxItems": 3,
5691
+ "default": [0, 0, 0]
5673
5692
  }
5674
5693
  },
5675
5694
  "additionalProperties": false
@@ -516,6 +516,59 @@ is a far worse failure than one running when it was meant to sleep.
516
516
 
517
517
  From TypeScript it is the same switch: `this.getNode('../Hunt').behavior.enable()`.
518
518
 
519
+ ## FaceTarget
520
+
521
+ Turn toward the nearest thing in a group and say when you are pointed at it —
522
+ turrets, sentry guns, security cameras, an NPC that watches you walk past.
523
+
524
+ `Chase` finds the nearest target and turns toward it, and then MOVES, which is
525
+ the one thing a turret must not do; `Patrol`/`Chase`'s `facePath` only turns as
526
+ a side effect of locomotion, so a stationary node could not use it. A tower
527
+ defense built before this hand-wrote acquisition and the aim gate.
528
+
529
+ | Prop | Default | Meaning |
530
+ |---|---|---|
531
+ | `targetGroup` | `""` | group to acquire from — nearest live member wins (required) |
532
+ | `range` | `0` | only acquire within this distance (0 = anywhere) |
533
+ | `facePath` | `""` | node to TURN (usually a skin); empty turns its own node |
534
+ | `turnSpeed` | `6` | turn rate rad/s; 100 is an instant snap |
535
+ | `aimTolerance` | `6` | degrees of slop that still counts as pointed at it |
536
+
537
+ Signals: `acquired(node)` · `lostTarget` · **`aimed`** · `lostAim`
538
+
539
+ ```jsonc
540
+ { "name": "Turret", "type": "Node3D",
541
+ "script": { "name": "FaceTarget",
542
+ "props": { "targetGroup": "enemy", "range": 12, "facePath": "../Barrel" } } }
543
+ ```
544
+
545
+ **`aimed` is the useful one.** "Only fire while actually pointed at it" becomes a
546
+ wire instead of an angle comparison every caller repeats and one caller forgets.
547
+ `onTarget` and `target` are readable from TypeScript for the rest.
548
+
549
+ ## Currency
550
+
551
+ Money you can spend. `ScoreKeeper` is a SCORE — it counts up, it has no spend,
552
+ no affordability question, and its counter already drives the win condition, so
553
+ every shop, build mode, upgrade tree and economy game wrote its own wallet.
554
+
555
+ | Prop | Default | Meaning |
556
+ |---|---|---|
557
+ | `amount` | `0` | what you start with |
558
+ | `max` | `0` | ceiling (0 = none) |
559
+
560
+ Signals: `changed(amount)` · `earned(gain)` · `spent(cost)` · **`refused(cost)`**
561
+ Methods: `spend(cost) -> boolean` · `earn(gain)` · `canAfford(cost)` · `setAmount(n)`
562
+
563
+ ```ts
564
+ if (!wallet.spend(TOWER_COST)) return; // `refused` already fired for the HUD
565
+ placeTower(pad);
566
+ ```
567
+
568
+ `spend` returns whether it went through and emits `refused` when it did not, so
569
+ "you cannot afford that" is one wire to a banner. It saves through `serialize()`
570
+ like `Health` and `ScoreKeeper`.
571
+
519
572
  ## Wander
520
573
 
521
574
  Seeded random roaming inside a circle around the spawn point — idle critters,
@@ -768,8 +821,35 @@ Signals: `waveStarted(index)` · `waveCleared(index)` · `allCleared`
768
821
  ## Projectile
769
822
 
770
823
  Straight-line, constant-velocity motion — bullets, arrows, thrown rocks. Pure
771
- MOVEMENT by design: **compose** it with `DamageOnContact` (deal damage), `Lifetime`
772
- (auto-despawn) and an Area collider on the SAME node — don't conflate them.
824
+ MOVEMENT by design: **compose** it with `DamageOnContact` (deal damage) and
825
+ `Lifetime` (auto-despawn) — don't conflate them. A node carries ONE script, so
826
+ those go on CHILD nodes and each one sets **`freeParent: true`** so it frees the
827
+ BULLET rather than itself. Copy this:
828
+
829
+ ```jsonc
830
+ { "name": "Bullet", "type": "Node3D",
831
+ "script": { "name": "Projectile", "props": { "speed": 30 } },
832
+ "children": [
833
+ { "name": "Hit", "type": "Area3D",
834
+ "props": { "collider": { "shape": "sphere", "radius": 0.2 } },
835
+ "script": { "name": "DamageOnContact",
836
+ "props": { "amount": 10, "targetGroup": "enemy",
837
+ "destroySelf": true, "freeParent": true } } },
838
+ { "name": "Life", "type": "Node3D",
839
+ "script": { "name": "Lifetime", "props": { "seconds": 2, "freeParent": true } } }
840
+ ] }
841
+ ```
842
+
843
+ **Without `freeParent` the bullet never dies.** Both behaviors used to free only
844
+ their own node, so the hitbox and the timer removed THEMSELVES and the bullet
845
+ flew on forever — one leaked node per shot, damaging exactly once, with no error.
846
+ Measured on a tower defense built from the published package:
847
+
848
+ ```
849
+ t=0.58 bullet z=2.92 | Dmg child: alive | Life child: gone | foe hp: 100
850
+ t=1.18 bullet z=5.92 | Dmg child: gone | Life child: gone | foe hp: 90
851
+ t=2.88 bullet z=14.42 | (both gone) | foe hp: 90 <- still flying
852
+ ```
773
853
  `direction` is a vector OR `'forward'` (from the node `rotation`); it's a
774
854
  union-typed prop so its default is `null` (= `'forward'`).
775
855
 
@@ -792,10 +872,9 @@ as a gun that simply never hits anything.) In 2D `rotation` is a scalar and
792
872
  { "name": "Bullet", "type": "Area2D", "props": { "rotation": 0 },
793
873
  "script": { "name": "Projectile", "props": { "speed": 600, "direction": "forward" } } }
794
874
  ```
795
- > Compose: add `DamageOnContact` and `Lifetime` to make it actually hurt and
796
- > despawn. One node carries one script, so attach `Projectile` here and wire the
797
- > others onto sibling/child Area nodes (or use a Spawner that clones a fully-built
798
- > bullet template).
875
+ > Compose: add `DamageOnContact` and `Lifetime` on CHILD nodes, both with
876
+ > `freeParent: true`, as shown above — or use a Spawner that clones a
877
+ > fully-built bullet template.
799
878
 
800
879
  ---
801
880
 
@@ -290,6 +290,7 @@ Signals: `movementStateChanged(state)`
290
290
  | `airControl` | `0.2` | number |
291
291
  | `fallGravity` | `2.5` | number |
292
292
  | `floatHeight` | `0.01` | number |
293
+ | `stepHeight` | `0.35` | number |
293
294
  | `mouseLook` | `true` | boolean |
294
295
  | `zoomMin` | `0` | number |
295
296
  | `zoomMax` | `0` | number |
@@ -446,6 +447,7 @@ Signals: `movementStateChanged(state)`
446
447
  | `length` | `0` | number |
447
448
  | `stiffness` | `50` | number |
448
449
  | `damping` | `5` | number |
450
+ | `collide` | `null` | null |
449
451
 
450
452
  ## `Joint3D` — `incanto/3d`
451
453
 
@@ -466,6 +468,7 @@ Signals: `movementStateChanged(state)`
466
468
  | `length` | `0` | number |
467
469
  | `stiffness` | `50` | number |
468
470
  | `damping` | `5` | number |
471
+ | `collide` | `null` | null |
469
472
 
470
473
  ## `Label` — `incanto/2d`
471
474
 
@@ -760,6 +763,7 @@ Signals: `triggerEnter(other)` · `triggerExit(other)`
760
763
  | `friction` | `0.5` | number |
761
764
  | `restitution` | `0` | number |
762
765
  | `linearVelocity` | `[0,0,0]` | array |
766
+ | `angularVelocity` | `[0,0,0]` | array |
763
767
 
764
768
  Signals: `triggerEnter(other)` · `triggerExit(other)`
765
769
 
@@ -1327,6 +1331,7 @@ wire their signals through scene `connections`. Full guide: `incanto-gameplay-be
1327
1331
 
1328
1332
  | Prop | Default | Kind |
1329
1333
  |---|---|---|
1334
+ | `enabled` | `true` | boolean |
1330
1335
  | `water` | `""` | node path |
1331
1336
  | `draft` | `0.35` | number |
1332
1337
  | `stiffness` | `3` | number |
@@ -1342,17 +1347,21 @@ Signals: `submerged` · `surfaced`
1342
1347
 
1343
1348
  | Prop | Default | Kind |
1344
1349
  |---|---|---|
1350
+ | `enabled` | `true` | boolean |
1345
1351
  | `falloff` | `0.28` | number |
1346
1352
 
1347
1353
  ### `Chase`
1348
1354
 
1349
1355
  | Prop | Default | Kind |
1350
1356
  |---|---|---|
1357
+ | `enabled` | `true` | boolean |
1351
1358
  | `target` | `""` | node path |
1352
1359
  | `speed` | `60` | number |
1353
1360
  | `stopRange` | `0` | number |
1354
1361
  | `loseRange` | `0` | number |
1355
1362
  | `moveParent` | `false` | boolean |
1363
+ | `facePath` | `""` | node path |
1364
+ | `turnSpeed` | `100` | number |
1356
1365
 
1357
1366
  Signals: `reachedTarget` · `lostTarget`
1358
1367
 
@@ -1360,9 +1369,9 @@ Signals: `reachedTarget` · `lostTarget`
1360
1369
 
1361
1370
  | Prop | Default | Kind |
1362
1371
  |---|---|---|
1372
+ | `enabled` | `true` | boolean |
1363
1373
  | `button` | `0` | number |
1364
1374
  | `maxDistance` | `0` | number |
1365
- | `enabled` | `true` | boolean |
1366
1375
 
1367
1376
  Signals: `clicked` · `hovered` · `unhovered`
1368
1377
 
@@ -1370,19 +1379,32 @@ Signals: `clicked` · `hovered` · `unhovered`
1370
1379
 
1371
1380
  | Prop | Default | Kind |
1372
1381
  |---|---|---|
1382
+ | `enabled` | `true` | boolean |
1373
1383
  | `group` | `"player"` | string |
1374
1384
 
1375
1385
  Signals: `totalChanged(total)`
1376
1386
 
1387
+ ### `Currency`
1388
+
1389
+ | Prop | Default | Kind |
1390
+ |---|---|---|
1391
+ | `enabled` | `true` | boolean |
1392
+ | `amount` | `0` | number |
1393
+ | `max` | `0` | number |
1394
+
1395
+ Signals: `changed` · `earned` · `spent` · `refused`
1396
+
1377
1397
  ### `DamageOnContact`
1378
1398
 
1379
1399
  | Prop | Default | Kind |
1380
1400
  |---|---|---|
1401
+ | `enabled` | `true` | boolean |
1381
1402
  | `amount` | `10` | number |
1382
1403
  | `targetGroup` | `""` | string |
1383
1404
  | `oncePerTarget` | `true` | boolean |
1384
1405
  | `repeatEvery` | `0` | number |
1385
1406
  | `destroySelf` | `false` | boolean |
1407
+ | `freeParent` | `false` | boolean |
1386
1408
 
1387
1409
  Signals: `dealtDamage(amount, target)`
1388
1410
 
@@ -1390,6 +1412,7 @@ Signals: `dealtDamage(amount, target)`
1390
1412
 
1391
1413
  | Prop | Default | Kind |
1392
1414
  |---|---|---|
1415
+ | `enabled` | `true` | boolean |
1393
1416
  | `daySeconds` | `240` | number |
1394
1417
  | `startHour` | `10` | number |
1395
1418
  | `maxSunElevationDeg` | `55` | number |
@@ -1398,10 +1421,24 @@ Signals: `dealtDamage(amount, target)`
1398
1421
 
1399
1422
  Signals: `dayPhaseChanged`
1400
1423
 
1424
+ ### `FaceTarget`
1425
+
1426
+ | Prop | Default | Kind |
1427
+ |---|---|---|
1428
+ | `enabled` | `true` | boolean |
1429
+ | `targetGroup` | `""` | string |
1430
+ | `range` | `0` | number |
1431
+ | `facePath` | `""` | node path |
1432
+ | `turnSpeed` | `6` | number |
1433
+ | `aimTolerance` | `6` | number |
1434
+
1435
+ Signals: `acquired` · `lostTarget` · `aimed` · `lostAim`
1436
+
1401
1437
  ### `FloatAway`
1402
1438
 
1403
1439
  | Prop | Default | Kind |
1404
1440
  |---|---|---|
1441
+ | `enabled` | `true` | boolean |
1405
1442
  | `rise` | `1` | number |
1406
1443
  | `seconds` | `0.7` | number |
1407
1444
  | `hold` | `0.3` | number |
@@ -1412,6 +1449,7 @@ Signals: `dayPhaseChanged`
1412
1449
 
1413
1450
  | Prop | Default | Kind |
1414
1451
  |---|---|---|
1452
+ | `enabled` | `true` | boolean |
1415
1453
  | `target` | `""` | node path |
1416
1454
  | `offset` | `[]` | array |
1417
1455
  | `smoothing` | `0` | number |
@@ -1421,6 +1459,7 @@ Signals: `dayPhaseChanged`
1421
1459
 
1422
1460
  | Prop | Default | Kind |
1423
1461
  |---|---|---|
1462
+ | `enabled` | `true` | boolean |
1424
1463
  | `restartAction` | `"restart"` | string |
1425
1464
  | `pauseAction` | `"pause"` | string |
1426
1465
  | `freezeOnEnd` | `true` | boolean |
@@ -1433,6 +1472,7 @@ Signals: `flowChanged`
1433
1472
 
1434
1473
  | Prop | Default | Kind |
1435
1474
  |---|---|---|
1475
+ | `enabled` | `true` | boolean |
1436
1476
  | `max` | `100` | number |
1437
1477
  | `regenPerSec` | `0` | number |
1438
1478
  | `invulnerableFor` | `0` | number |
@@ -1444,6 +1484,7 @@ Signals: `damaged(amount, current)` · `healed(amount, current)` · `died` · `r
1444
1484
 
1445
1485
  | Prop | Default | Kind |
1446
1486
  |---|---|---|
1487
+ | `enabled` | `true` | boolean |
1447
1488
  | `action` | `"interact"` | string |
1448
1489
  | `range` | `2` | number |
1449
1490
  | `actorGroup` | `"player"` | string |
@@ -1454,8 +1495,10 @@ Signals: `interacted(actor)`
1454
1495
 
1455
1496
  | Prop | Default | Kind |
1456
1497
  |---|---|---|
1498
+ | `enabled` | `true` | boolean |
1457
1499
  | `seconds` | `1` | number |
1458
1500
  | `startOnSignal` | `false` | boolean |
1501
+ | `freeParent` | `false` | boolean |
1459
1502
 
1460
1503
  Signals: `expired`
1461
1504
 
@@ -1463,6 +1506,7 @@ Signals: `expired`
1463
1506
 
1464
1507
  | Prop | Default | Kind |
1465
1508
  |---|---|---|
1509
+ | `enabled` | `true` | boolean |
1466
1510
  | `to` | `[]` | array |
1467
1511
  | `duration` | `1` | number |
1468
1512
  | `ease` | `"easeInOut"` | one of: `linear` `easeIn` `easeOut` `easeInOut` |
@@ -1474,6 +1518,7 @@ Signals: `arrived`
1474
1518
 
1475
1519
  | Prop | Default | Kind |
1476
1520
  |---|---|---|
1521
+ | `enabled` | `true` | boolean |
1477
1522
  | `axis` | `"y"` | one of: `x` `y` `z` |
1478
1523
  | `amplitude` | `1` | number |
1479
1524
  | `frequency` | `1` | number |
@@ -1483,6 +1528,7 @@ Signals: `arrived`
1483
1528
 
1484
1529
  | Prop | Default | Kind |
1485
1530
  |---|---|---|
1531
+ | `enabled` | `true` | boolean |
1486
1532
  | `speed` | `120` | number |
1487
1533
  | `loop` | `false` | boolean |
1488
1534
 
@@ -1492,11 +1538,15 @@ Signals: `waypointReached` · `arrived`
1492
1538
 
1493
1539
  | Prop | Default | Kind |
1494
1540
  |---|---|---|
1541
+ | `enabled` | `true` | boolean |
1495
1542
  | `points` | `[]` | array |
1496
1543
  | `speed` | `60` | number |
1497
1544
  | `loop` | `true` | boolean |
1498
1545
  | `mode` | `"loop"` | one of: `loop` `pingpong` |
1499
1546
  | `pauseAt` | `0` | number |
1547
+ | `moveParent` | `false` | boolean |
1548
+ | `facePath` | `""` | node path |
1549
+ | `turnSpeed` | `100` | number |
1500
1550
 
1501
1551
  Signals: `reachedPoint(index)`
1502
1552
 
@@ -1504,6 +1554,7 @@ Signals: `reachedPoint(index)`
1504
1554
 
1505
1555
  | Prop | Default | Kind |
1506
1556
  |---|---|---|
1557
+ | `enabled` | `true` | boolean |
1507
1558
  | `value` | `1` | number |
1508
1559
  | `kind` | `"coin"` | string |
1509
1560
  | `collectorGroup` | `"player"` | string |
@@ -1514,6 +1565,7 @@ Signals: `collected(value, other)`
1514
1565
 
1515
1566
  | Prop | Default | Kind |
1516
1567
  |---|---|---|
1568
+ | `enabled` | `true` | boolean |
1517
1569
  | `speed` | `300` | number |
1518
1570
  | `direction` | `null` | null |
1519
1571
  | `gravity` | `0` | number |
@@ -1522,6 +1574,7 @@ Signals: `collected(value, other)`
1522
1574
 
1523
1575
  | Prop | Default | Kind |
1524
1576
  |---|---|---|
1577
+ | `enabled` | `true` | boolean |
1525
1578
  | `game` | `"game"` | string |
1526
1579
  | `slot` | `"1"` | string |
1527
1580
  | `label` | `""` | string |
@@ -1535,6 +1588,7 @@ Signals: `saved` · `restored` · `noSave` · `hasSave`
1535
1588
 
1536
1589
  | Prop | Default | Kind |
1537
1590
  |---|---|---|
1591
+ | `enabled` | `true` | boolean |
1538
1592
  | `score` | `0` | number |
1539
1593
  | `lives` | `0` | number |
1540
1594
  | `scoreToWin` | `0` | number |
@@ -1545,6 +1599,7 @@ Signals: `scoreChanged(score)` · `won` · `lost` · `lifeLost(lives)`
1545
1599
 
1546
1600
  | Prop | Default | Kind |
1547
1601
  |---|---|---|
1602
+ | `enabled` | `true` | boolean |
1548
1603
  | `prefab` | `""` | node path |
1549
1604
  | `interval` | `1` | number |
1550
1605
  | `max` | `0` | number |
@@ -1558,6 +1613,7 @@ Signals: `spawned(node)` · `finished`
1558
1613
 
1559
1614
  | Prop | Default | Kind |
1560
1615
  |---|---|---|
1616
+ | `enabled` | `true` | boolean |
1561
1617
  | `speed` | `40` | number |
1562
1618
  | `radius` | `50` | number |
1563
1619
  | `changeEvery` | `2` | number |
@@ -1566,6 +1622,7 @@ Signals: `spawned(node)` · `finished`
1566
1622
 
1567
1623
  | Prop | Default | Kind |
1568
1624
  |---|---|---|
1625
+ | `enabled` | `true` | boolean |
1569
1626
  | `waves` | `[]` | array |
1570
1627
  | `autoStart` | `true` | boolean |
1571
1628
 
@@ -1575,6 +1632,7 @@ Signals: `waveStarted(index)` · `waveCleared(index)` · `allCleared`
1575
1632
 
1576
1633
  | Prop | Default | Kind |
1577
1634
  |---|---|---|
1635
+ | `enabled` | `true` | boolean |
1578
1636
  | `aggroTarget` | `""` | node path |
1579
1637
  | `aggroRange` | `12` | number |
1580
1638
  | `deAggroRange` | `0` | number |
@@ -293,6 +293,75 @@ Types — 2D: `fixed` (weld) · `revolute` (pin/hinge) · `rope` (max distance)
293
293
  distance at creation. `anchor`/`targetAnchor` are local offsets (px / m).
294
294
  Chains work (pendulums, bridges: each link a body + joint to the previous).
295
295
 
296
+ ## Pushing a body around (the API that was in no skill)
297
+
298
+ A dynamic `RigidBody2D`/`RigidBody3D` has a force API and none of these appeared
299
+ in any shipped skill, so an agent building a physics puzzle reported the engine
300
+ as having "no force/impulse API at all" and designed around its absence:
301
+
302
+ ```ts
303
+ const body = this.getNode('/root/Crate') as RigidBody3D;
304
+ body.applyImpulse([0, 6, 0]); // an instant kick, in mass*units/second
305
+ body.velocity = [2, 0, 0]; // or set the velocity outright
306
+ ```
307
+
308
+ `applyImpulse` is what the character controller itself runs on. It is an
309
+ IMPULSE, not a force: it changes velocity once, so a continuous push is one call
310
+ per frame from `update(dt)` scaled by `dt`.
311
+
312
+ Readable/writable body state: `velocity`, `mass`, `gravityScale`, `friction`,
313
+ `restitution`, `fixedRotation`. There is no torque call and no `angularVelocity`
314
+ yet — a body's spin can be neither set nor read.
315
+
316
+ ## What is inside this Area right now?
317
+
318
+ `triggerEnter(other)` / `triggerExit(other)` tell you about CROSSINGS. A pressure
319
+ plate, a capture point, "how many enemies are in the blast" and a shop trigger
320
+ all want OCCUPANCY, and asking used to mean keeping your own `Set` fed by those
321
+ two signals — plus a geometric re-check every frame, because a body that is
322
+ teleported or freed inside a sensor does not reliably announce its exit.
323
+
324
+ ```ts
325
+ const load = plate.overlapping('cargo')
326
+ .reduce((kg, b) => kg + ((b as RigidBody3D).mass ?? 0), 0);
327
+ door.open = load >= 60;
328
+ ```
329
+
330
+ `Area2D`/`Area3D` `overlapping(group?)` returns what the solver currently says is
331
+ inside, and drops freed nodes on read. **It includes the STATIC world** — a plate
332
+ laid into the floor genuinely contains the floor — so pass a group to ask the
333
+ question you usually mean.
334
+
335
+ ## Joints: the three things that decide whether yours works
336
+
337
+ 1. **There is no hinge in 3D.** The types are `fixed | spherical | rope | spring`.
338
+ A hinge is **two `spherical` joints at two points along the axis** — that
339
+ constrains rotation to the line between them, and it is exactly how a seesaw
340
+ or a door is built. (2D has `revolute` and needs none of this.)
341
+ 2. **`collide` decides whether the two ends touch, and its default reads the
342
+ type.** Rapier lets jointed bodies collide, and a hinge wants its bodies
343
+ overlapping at the pivot — so the contact solver fights the joint and flings
344
+ them. Before this, a first hinge produced a bar that spun chaotically forever
345
+ and threw a 40 kg box thirty metres, and the author nearly filed "spherical
346
+ joints inject energy".
347
+
348
+ | joint | default | why |
349
+ |---|---|---|
350
+ | `fixed` · `spherical` · `revolute` | **off** | a pivot's bodies overlap by construction |
351
+ | `rope` · `spring` | **on** | a tether anchors a thing to the world, and it still has to rest on it |
352
+
353
+ Set `true`/`false` to say it outright. **It governs the two JOINTED bodies
354
+ only** — never their contact with the rest of the world. Defaulting a spring
355
+ off drops a barrel roped to the floor straight through it, which is how this
356
+ table was arrived at.
357
+ 3. **`anchor`/`targetAnchor` are local offsets from each body's ORIGIN**,
358
+ resolved against the bodies' positions at load. If the two disagree the solver
359
+ snaps the body into place on the first frame, and a 4 cm typo is silent. Author
360
+ them with arithmetic (generate the scene) rather than by hand.
361
+
362
+ There are no joint limits or motors yet: bound a lever's travel with static
363
+ collision geometry in its way.
364
+
296
365
  ## Raycasts
297
366
 
298
367
  **Where `physics` comes from.** From a `Behavior` — where AI lives, and where
@@ -58,9 +58,30 @@ export function GamePage() {
58
58
  Rule of thumb: score/menus/dialogs that look like WEB UI → DOM overlay;
59
59
  anything the game itself must own (and runScript must verify) → UILayer.
60
60
 
61
- Pin a DOM element to a world position: `game.renderer.screenFromWorld(wx, wy)`
62
- (and `worldFromScreen(sx, sy)` the other way, for taps and clicks)
63
- each frame (subscribe `engine.updated`), then `transform: translate(x, y)`.
61
+ Pin a DOM element to a world position each frame (subscribe `engine.updated`),
62
+ then `transform: translate(x, y)`:
63
+
64
+ ```ts
65
+ game.renderer.screenFromWorld(wx, wy) // 2D
66
+ game.renderer.screenFromWorld(wx, wy, wz) // 3D — takes THREE arguments
67
+ ```
68
+
69
+ Going the other way, for taps and clicks:
70
+
71
+ ```ts
72
+ game.renderer.worldFromScreen(sx, sy) // 2D → { x, y }
73
+ game.renderer.worldFromScreen(sx, sy, planeY?) // 3D → { x, y, z } on a
74
+ // horizontal plane (default y=0)
75
+ game.renderer.rayFromScreen(sx, sy) // 3D → { origin, dir } for
76
+ // physics.castRay on uneven ground
77
+ ```
78
+
79
+ **A pixel in 3D is a ray, not a point**, which is why the 3D form needs a
80
+ surface: `worldFromScreen` lands it on the ground plane, and `rayFromScreen`
81
+ hands you the ray when the ground is terrain or a stack of crates. Both return
82
+ null when the ray misses (looking at the sky). `pick(sx, sy)` gives you the NODE
83
+ under a pixel — a different question, and the only one 3D could answer before
84
+ 0.66.
64
85
 
65
86
  Perf note: `useNodeProp` deep-compares per frame — subscribe to LEAF values
66
87
  (`'UI/Score', 'text'`), not big objects like a whole `animations` map.
@@ -14,7 +14,7 @@
14
14
  "@dimforge/rapier2d-compat": "0.19.3",
15
15
  "@dimforge/rapier3d-compat": "0.19.3",
16
16
  "@pixiv/three-vrm": "^3.5.3",
17
- "incanto": "^0.65.0",
17
+ "incanto": "^0.66.0",
18
18
  "three": "^0.184.0"
19
19
  },
20
20
  "devDependencies": {
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
- "incanto": "^0.65.0",
14
+ "incanto": "^0.66.0",
15
15
  "three": "^0.184.0"
16
16
  },
17
17
  "devDependencies": {
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
- "incanto": "^0.65.0",
14
+ "incanto": "^0.66.0",
15
15
  "three": "^0.184.0"
16
16
  },
17
17
  "devDependencies": {
@@ -13,7 +13,7 @@
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
14
  "@dimforge/rapier3d-compat": "0.19.3",
15
15
  "@pixiv/three-vrm": "^3.5.3",
16
- "incanto": "^0.65.0",
16
+ "incanto": "^0.66.0",
17
17
  "three": "^0.184.0"
18
18
  },
19
19
  "devDependencies": {
@@ -13,7 +13,7 @@
13
13
  "@dimforge/rapier2d-compat": "0.19.3",
14
14
  "@dimforge/rapier3d-compat": "0.19.3",
15
15
  "@pixiv/three-vrm": "^3.5.3",
16
- "incanto": "^0.65.0",
16
+ "incanto": "^0.66.0",
17
17
  "three": "^0.184.0"
18
18
  },
19
19
  "devDependencies": {
@@ -1,9 +0,0 @@
1
- {
2
- "hurt": {
3
- "onto": "%Shade1_1"
4
- },
5
- "lose": {
6
- "skip": "no fail state by design \u2014 `onPlayerDown` shows a banner and reloads the level after 1.6s"
7
- },
8
- "seconds": 20
9
- }
@@ -1,5 +0,0 @@
1
- {
2
- "hurt": { "onto": "%Spikes1" },
3
- "lose": true,
4
- "seconds": 20
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "hurt": "afk",
3
- "lose": true,
4
- "seconds": 30
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "hurt": "afk",
3
- "lose": true,
4
- "seconds": 30
5
- }
@@ -1,9 +0,0 @@
1
- {
2
- "hurt": {
3
- "onto": "%Wolf1"
4
- },
5
- "lose": {
6
- "skip": "no fail state by design \u2014 `onPlayerDown` shows a banner and reloads the level after 1.6s"
7
- },
8
- "seconds": 20
9
- }