Skip to main content

Vox

Client Server

Vox is the entry point for all voxel edits. Each method returns an operation builder — OpAdd, OpRemove, OpPaint, OpCopy, OpSubtract — which you configure with a fluent chain and finalize with :Run():

Vox:Add(Sphere(pos, 2))   -- operation + shape (see Shape)
:Force(ob) -- limit to one object (by default ops affect everything)
:Run() -- schedules the edit; it commits a frame or more later

:Run() is asynchronous — chain :OnFinished(fn) to run code once the edit actually lands. Full walkthrough: Voxel Edits.

Methods​

number flushEdits()​

Run everything the queue is holding, in insertion order - an Add followed by a Remove on the same spot has to stay ordered. Called for you every flushFrames frames; call it by hand only when something needs the pending edits applied right now (a save, a scene teardown, a readback).

number pendingEdits()​

OpRemove Remove(opTarget target)​

Remove a shape from something

OpAdd Add(opTarget target)​

Add voxels. If Vox:Add is called with just a shape (no Force/ForceTag), every Run() does a collision overlap at the current shape to discover what to add onto — this is required since objects can move between runs. If a force list is set (via object target, Force, or ForceTag), the overlap is skipped and filter.forceList is used directly. Prefer Force() when the target is known; it's cheaper and avoids per-Run allocation churn from the overlap query.

OpPaint Paint(opTarget target)​

Change the color of surface voxels

OpCopy Copy(opTarget target)​

Copy voxels from somewhere to an object

OpSubtract Subtract(Object|Object[] subtractObject)​

Subtract the exact shape of the object passed from something

OpInflate Inflate(opTarget target)​

OpDeflate Deflate(opTarget target)​

OpSmoothen Smoothen(opTarget target)​