Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

entity.geometry (procNode)

The mesh a live scene entity's Model draws, as a Geometry: in its own space, or posed into the world. What brings an authored model into a graph to scatter on, cut or rebuild.

Built from a CPU read of the entity's Model asset and pose, and io.import of the mesh. With "world" each point's P is scaled by the entity's lossy scale, turned by its rotation and moved to its position, and each normal N takes the inverse scale and the same rotation and is normalized again.

Inputs

  • entity (Entity). Default "". The scene entity whose Model mesh is read. An entity with no Model is refused naming it.
  • space (one of object, world). Default "object". Where the mesh lands: "object" keeps it in its own space, the shape as authored; "world" bakes the entity's position, rotation and lossy scale into the points and normals.

Outputs

  • geometry: the mesh as a Geometry, with every attribute the mesh carries.

Example

local mesh = g.entity.geometry({ entity = "Crate", space = "world" })

For an entity named Crate drawing the cube model at (5, 0, 0) with scale 2, mesh holds the cube's 24 points and 12 triangles, spanning (4, -1, -1) to (6, 1, 1); with space = "object" it spans (-0.5, -0.5, -0.5) to (0.5, 0.5, 0.5).