Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

mesh.box

A box centred on the origin: six faces of two triangles each, with flat normals and the unit square as texture coordinates on every face. Use it for crates, walls and any block a graph cuts, stacks or displaces.

Each face holds its own four points, so the box has 24 points and 12 triangles, and every point carries its face's normal. The faces are laid out +X, -X, +Y, -Y, +Z, -Z.

Inputs

  • size (Vec3, default { x = 1, y = 1, z = 1 }). The box's width, height and depth along X, Y and Z, in metres.

Outputs

  • geometry (Geometry). Triangles with P, N and uv on their points; primitives carry vstart and vcount.
local crate = g.mesh.box({ size = vector.create(2, 1, 1) })