#Get the remaining time of an animation inside an AnimationTreeStateMachine

16 messages · Page 1 of 1 (latest)

pseudo viper
#

how can I check the remaining time of an animation inside an AnimationTreeStateMachine to finish? I tried using the command 'aniTree.get("parameters/playback").get_current_length()', but it's giving me some weird numbers, not related to the actual length of the animation.

pseudo viper
#

if aniState.get_current_play_position() == aniState.get_current_length():
do_something

#

I'm trying this, but it's not giving me the correct values, Idk why

sly dagger
#

The play position may be normalised.

#

What kind of values are you getting?

#

It may also be difficult for the animation tree to determine the actual lengths of animations in the state, because ultimately, your state could be a blend of multiple other animations.

#

So it might give a best guess, but maybe if you give us some numbers they might make some sort of sense to someone.

pseudo viper
#

well, I was about to show you some scripts of the numbers in action, but as it seems, the incoherence problem seems to be gone.

#

I'm not really sure why, suddenly everything seems to work well

#

I'd guess it's because I changed the blend mode inside one of the BlendSpace2D nodes inside my AnimationTreeStateMachine

#

I don't have animations in the diagonals, so I made the horizontal axis shorter, to prioritise the horizontal animations, while also changing the blend from Continuous to Discrete.

#

One of this changes could have altered the outcome

#

but if the answer is the blend mode, that's just odd

#

because I wasn't seen any blend been done in the animations

#

but I could clearly see that in some directions the numbers of the aniState.get_current_play_position() and aniState.get_current_length() were just incorrect before the changes, but now seems to be ok

#

well, I guess it's all good in the end, even tho I'm just kinda waiting for something to go wrong with the AnimationPlayer and AnimationTree again