UAnimInstance::GetRelevantAnimTimeRemainingFraction
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTION
Description
Returns the normalized time remaining (0.0–1.0) for the most relevant animation in a state, where 1.0 means at the start and 0.0 means at the end. Useful for transition rules that should fire at a consistent percentage completion regardless of the animation's total length.
Caveats & Gotchas
- • Because the value is normalized by the full animation length, short and long animations trigger threshold-based rules at different real-time points. Consider whether a time-based (GetRelevantAnimTimeRemaining) or fraction-based check is more appropriate for your use case.
- • For looping animations the fraction resets to 1.0 on each loop iteration, so a condition checking for a value near 0.0 will fire once per loop.
Signature
UFUNCTION(BlueprintPure, Category="Animation", meta=(BlueprintInternalUseOnly = "true"))
float GetRelevantAnimTimeRemainingFraction(int32 MachineIndex, int32 StateIndex) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineIndex | int32 | Index of the state machine containing the state. | — |
| StateIndex | int32 | Index of the state to query. | — |
Return Type
float Example
Start a transition in the last 10% of an animation C++
bool UMyAnimInstance::IsNearEndOfAction() const
{
return GetRelevantAnimTimeRemainingFraction(MachineIdx, ActionStateIdx) <= 0.1f;
} Tags
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?