Builtin Library
- ..
- .metadata246 B
- README.md2.0 KB
- init.luau3.4 KB
- unpack.module
README.md
instances.unpack (procNode)
Take a population (the copies instances.to_points made) or a piece set (the points instances.pack and geometry.merge made) apart. op "geometry" answers loose geometry: a population merged into one shape with every point attribute stamped on each point of its copy (instances.realize), or one piece of a piece set, wearing its material. op "elements" answers points that each carry their own loose Mesh record, which stand as entities: one per copy, or one per piece. Empty takes "geometry" for a population and "elements" for a piece set. A value that is neither is refused.
Inputs
value(Points). A population or a piece set.op(String, default "", one of "", "geometry", "elements"). What comes back: "geometry" (loose geometry) or "elements" (points carrying a looseMesh). Empty is "geometry" for a population and "elements" for a piece set.attribute(String, default "variant"). With a piece set andop"geometry": the attributenameis looked up in.name(String, default ""). With a piece set andop"geometry": the piece whoseattributeholds this value (compared as text). Empty takes the piece atindex, or the only piece.index(Float, default 0, at least 0). With a piece set andop"geometry": the piece's place in the set, counted from 0, whennameis empty. A place past the set is refused.
Outputs
value(Geometry or Points). The loose geometry or the points carrying their ownMesh.report(List). What a loose geometry cannot hold, as{ attribute, note }rows: for a piece set, every piece point attribute besidesMesh,Material,idandP; for a population,ShaderDatalanes and pieces that wear different materials.
local kit = g.geometry.merge({ a = g.mesh.box({}), b = g.mesh.sphere({}), pack = true, names = { "crate", "ball" } }).value
local ball = g.instances.unpack({ value = kit, op = "geometry", name = "ball" }).value