Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Merge branch 'main' into feat/613-vertex-groups

Nguyen Xuan Anb4d104839dcb
diff --cc skills/build-67js-scene/references/mesh-modeling.md
index 752b7765,dae66163..f376a667
--- a/skills/build-67js-scene/references/mesh-modeling.md
+++ b/skills/build-67js-scene/references/mesh-modeling.md
@@@ -16,12 -16,14 +16,17 @@@ requires a clean lint, so keep them val
1. Name the parts and their rough sizes first. One part is one `mesh` geometry: a `base` primitive, an `edits` log and
an optional `stack`. Separate parts (a lid, a handle) are separate geometries placed by nodes.
2. Start from the closest base. `box` is a unit cube from -0.5 to 0.5 (`bevel: 0` for crisp edits); `cylinder` has
- radius 1 and height 1 centred on the origin (`bevel: 0`); `sphere` has radius 1; `lathe` turns a profile;
- `extrude` makes outlines with holes. Set proportions first by translating tagged faces, so later widths and offsets
+ radius 1 and height 1 centred on the origin (`bevel: 0`); `sphere` has radius 1; `lathe` turns a
+ profile; `extrude` makes outlines with holes. These shapes are plain geometry records only (not mesh bases):
+ `cone` (`{ "id": "spike", "type": "cone", "radiusBottom": 1, "segments": 32 }`, point on top, height 1; a `radiusTop` makes a
+ frustum), `icoSphere` (`{ "id": "ball", "type": "icoSphere", "subdivisions": 2 }`, even triangles, no poles), `circle`
+ (`{ "id": "ring", "type": "circle", "innerRadius": 0.6 }`, a unit disc facing +Z, a ring when `innerRadius` is above 0),
+ `line` (`{ "id": "rod", "type": "line", "from": [0, 0, 0], "to": [0, 2, 0], "radius": 0.03 }`) and `grid` (`plane` is the same
+ shape). To edit one, build the mesh from a cylinder or sphere base instead. Set proportions first by translating tagged faces, so later widths and offsets
stay in real units: a 0.5 x 0.6 x 1.0 box is `right` by -0.25, `left` by 0.25, `top` by -0.4.
+ Paint and weight after the shape edits: `vertex_color` (`color`, `field` or a two-color `gradient`) colors the selected faces and
+ exports as `COLOR_0`; `vertex_group` (`name` plus `weight`, `field` or `gradient`) makes weights that `displace` reads with `group`
+ and a cloth sheet reads with `pinGroup`. Example: `{ "op": "vertex_group", "name": "hem", "gradient": { "axis": "y", "range": [-0.5, 0.5], "weights": [1, 0] } }`.
3. Add edits in small batches with `mesh_edit` (or in the recipe). Name every edit (`name: "lid"` gives `lid.cap`,
`lid.side`); an unnamed one gets `<op>-<index>`, which is hard to predict. Select faces by tags, never by index.
4. After each batch read the `mesh_edit` result: `edits[i].selected`, `tags` and `edges` say what each edit touched;