Log inGet started
Package

clipShape.module

Newest version

This package holds more than this page lists. See all of its files in its world.

README.md

clipShape

Shape an animation clip to play a way it was not made to, and measure how far it is from playing that way.

  • inPlace(clip, { roots, up? }) takes the clip's travel across the ground out of the bones that carry it (the hips and every bone above them), keeping their rise and fall, so the body stays over one spot.
  • loop(clip, { blend?, roots?, up? }) blends the end of every channel into its start, so its last key holds its first key's value and the clip plays round without a jump. A root's travel across the ground is left to accumulate, so a walk looped without inPlace still moves forward.
  • seam(clip, { roots?, up? }) answers how far the last pose is from the first (rotation in degrees, translation in the rig's units), how far a root travels (travel), the clip's size (its hips' standing height, in the same units, which the tolerances scale by), the bone and channel of the largest gap (worst), and whether each falls within LOOP_TOLERANCE and TRAVEL_TOLERANCE.
  • shape(clip, { loop?, inPlace?, ... }) runs both and answers the seam after.

A clip is the table skeleton.clipToTable answers, changed in place. An .animation asset shapes its own payload with ref:shape(opts) and measures it with ref:seam(), reading its roots from the source rig's humanoid hips; anim_gen's loop and in_place inputs shape the clip a run lands.

local clip = asset.resolve("Wave", "animation")
print(clip:seam().loops)                       -- false: the last pose is not the first
local r = clip:shape({ loop = true, inPlace = true })
print(r.seam.loops, r.seam.inPlace)           -- true true