engineAdapters.module
README.md
engineAdapters
The engine side: splats as decal projectors, and the physics query the
ballistics need.
The rest of paintKit is engine-free and is what the test suite covers. This is the only module that calls the
engine. NOT YET RUN IN THE ENGINE (2026-11-19). It uses what the builtin decals module documents:
`decals.set(entityId, { material, opacity })` on an entity whose Transform is the projection box (position,
rotation orienting local -Z along the projection, scale as the box size), and `decals.clear(entityId)`.
local Adapters = require("~.modules.engineAdapters")
local view = Adapters.splatView({
material = function(pigment) return materialRefFor(pigment) end, -- one material per pigment (required)
depth = 0.4, -- how deep the box projects into the surface (metres)
opacity = 1,
parent = nil, -- entity id the projector entities are parented to (optional)
entityOf = function(target) return entityId end, -- for splats ON things: the thing's entity (the
-- projector is parented to it and placed in its local space)
})
view:sync(store:drain()) -- call after anything changed: spawns, resizes and removes projectors
view:clear() -- remove every projector it made
local query = Adapters.query({
classify = function(entityId, hit) return kind, target, part end, -- what an entity is to the game
entityOf = function(target) return entityId end, -- the firer's entity (to exclude it)
things = function(centre, radius) return { { target, kind, part, x, y, z } } end, -- for splash and cones
}) -- the query modules/ballistics and modules/impact take, on Physics.raycast
To confirm on first run: the decals README says a projector stamps along its local -Z, while its own example
rotates +90 degrees about X to "project down" (which turns local +Z down). `facing` below follows the README;
if splats come out faded or on the wrong face, negate the direction passed to it in `place`.
Projectors are batched by the engine eight to a pass per material, so the number of pigments, not the number
of splats, sets the pass count; the store's `max` is the budget.
The interface is documented in the header of init.luau; this file repeats it for the asset browser.