IK constraints solve differently in export/runtime than in the editor — one-frame snap at frame 60
An animation that plays back correctly in the editor snaps to a visibly wrong pose in a single frame, between frame 59 and 60, in every export. The animation has been around for years in our application, but has without changes started to snap (we use Flutter but the bug is reproducible in all (?) formats.
mp4 renders from the render queue and the exported `.riv` in rive-flutter both show the identical snap, and the wrong pose persists to the end. Scrubbing or playing the same frames in the editor shows no jump at all.
I've attached the backup file, a render, and a detailed description for AI use. Details below — the short version is that the inputs to the IK solve are continuous across the boundary while its output is not.
The rig
- A rope (9-vertex PointsPath with a stroke) skinned to an 8-bone chain: Root Bone → Bone 1 → … → Bone 7.
- Six single-bone IK constraints on Bone 2–Bone 7, all with `parentBoneCount = 0`, all targeting the same empty group. Strengths 50 / 60 / 70 / 70 / 80 / 100 %.
- Root Bone has a world-space transform constraint (100 %) to a second empty group.
- Bone 1 carries no IK constraint.
- No bone is keyframed directly — all bone motion comes from constraints. Keyframes exist only on the two empty groups and on one flag's rotation.
Artboard `banner` (660×390), animation `fall_down` (60 fps, 200 frames, one-shot, no work area).
What it looks like
Mean absolute pixel difference between consecutive frames of the rendered mp4:
```
frame 56 3.5152 frame 60 23.1656 <-- the snap
frame 57 3.2968 frame 61 7.3250
frame 58 3.0239 frame 62 2.5794
frame 59 2.7239 frame 63 1.2889
```
Motion decays smoothly and then spikes to 23.2 in one frame — a bigger single-frame change than anything in the intended animation, whose opening fall peaks at 18.7. The rope goes from a deep smooth curve to nearly straight with a sharp kink at Bone 2, the bone nearest the root.
The numbers
I instrumented the file with a Luau utility script that instantiates the artboard, steps `fall_down` with `setTimeFrames(f)` + `advance(0)` for f = 0…200, and prints world transforms. It reproduces the snap. Local bone rotations in degrees, relative to parent:
| Frame | Root | Bone 1 | Bone 2 | Bone 3 | Bone 4 | Bone 5 | Bone 6 | Bone 7 |
| 58 | 0.579 | −6.343 | −13.123 | −7.343 | −9.789 | −4.024 | −0.804 | −7.293 |
| 59 | 1.153 | −6.343 | −13.451 | −7.560 | −9.902 | −4.061 | −0.818 | −7.294 |
| 60 | 1.653 | −6.343 | −24.299 | −10.308 | −4.449 | +0.684 | +1.810 | +0.778 |
| 61 | 2.074 | −6.343 | −29.966 | −7.930 | −0.055 | +1.738 | +0.801 | −0.299 |
Bone 7's per-frame step goes from 0.0006° to 8.07°. Bone 1, the only bone without an IK constraint, never moves — which isolates the IK constraints as the source.
The inputs are continuous:
| Frame | IK target world position | Bone 2 world position | Bone 2 world rotation |
| 58 | −371.6040, 349.7632 | 495.2980, 100.7103 | 143.178° |
| 59 | −371.4801, 349.8250 | 496.6781, 101.7581 | 142.932° |
| 60 | −371.4801, 349.8250 | 497.8871, 102.6583 | 153.281° |
| 61 | −371.4801, 349.8250 | 498.9116, 103.4084 | 158.526° |
The target's world position is bit-identical across the 59 → 60 boundary. Bone 2's own world position moves smoothly. Both inputs to the aim calculation are continuous, yet the solved rotation steps 10.35° in one frame.
The constraint looks stateful. After the snap, Bone 2's world rotation converges in steps of 5.25, 2.69, 1.40, 0.75, 0.43, 0.25, 0.14 — each roughly half the previous. That ratio of ~0.5 equals Bone 2's IK strength of 50 %, so the constraint appears to filter toward its target angle using strength as the coefficient, carrying state between frames.
It converges to 164.34°, which is the geometric aim-at-target angle from Bone 2's origin. Before frame 60 it sat at ~143° — about 21° off that angle — and was not converging toward it. So the solver's target angle changes discontinuously by ~21° while its geometric inputs stay continuous. The editor evidently keeps the ~143° branch throughout.
Ruled out
- Stale render revision. Recolored a flag and re-rendered: the color change appeared immediately, the snap was unchanged. Renders do pick up the latest edits.
- The IK target's last keyframe. Its x/y keys originally ended at frame 59. Adding explicit hold keyframes at frame 200 with identical values, so the animation interpolates actively across the boundary, changes nothing. The target's world position is identical either way.
- `invertDirection`. Flipping it on all six constraints produced bit-identical output across all 200 frames. A control test (all strengths to 0, which correctly pinned every bone to its setup rotation) confirmed property changes do reach the instance. So `invertDirection` appears to be a no-op at `parentBoneCount = 0` — possibly its own bug, or at least a control that should be disabled in the UI in that configuration.
Questions
1. Why does the runtime IK solver pick a different target angle from frame 60 onward when its geometric inputs are continuous, and why does the editor not do the same?
2. Is the IK constraint intended to be stateful across frames, filtering by strength? If so, how is that state expected to stay consistent between editor playback and a cold per-frame runtime solve?
3. Should `invertDirection` have any effect when `parentBoneCount = 0`?
Note on the attached files
Two things in it are debugging changes, not causes: a transform constraint with no target was deleted from `Flags › Root Bone › Bone 1 › Triangle`, and hold keyframes were added at frame 200 on the IK target group's x and y. The snap predates both and is unaffected by them.
Happy to send the Luau dump script if it's useful.
rive-bug-report.mdsuccess-banner-bug.rev