What's the proper way to get the normalized 0-100% complete float for a TrackEntry being stored in a variable when an animation is played?

.time and .lastTime are giving results that continue to count up in looping animations, but I need to get the percent complete of my attack animations so that I can chain in other attacks if you are 95% completed in a current one etc.

I have this working in mecanim by simply having exit times, but I'm looking into using NodeCanvas and an FSM to get away from it if it gives us more reliable events from the timeline which is greatly needed.
  • Сообщения: 189


I think you want .time as the numerator and either .animation.duration or .endTime as the denominator.
.endTime is normally set to the value of .animation.duration but you can change it in case you want a custom end time for your track entry.

assuming the formula
current/total = normalized
Аватара пользователя
  • Сообщения: 5366

Вернуться в Unity