"Cross-fade animations WITHOUT an AnimGraph"
- Walk↔run, idle↔walk, or ground↔air switches snap / hard-cut.
- Clips look fine in isolation; transitions read as jank.
- You assumed you needed a full AnimGraph (
.vanmgrph) just to cross-fade.
On direct sequence playback (Sequence.Name = "walk" etc.), the engine will hard-cut unless blending is enabled.
SkinnedModelRenderer.Sequence.Blending (bool) is the cross-fade switch. Engine docs (Sandbox.Engine.xml, AnimationSequence.Blending):
Get or set whether animations blend smoothly when transitioning between sequences.
Per-clip duration comes from the vmdl AnimFile fields fade_in_time / fade_out_time. Those can sit in the vmdl dormant forever if nothing ever sets Sequence.Blending = true — the engine ignores them and hard-cuts.
Set once after creating the renderer:
_renderer.Sequence.Blending = true;Every subsequent hard switch still works the same:
_renderer.Sequence.Name = "run";
_renderer.Sequence.PlaybackRate = rate;…but cross-fades instead of popping.
Shape the blend in the vmdl (ModelDoc AnimFile / AnimationList), for example:
| Clip | fade_in | fade_out |
|---|---|---|
| idle | 0.25 s | 0.25 s |
| walk | 0.20 s | 0.20 s |
| run | 0.15 s | 0.15 s |
| shocked / hit react | 0.05 s in | 0.20 s out |
Defaults around 0.2 s are fine if you don't need per-clip tuning.
Do not spawn a second SkinnedModelRenderer and lerp opacity — doubles skinning cost, needs alpha materials, looks worse than bone-space blend. BoneMergeTarget is for attaching clothes/props to a parent skeleton, not for blending clips.
AnimGraph is the heavier alternative — use it when you need layering, bone masks, IK, aim-blend. For plain state-to-state cross-fades it is overkill. Reference graphs live under addons/base/Assets/animgraphs/tutorial/ and citizen's .vanmgrph.
Direct playback already knows how to interpolate bone poses between the outgoing and incoming sequences; Blending is simply the enable bit. Fade times authored on each clip tell the mixer how long to spend entering/leaving that sequence. AnimGraph adds a node graph and parameter API on top — unnecessary if all you needed was "don't pop."