Stop-motion / stepped animation in Unity. A self-contained asset implementing PCHIP-based motion quantization for animator-driven rigs, procedural rigs, and physics ragdolls.
The idea: sample the underlying continuous motion (animator output, any bone-driving system, or rigidbody trajectory), fit it with monotone cubic splines, and replay it in stepped frames chosen by an arc-length-weighted deviation threshold. The result reads as hand-animated stop-motion rather than smooth linear interpolation.
AnimationStepper— applies stepping to any bone hierarchy each frame. Two modes:AnimatorDriven(default) — reads Animator output. Detects state transitions and flushes held poses automatically so new states start clean.AnySource— reads whateverlocalRotationthe bones have each frame. No Animator required. Works with IK rigs, script-driven bones, cloth results baked to transforms, motion matching, audio-reactive bones, or anything else that writes to bone transforms directly.
RagdollStepper— snapshots a physics ragdoll, builds a transform-only visual proxy, hides the source, and replays the snapshot stream in stepped frames. Settles when motion drops below threshold; wakes if hit again.OnTwosProfile— a ScriptableObject holding all the tuning (τ values, hold-frame bounds, settle thresholds, bone-exclusion keywords, per-bone overrides). Drop one onto an authoring component and you're done.RagdollStepper— exposesOnSettledandOnWokeC# events so you can hook dissolves, despawns, prop swaps, or re-enable interactions without polling.IsSettledandVisualProxyare also public properties.OnTwosAuthoring— single MonoBehaviour entry point. CallActivateRagdoll()from your own code to switch from animator-driven to physics-driven stepped motion. CallDeactivate()to reverse the transition (get-up, revival, stagger recovery).
Drop the OnTwos folder anywhere under Assets/ in your project. The
two assembly definitions (OnTwos.Runtime, OnTwos.Editor) keep
editor code out of player builds automatically.
Unity 2021.3 LTS and newer should work. Unity 6 is supported — the runtime uses
#if UNITY_6000_0_OR_NEWER to select Rigidbody.linearVelocity vs the legacy
Rigidbody.velocity.
Assets → Create → CrunchyRagdoll → Profileto make a profile asset.- Add
OnTwosAuthoringto a character GameObject. - Drag the profile onto the authoring's
Profileslot. AnimationStepperis added automatically on Awake whenAutoBindOnAwakeis true (the default). You only need to add it manually if you have turnedAutoBindOnAwakeoff.RagdollStepperis created automatically the first timeActivateRagdoll()is called whenAutoCreateProxyis true.- For physics-driven motion: call
GetComponent<OnTwosAuthoring>().ActivateRagdoll()from your own code, or use the Activate Ragdoll button in the Inspector during Play Mode. - To reverse it (get-up, revival): call
GetComponent<OnTwosAuthoring>().Deactivate().
Set AnimationStepper.Mode to AnySource. The stepper reads whatever
localRotation the bones have each LateUpdate — no Animator needed. Call
FlushAllHolds() manually if your source system has discrete states and you
want to prevent cross-state pose ghosting.
OnTwos/
├── Runtime/ — runtime code, separate asmdef, ships in player builds
├── Editor/ — custom inspectors, drawers, preview window
└── Samples~/ — demo prefab setup walkthrough (see Samples~/README.md)
- Demo prefabs are not pre-authored.
Samples~/contains a step-by-step README. Setting up the demo prefabs manually takes about two minutes and produces something more reliable than auto-generated YAML referencing imported humanoid rigs. - Visual proxy is mandatory for the ragdoll path. Writing
localRotationdirectly to non-kinematic bone Rigidbodies causes CharacterJoint constraint error to accumulate, and the bodies drift sideways under gravity. TheRagdollStepperalways builds a proxy at the scene root with all physics and OnTwos components stripped, and writes the stepped pose there.
For each tracked bone, every frame:
- Sample the source value (rotation / position / animator pose / any source).
- Append to a
MonotoneCubicSamplerrolling buffer; fit a Fritsch-Carlson PCHIP spline over the recent window. - Walk the spline forward — emit a new "snap" when accumulated deviation (rotation degrees or position meters) exceeds τ, with candidate placements weighted by arc length.
HoldFrameSchedulergates the snap on elapsed time, from aStepRatein poses per second (12= the classic "on twos"), so the cadence is identical at any framerate.CadenceJittersets how far bones may drift off that shared beat —0locks the whole rig in step.- Apply the chosen snap pose to the visible bones; everything else holds.
For ragdolls, samples come from Rigidbody world transforms rather than
Animator output, and stepped poses are written to the visual proxy rather than
the source bones.
MIT — see below.
The algorithm, architecture, and design of OnTwos are original work by the author. C# implementation was produced with AI assistance.
MIT License
Copyright (c) 2026 Yusuf Hosam
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Profile inspector: open any
OnTwosProfileasset. - Live telemetry:
Window → CrunchyRagdoll → Preview(during Play Mode). - Per-component foldouts: select an authoring or stepper in the scene.