Search Unity

Changing rotation in OnStateEnter does nothing

Discussion in 'Animation' started by manuelnp, Aug 30, 2022.

  1. manuelnp

    manuelnp

    Joined:
    Oct 29, 2017
    Posts:
    28
    Hi all,

    I have a pretty simple animator with two main sub state machines, one for locomotion and another one for combat. I would like that every state in combat sub state machine rotates the character towards a given direction. I stick a StateMachineBehaviour to the combat submachine and handled the rotation inside OnStateEnter so every combat move starts facings the proper direction.

    Results are that setting the animator.transform.rotation inside OnStateEnter does nothing, however doing so inside OnStateMove works like a charm. What am I missing here?

    Regards.