I have an axe chopping animation. I need the tree health to be reduced at a certain point in the animation. The problem is that the normalised time does not start from 0 when one loop of the animation is complete. Rather, it continues increasing indefinitely rendering this code:
public void ChopStatesFSM()
{
switch(chopStates)
{
case ChopStates.triggerChop:
unit.animator.SetBool("Chop", true);
chopStates = ChopStates.hitTree;
break;
case ChopStates.hitTree:
if (unit.animator.GetCurrentAnimatorStateInfo(0).IsName("Chop"))
{
if (unit.animator.GetCurrentAnimatorStateInfo(0).normalizedTime >= .3f &&
unit.animator.GetCurrentAnimatorStateInfo(0).normalizedTime <= .4f)
{
Debug.Log("hit tree");
}
}
break;
}
}
useless. Any hints would be appreciated
I’ve tried using triggers instead and just restarting the animation but, due to the transition with idle, it looked awful. The legacy system was so much better at stuff like this!!!