UAnimInstance::GetInstanceTransitionTimeElapsed
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTION
Description
Returns the time in seconds that has elapsed since the specified transition began its crossfade. Returns 0.0 if the transition is not currently active.
Caveats & Gotchas
- • Returns a meaningful value only while the transition is actively blending. Once the crossfade finishes and the destination state is fully active, the value resets to zero for the next time the transition fires.
- • Only one transition per state machine can be active at a time. If you query a transition that is not currently blending, you will get 0.0, which is indistinguishable from a transition that just started.
Signature
UFUNCTION(BlueprintPure, Category="Animation", meta=(BlueprintInternalUseOnly = "true"))
float GetInstanceTransitionTimeElapsed(int32 MachineIndex, int32 TransitionIndex) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| MachineIndex | int32 | Index of the state machine containing the transition. | — |
| TransitionIndex | int32 | Index of the transition within the state machine. | — |
Return Type
float Example
Drive a secondary effect based on transition progress C++
float TimeElapsed = GetInstanceTransitionTimeElapsed(MachineIdx, TransitionIdx);
float Duration = GetInstanceTransitionCrossfadeDuration(MachineIdx, TransitionIdx);
float Alpha = (Duration > 0.f) ? FMath::Clamp(TimeElapsed / Duration, 0.f, 1.f) : 1.f;
// Use Alpha to fade in a footstep sound or particle effect See Also
Tags
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?