rig
local rig_api = require(game.ReplicatedStorage.reel).rigRigDesc
Section titled “RigDesc”RigDesc is immutable static layout data.
Its arrays use descriptor indices, which are ordered parent before child.
| Field | Meaning |
|---|---|
count |
Number of joint/Bone animation targets |
names |
Target name at each descriptor index |
parent |
Parent descriptor index, or 0 for a root |
is_bone |
Whether the target uses Bone world-transform math |
name_to_index |
Target-name lookup |
c0, c1_inv |
Motor6D or AnimationConstraint static offsets |
bind |
Bone CFrame |
Motor6D and AnimationConstraint targets use Part1.Name, Bone targets use Bone.Name.
Target names must be unique across the whole rig.
AnimationConstraints must have IsKinematic enabled.
RigState
Section titled “RigState”RigState is mutable and belongs to one character.
| Field | Meaning |
|---|---|
desc |
Shared static descriptor |
motors, bones |
Sparse Instance arrays aligned to descriptor indices, motors contains Motor6Ds or AnimationConstraints |
transforms |
Current local solver output |
world_transforms |
Optional retained world-output array |
blend_scratch |
Optional native multi-track scratch |
Functions
Section titled “Functions”load_rig(model)
Section titled “load_rig(model)”load_rig(model: Model): RigStateScans a model once, creates a frozen descriptor, and returns the matching state.
load_rig_desc(model)
Section titled “load_rig_desc(model)”load_rig_desc(model: Model): RigDescBuilds only the frozen static layout. It retains no template Instances.
bind_rig(desc, model)
Section titled “bind_rig(desc, model)”bind_rig(desc: RigDesc, model: Model): RigStateValidates that model is animation-equivalent to desc, then returns fresh local state with its joint/Bone references reordered into descriptor-index order.
The validation rejects mismatched target count, names, joint/Bone types, animated parents, joint offsets, Bone bind transforms, non-kinematic AnimationConstraints, duplicate targets, and cycles. Motor6D and kinematic AnimationConstraint targets are interchangeable when their target names, hierarchy, and offsets match.
create_rig_state(desc, motors?, bones?)
Section titled “create_rig_state(desc, motors?, bones?)”create_rig_state( desc: RigDesc, motors: { (Motor6D | AnimationConstraint)? }?, bones: { Bone? }?): RigStateCreates a state without scanning or validating a model. Supplied arrays must already be descriptor-indexed.
allocate_blend_scratch(rig)
Section titled “allocate_blend_scratch(rig)”allocate_blend_scratch(rig: RigState): BlendScratchIdempotently allocates the buffers required by a native solve with two or more effective tracks. Call this during setup for any rig that can blend native tracks.
get_world_transforms(rig)
Section titled “get_world_transforms(rig)”get_world_transforms(rig: RigState): { CFrame }Idempotently allocates the retained output used by
compute_world_transforms().
It does not compute any transforms itself.