Log inGet started
Package

variants.procNode

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

instances.variants (procNode)

Stand one of several sources on each point, by a variant index per point. Each point's Mesh and variant hold its index (made a whole number) into the sources, which the points' detail lists as labels.Mesh, one { mesh = source } record per source; the points are placed by instances.place. instances.pick_random and instances.pick_by_attribute are built on it.

Inputs

  • points (Points). The points that stand the sources.
  • sources (List<Geometry>). The variants, in order: a source's position here is the index a point holds for it.
  • variant (Field<Float>). Each point's 0-based index into sources.
  • transform (Transform, optional). Per-point offset, rotation and scale, written as the points' placement.

Outputs

  • instances (Points). The points carrying Mesh, variant, orient and scale.
local pts = g.points.grid({ countX = 4, countZ = 1, spacing = 2 })
local alternating = g.instances.variants({ points = pts, sources = { g.mesh.box({}), g.mesh.sphere({}) }, variant = g.math.mod(g.element.id, 2) })