Mesh
Renders a custom triangle mesh from raw vertex data — the escape hatch for geometry the built-in primitives (Cube, Sphere, Plane, Cylinder) don't cover (procedural terrain, generated meshes, imported non-glTF geometry).
Vertices are non-interleaved: positions (xyz triples), normals (xyz triples), and uvs (uv pairs) are parallel arrays addressed by indices (a flat list of triangle corner indices, 3 per triangle). The tangent frame Filament's LIT shaders need is derived automatically from the normals, UVs, and topology — supply correct normals and UVs.
Mesh(
material = myMaterial,
positions = floatArrayOf(/* x,y,z, … */),
normals = floatArrayOf(/* x,y,z, … */),
uvs = floatArrayOf(/* u,v, … */),
indices = intArrayOf(0, 1, 2, /* … */),
)Parameters
Material applied to the whole mesh.
Vertex positions as xyz triples. Length must be a multiple of 3.
Per-vertex normals as xyz triples. Must match positions in length.
Per-vertex UVs as uv pairs. Length must be 2 * vertexCount.
Triangle indices (32-bit). Length must be a multiple of 3.
World-space position of the pivot point.
World-space rotation as a quaternion.
Per-axis scale.
Mesh-space point that rotation/scale revolve around and that ends up at position. Defaults to the mesh origin.
AABB used for frustum culling. Defaults to one computed from positions. Provide an explicit box if you skip culling or animate vertices beyond the static bounds.
Receives the renderable entity ID once the mesh is added to the scene — use it to register the mesh with view.pick callbacks or other entity-keyed maps.