mesh-builder-scripting

Constructs and animates runtime meshes in Lens Studio using the MeshBuilder TypeScript API.

16|2|Updated Apr 13, 2026
One-click install
npx skills add https://github.com/lens-studio-devs/ls-extensions --skill mesh-builder-scripting-lens-studio-devs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mesh-builder-scripting
Source: https://github.com/lens-studio-devs/ls-extensions/tree/main/plugins/ls-clad/skills/mesh-builder-scripting
Command: npx skills add https://github.com/lens-studio-devs/ls-extensions --skill mesh-builder-scripting-lens-studio-devs

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing procedural geometry in Lens Studio is error-prone: inverted triangle winding makes meshes invisible under back-face culling, shared vertices smear normals, and hand-written material files collide with built-in UUIDs. This Skill provides verified MeshBuilder API patterns and helper functions so scripts produce correct, visible runtime meshes on the first attempt. ## Core Features & Use Cases - Verified geometry generators: Copy-ready addBox, buildCylinder, buildLathe, buildExtrude, and buildTube helpers with numerically verified CCW winding and per-face normals. - Full MeshBuilder coverage: Topology examples (Points, Lines, LineStrip, TriangleStrip, TriangleFan), dynamic per-frame vertex updates via setVertexInterleaved, and skinned meshes with boneData and setBones. - Vertex color material pipeline: Ships a pre-built SimpleVertexBaseColor.lspkg package with a stable material UUID, avoiding hand-written .mat YAML pitfalls. - Use Case: Ask the agent to build a chess piece in Lens Studio — it selects the lathe generator, writes a TypeScript @component that creates a RenderMeshVisual at runtime, wires the vertex color material, and verifies the result visually from two camera angles. ## Quick Start Ask the agent to create a procedural mesh in Lens Studio, for example: build a red heart-shaped extruded mesh and add it to the scene.

Frequently Asked Questions about mesh-builder-scripting

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a procedural mesh in Lens Studio with TypeScript?

Create a MeshBuilder with a vertex layout (position, normal, color), set topology and indexType, append vertices with appendVerticesInterleaved and indices with appendIndices, then assign builder.getMesh() to a RenderMeshVisual created in onAwake. Call updateMesh() after changes.

Why is my MeshBuilder mesh invisible or inside-out in Lens Studio?

Lens Studio culls back faces by default, so triangles wound clockwise are invisible. Each triangle's indices must trace counter-clockwise viewed from outside; verify with the cross product (v1-v0) x (v2-v0) pointing along the outward normal, or flip the index order.

How do I animate mesh vertices every frame with MeshBuilder?

Use setVertexInterleaved(index, data) inside an UpdateEvent to rewrite a single vertex's full interleaved attribute array, then call updateMesh() once per frame. This moves vertices without rebuilding the mesh.

Which generator should I use for smooth shapes like vases or pipes?

Use buildLathe for rotationally symmetric shapes (vases, chess pieces), buildExtrude for 2D outlines with depth (hearts, gears), and buildTube for circular cross-sections swept along a path (pipes, cables). Stacking boxes produces blocky results for curved geometry.

Can MeshBuilder create skinned meshes with bones?

Yes, add a boneData attribute (4 components) where each component's integer part is the bone index and fractional part is the weight, then call setBones with bone names and inverse bind matrices. Vertex addition or deletion is not supported on skinned meshes, only setVertexInterleaved edits.

When should I use MeshBuilder scripting instead of Text-to-3D asset generation?

Use MeshBuilder scripting for runtime-constructed or animated geometry driven by code. For author-time static GLB generation via SPECS Text-to-3D, FAST3D, or Blender voxel workflows, use the /build-mesh skill instead.