Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

field.position

Each element's position (Vec3). Wired, the positions of geometry's points; unwired, the position of whatever domain the field is evaluated over. The read is a column or the element leaf, so a consuming chain fuses it into its dispatch. A wired read is a column of the geometry's points, which is the form a mask of core.select or elements.keep reads; a geometry without P is refused.

Inputs

  • geometry (Geometry, optional). Whose positions the field reads, one per point. Left unwired, the field reads the positions of the domain it is evaluated over: the geometry an attribute write targets, or the particles a solver steps.

Outputs

  • field: a Vec3 field (unwired) or the geometry's P column (wired).

Example

local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local out = g.attribute.set({ geometry = points, name = "v", value = g.field.position() + vector.create(0, 1, 0) })

Each point's v is its position raised by 1.