Builtin Library
README.md
ecs.TransformConstraints
Spec for the TransformConstraints component, which maps to the native TransformConstraints. Holds a list of constraint entries that drive an entity's transform from a target — position, rotation, scale, look-at, parent, or aim.
Fields
constraints— the list of active constraint entries.
Constraint options (EcsConstraintOpts)
type—"position","rotation","scale","lookat","parent", or"aim".targetEntityId— the entity to constrain to.targetPosition— an explicit{ x, y, z }target.axes—{ x, y, z }booleans selecting which axes the constraint affects.offset—{ x, y, z }offset applied to the target.weight— constraint blend weight.tag— label used to address the entry later.
Static methods
Entries are added, removed, and toggled through the physics system, so these are descriptor methods that take an explicit entity id and create the component if it is absent.
add(id, opts)— add a transform constraint entry to an entity.remove(id, tagOrIndex?)— remove entries; a string removes by tag, a number by index, omitted removes all.setEnabled(id, tag, enabled)— enable or disable constraint entries by tag.
local TransformConstraints = require("modules.api.engine.ecs.components.EcsTransformConstraints")
TransformConstraints.add(id, { type = "lookat", targetEntityId = target, tag = "face" })
TransformConstraints.setEnabled(id, "face", false)