CToolAnimation
Overview
Animation montage playback with support for speed control, stop conditions, blend out, and end callbacks.
Delegate
| Name | Description |
|---|---|
| FCBP_whatToDoOnMontageEnded | Dynamic delegate with two params: UAnimMontage* and bool (isInterrupted). |
Struct: FCBP_montageEvent
| Name | Description |
|---|---|
| onMontageEndedAsDynamicDelegate | Dynamic delegate called when montage ends. |
| onMontageEndedAsLambda | Lambda called when montage ends. Signature: void(UAnimMontage*, bool interrupted). |
Functions
| Name | Description |
|---|---|
| playAnimation | Play a montage on a skeletal mesh. Supports speed, stop condition, blend, breaker, and end callback (lambda or dynamic delegate). Returns true if playback started. |
// Simple playback
playAnimation(skeletalMeshComponent, myMontage, FName("Attack"));
// With speed and end callback
playAnimation(skeletalMeshComponent, myMontage, FName("Attack"),
[](float delay) { /* started, will last delay seconds */ },
1.5f, // speed
nullptr, // no stop condition
0.3f, // stop blend
nullptr, // no breaker
FCBP_montageEvent{nullptr, [](UAnimMontage* m, bool interrupted) {
// montage ended
}}
);
// With stop condition: stop as soon as bShouldStop becomes true
playAnimation(skeletalMeshComponent, myMontage, FName("Walk"),
nullptr, 1.0f,
[this]() { return bShouldStop; }, // stop condition
0.3f // blend out time
);Notes
- The anim montage plays in a slot of the AnimGraph — the slot must exist or nothing happens.
- If a breaker function is provided and returns true, playback is skipped.
- If playback fails, the end callback is still called (with interrupted=false).