Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

grid.neighbor_index (procNode)

The index of the cell a fixed step away from each cell, as a Float field read over the grid's own cells: each cell's coordinates plus the rounded offset, held to [0, n - 1] per axis and flattened, so a cell on the border names itself past it. Gathering a channel through the result shifts the channel by one step.

Built from: math.*, vector.*.

Inputs

  • grid (Grid). The grid whose layout is read.
  • offset (Vec3, default (1, 0, 0)). The step, in whole cells along each axis.

Outputs

  • field (Field<Float>). For each cell, the index of the cell offset away.
local air = g.grid.box({ size = vector.create(4, 4, 4), cells = vector.create(4, 4, 4) })
air.point.up = g.grid.neighbor_index({ grid = air, offset = vector.create(0, 1, 0) })