I want to be able to translate the character an amount each update while a montage with root motion is playing, to basically tweak it to a variable end location.
On the AnimBlueprint:
How do I get the total time/length of a montage?
How do I get the current time in the montage?
bump, I still haven’t solved this, I put the task that needed it aside for a while. Does anyone know how to get the time remaining on a Montage that is playing?
Everything you need is in the Anim Instance class!
You need to create a custom anim instance class for your project.
Then reparent your animation blueprint to use this custom anim instance class as its base class (File->ReParent)
Then checkout AnimInstance.h!
All the functions you want are there, including what the currently playing montage is, so you can then access any info you want about it!
You retrieve your custom anim instance at runtime from your character like this:
//inside Character class
UYourAnimInstance * Animation =
Cast<UYourAnimInstance>( Mesh->GetAnimInstance() );
//Now you can do stuff with your custom vars or functions in your anim instance class!
Animation->Celebrate(); //custom function in your anim instance C++ class
**My Anim Instance Tutorials**
Two relevant tutorials of mine here, with **C++ Code class structure and pics!**
Anim Instance Functions relevant to your question
/** Get Current Montage Position */
float Montage_GetPosition(UAnimMontage* Montage);
/** Has Montage been stopped? */
bool Montage_GetIsStopped(UAnimMontage* Montage);
/** Set position. */
void Montage_SetPosition(UAnimMontage* Montage, float NewPosition);
/** Get PlayRate */
float Montage_GetPlayRate(UAnimMontage* Montage);
/** Get next sectionID for given section ID */
int32 Montage_GetNextSectionID(UAnimMontage* Montage, int32 CurrentSectionID);
/** Get Current Active Montage in this AnimInstance **/
UAnimMontage * GetCurrentActiveMontage();
/** Get Currently active montage instace **/
Relevant Properties on FAnimMontageInstance, accessed via above functions
Check out all of
Thanks Rama. This will work.