incanto 0.9.0 → 0.11.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.
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-BLzp8moy.js"></script>
8
+ <script type="module" crossorigin src="./assets/index-DMCQXowF.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="./assets/GameServer-C56iOUgF.js">
10
10
  <link rel="stylesheet" crossorigin href="./assets/index-D8QvwvOm.css">
11
11
  </head>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "incanto",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Vibe-coding-first web game engine SDK — JSON-driven scenes on three.js",
5
5
  "keywords": [
6
6
  "game-engine",
@@ -190,6 +190,9 @@
190
190
  {
191
191
  "$ref": "#/$defs/Billboard3D"
192
192
  },
193
+ {
194
+ "$ref": "#/$defs/BoneAttachment3D"
195
+ },
193
196
  {
194
197
  "$ref": "#/$defs/Camera2D"
195
198
  },
@@ -1090,6 +1093,109 @@
1090
1093
  },
1091
1094
  "required": ["name", "type"]
1092
1095
  },
1096
+ "BoneAttachment3D": {
1097
+ "type": "object",
1098
+ "properties": {
1099
+ "name": {
1100
+ "type": "string"
1101
+ },
1102
+ "uid": {
1103
+ "type": "string"
1104
+ },
1105
+ "type": {
1106
+ "const": "BoneAttachment3D"
1107
+ },
1108
+ "groups": {
1109
+ "type": "array",
1110
+ "items": {
1111
+ "type": "string"
1112
+ }
1113
+ },
1114
+ "tags": {
1115
+ "type": "object"
1116
+ },
1117
+ "props": {
1118
+ "type": "object",
1119
+ "properties": {
1120
+ "position": {
1121
+ "type": "array",
1122
+ "items": {
1123
+ "type": "number"
1124
+ },
1125
+ "minItems": 3,
1126
+ "maxItems": 3,
1127
+ "default": [0, 0, 0]
1128
+ },
1129
+ "rotation": {
1130
+ "type": "array",
1131
+ "items": {
1132
+ "type": "number"
1133
+ },
1134
+ "minItems": 3,
1135
+ "maxItems": 3,
1136
+ "default": [0, 0, 0]
1137
+ },
1138
+ "static": {
1139
+ "type": "boolean",
1140
+ "default": false
1141
+ },
1142
+ "scale": {
1143
+ "type": "array",
1144
+ "items": {
1145
+ "type": "number"
1146
+ },
1147
+ "minItems": 3,
1148
+ "maxItems": 3,
1149
+ "default": [1, 1, 1]
1150
+ },
1151
+ "visible": {
1152
+ "type": "boolean",
1153
+ "default": true
1154
+ },
1155
+ "renderOrder": {
1156
+ "type": "number",
1157
+ "default": 0
1158
+ },
1159
+ "orderGroup": {
1160
+ "type": "string",
1161
+ "enum": ["background", "terrain", "default", "characters", "effects", "overlay"],
1162
+ "default": "default"
1163
+ },
1164
+ "target": {
1165
+ "type": "string",
1166
+ "default": ""
1167
+ },
1168
+ "bone": {
1169
+ "type": "string",
1170
+ "default": ""
1171
+ }
1172
+ },
1173
+ "additionalProperties": false
1174
+ },
1175
+ "script": {
1176
+ "type": "object",
1177
+ "properties": {
1178
+ "name": {
1179
+ "type": "string"
1180
+ },
1181
+ "props": {
1182
+ "type": "object"
1183
+ }
1184
+ },
1185
+ "required": ["name"]
1186
+ },
1187
+ "network": {
1188
+ "type": "object"
1189
+ },
1190
+ "children": {
1191
+ "type": "array",
1192
+ "items": {
1193
+ "$ref": "#/$defs/node"
1194
+ }
1195
+ }
1196
+ },
1197
+ "required": ["name", "type"]
1198
+ },
1093
1199
  "Camera2D": {
1094
1200
  "type": "object",
1095
1201
  "properties": {
@@ -56,9 +56,14 @@ character stays centered even while the camera is catching up or pulled in by a
56
56
  collision — no jitter.
57
57
 
58
58
  **Camera collision (spring arm).** For the orbit views (`free`/`quarter`/`side`)
59
- the camera won't clip through walls or the ground: each frame it raycasts from
60
- the eye toward the camera and, if a collider blocks the boom, smoothly pulls the
61
- camera in front of it (plus a ground backstop so it never drops below the floor).
59
+ the camera won't clip through walls or the ground: each frame it sweeps a small
60
+ SPHERE (not a thin ray a ray that skims 10 cm over a wall reports "clear"
61
+ while the wall still fills the frame) from the eye toward the camera and, if a
62
+ collider blocks the boom, smoothly pulls the camera in front of it (plus a
63
+ ground backstop so it never drops below the floor).
64
+ Level-design corollary: walls you want the camera to respect must be TALLER
65
+ than the eye line (`player y + eyeHeight`, ~1.9 m for a default rig) — a
66
+ 1.8 m hedge is below the boom entirely and the camera will look over it.
62
67
  This is on by default (`cameraCollision: true`); set it `false` to get the old raw
63
68
  orbit. Only the STATIC/fixed world stops it — give walls/floors/terrain a
64
69
  `StaticBody3D` collider (collider-less meshes are invisible to the ray, same as to
@@ -117,6 +122,32 @@ itself never rotates. The skin MOUNTS at 180° (facing away from the default
117
122
  camera, original parity) and then faces wherever it moves; `skinYawOffset`
118
123
  adds a correction for models whose native forward is not +z.
119
124
 
125
+ ## Mounting things on bones (`BoneAttachment3D`)
126
+
127
+ A sword in the hand, a hat on the head, sparks on a wingtip — parent them to a
128
+ `BoneAttachment3D` and they ride the LIVE animated skeleton:
129
+
130
+ ```jsonc
131
+ { "name": "SwordMount", "type": "BoneAttachment3D",
132
+ "props": { "target": "../Skin", "bone": "RightHand" },
133
+ "children": [
134
+ { "name": "Blade", "type": "MeshInstance3D",
135
+ "props": { "mesh": "box", "size": [0.04, 0.04, 0.9], "position": [0, 0, 0.45],
136
+ "material": { "color": "#d8dde8", "metalness": 0.9, "roughness": 0.25 } } }
137
+ ] }
138
+ ```
139
+
140
+ - `target` = node path to the ModelInstance3D; `bone` = bone name. Lookup is
141
+ forgiving: `"RightHand"` also matches `mixamorigRightHand` /
142
+ `mixamorig:RightHand` (agent8's base-model is a Mixamo rig — `Head`,
143
+ `Spine2`, `LeftFoot`, `RightHandIndex1`…).
144
+ - The attachment's own `position`/`rotation` are a BONE-SPACE offset (grip
145
+ adjustments).
146
+ - Purely VISUAL: it follows the rendered skeleton, so headless the node stays
147
+ at its prop transform — keep hit checks range-based from the body, never
148
+ bone-based.
149
+ - `model.boneNames()` lists every bone at runtime when you need to hunt one.
150
+
120
151
  ## Facing a direction in 3D — the +Z-FORWARD rule (read before turning ANY skin)
121
152
 
122
153
  This trips people up REPEATEDLY, so here is the one rule. agent8's `base-model` (and
@@ -130,6 +130,20 @@ Signals: `finished`
130
130
  | `orderGroup` | `"default"` | one of: `background` `terrain` `default` `characters` `effects` `overlay` |
131
131
  | `mode` | `"screen"` | one of: `screen` `y` `none` |
132
132
 
133
+ ## `BoneAttachment3D` — `incanto/3d`
134
+
135
+ | Prop | Default | Kind |
136
+ |---|---|---|
137
+ | `position` | `[0,0,0]` | array |
138
+ | `rotation` | `[0,0,0]` | array |
139
+ | `static` | `false` | boolean |
140
+ | `scale` | `[1,1,1]` | array |
141
+ | `visible` | `true` | boolean |
142
+ | `renderOrder` | `0` | number |
143
+ | `orderGroup` | `"default"` | one of: `background` `terrain` `default` `characters` `effects` `overlay` |
144
+ | `target` | `""` | string |
145
+ | `bone` | `""` | string |
146
+
133
147
  ## `Camera2D` — `incanto/2d`
134
148
 
135
149
  | Prop | Default | Kind |
@@ -942,6 +956,7 @@ Signals: `totalChanged(total)`
942
956
  | `amount` | `10` | number |
943
957
  | `targetGroup` | `""` | string |
944
958
  | `oncePerTarget` | `true` | boolean |
959
+ | `repeatEvery` | `0` | number |
945
960
  | `destroySelf` | `false` | boolean |
946
961
 
947
962
  Signals: `dealtDamage(amount, target)`
@@ -173,6 +173,14 @@ const hit = physics.castRay(origin, dir, maxLen, excludeBody?, { staticOnly?: tr
173
173
 
174
174
  Exclude the shooter's own body when casting from inside it.
175
175
 
176
+ 3D also has a THICK ray — a sphere sweep — for probes where skimming matters
177
+ (the camera boom, ledge feelers):
178
+
179
+ ```ts
180
+ const hit = physics.castSphere(origin, dir, radius, maxLen, excludeBody?, { staticOnly?: true });
181
+ // → { distance, node } | null (distance = travel of the sphere CENTER)
182
+ ```
183
+
176
184
  ## Gamepad
177
185
 
178
186
  `engine.input.attachGamepad(engine)` polls the first connected pad every