Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

entity.points (procNode)

A set of live scene entities as ordered points: each entity's position is a point, and its id, rotation, scale and its own up direction ride along as the attributes entity, orient, scale and up. The points are numbered as id in the order they come. What turns hand-placed markers (a path's waypoints, a fence's posts) into points a graph works on.

Built from scene.query (children of parent), core.entity.read with the pose, core.points and attribute.number.

Inputs

  • source (one of list, children). Default "list". Which of the two ways of naming a set the node uses: "list" reads the entities in entities, "children" reads the children of parent.
  • entities (List<Entity>). Default {}. The entities to read, in the order given; each becomes one point. Read when source is "list", where an empty list is refused.
  • parent (Entity, optional). The entity whose children become the points. Required when source is "children"; a parent with no children is refused.
  • order (one of hierarchy, name). Default "hierarchy". The order children arrive in: "hierarchy" is the scene's own child order, "name" sorts them by entity name, ties broken by id. Read when source is "children".
  • space (one of world, local). Default "world". Which pose each entity is read at: "world" its place in the scene with the whole parent chain applied, "local" its offset from its own parent.

Outputs

  • points: one point per entity, carrying P, entity (the entity's id), orient (its rotation as a quaternion), scale, up (its own +Y turned by its rotation) and id (0, 1, 2, ... in order).

Example

local posts = g.entity.points({ source = "children", parent = "Fence", order = "name" })

Every child of the entity named Fence becomes a point, in name order, standing where the child stands in the world. g.entity.points({ entities = { "PostA", "PostB" } }) reads two named entities in the order given.