Forum rules - please read before posting.

Animator Root Motion Turning problem

Hey guys.

I'm working on my Player character, and stumpled upon an animation issue I can't figure out.
The Player is Mecanim based, using Root Motion. Movement Straight to Cursor. All works great!

I then started to create a couple of interaction animations that has root rotation.

Here's a rough animated example of an interaction animation.
Screenrecording example

In the example above:
When I trigger the animation, the Player rotates fine (Root Motion Turning set to 1 when interacting).
But then the Player rotates back again to the position he was facing before the animation - this is what i'm trying to avoid.
If I turn the Player component is off, it's doesn't rotate back, so I figure it has something to do with the way the Player
component handles turning.

I've tried to create an Action that calls SetRotation() just after the animation, but the Player rotates back before SetRotation kicks in.

Can anyone help me out here? - thanks! :)

Comments

  • What are your AC / Unity version numbers, and how is the animation itself played? By manipulating Animator parameters, or through use of Timeline?

    As the character's feet are animated when he turns back, it looks like this is the result of the turning parameter being changed - rather than AC manipulating the rotation directly.

    I suspect that this is a case of AC assuming the character's rotation hasn't changed, in which case calling SetRotation may well be the way forward. What's the exact code you're running, and when?

  • Hey Chris,

    Running the latest versions. AC 1.70.4 / Unity 2019.3.7f1.

    I'm triggering an Animator animation trough an ActionList, no timeline.
    Yeah the turning "back" animation is what is confusing me. It's my Locomotion turn animation. I think the turning happens when Mecanim goes from the "Interaction state" back to Locomotion state.

    Does this make sense to you?

  • I'm triggering an Animator animation trough an ActionList, no timeline.

    By playing a custom animation by name and waiting until it finishes, or by altering a parameter?

    You mentioned turning the Root Motion Turning factor up to 1 during this - but what is the effect of keeping it there the whole time?

    I think the turning happens when Mecanim goes from the "Interaction state" back to Locomotion state.

    If you're using Root Motion Turning, then turning will be based entirely on the Turn float parameter in the character's Inspector. Meaning - this is controlling it based on where AC thinks the character needs to be, hence the likely need to call SetRotation to reset it.

    Again, what's your exact code and when are you running it? If you want to, you can PM me a .unitypackage of the character (prefab, Animator and animatoin / model assets) for me to look at - at the moment I can only speak in general terms.

  • Allright - got it to work! Your questions and inputs gave me a better understanding. Thanks Chris!

    I was pretty close. I had to turn Root Motion Turning to 0 before SetRotation.

    I'm not a hardcore developer, so i'm trying do everything i can with ActionLists - in this case I had to create two simple ActionList Actions. Player SetRootMotionTurning and Player SetRotation.

    Screen capture of my solution here.

    I'm manually adding the rotation in SetRotation Action - I might be able to create a better solution for this.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.
Do NOT follow this link or you will be banned from the site!