playMaker

Author Topic: Animator keep switching "apply root Motion" to "handle by scrip"  (Read 4321 times)

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Hi,

This is my first ever forum post, I'm really hesitant to make posts but I've been googling on this issue for quite some time now and I have no clue on what to do...
To be honest I do not know if this is a Playmaker issue or Unity issue (or me issue) but maybe someone have encountered this problem as well and could help me out.

So, what happens is that today when I started Unity to continue develop my game the 3rd person character could not move. I was very surprised because everything worked fine yesterday, and I have literally haven't changed anything from yesterday.
After a lot of investigation I found out that for some reason the "Apply root motion" switches to "handle by scrip" when I playtest the game.

The only scripts I have a are playmaker FSMs (except for one small custom scrip). I've disabled every playmaker FSM on the character but it still switches to "Handle by script".

Before I go into detail about the setup. the game etc. I just gonna start to see if anyone ever encountered anything like this before and could just point me in the right directed. (ps. this have happened one time before and my solution then was to delete the whole character and start over from scratch...)

Thanks!



« Last Edit: January 27, 2017, 04:43:29 AM by Krillan87 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15467
  • Official Playmaker Support
    • View Profile
Re: Animator keep switching "apply root Motion" to "handle by scrip"
« Reply #1 on: January 27, 2017, 05:47:22 AM »
Hi,

 it's simply because you have dropped a  component on it and it has the callback for handling root motion. The Animator assumes you are going to move the character via scripting instead of via the animations.

can you paste the small custom script content? or pm me if this is private.

Bye,

 Jean

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Re: Animator keep switching "apply root Motion" to "handle by scrip"
« Reply #2 on: January 27, 2017, 04:48:34 PM »
Hi,

 it's simply because you have dropped a  component on it and it has the callback for handling root motion. The Animator assumes you are going to move the character via scripting instead of via the animations.

can you paste the small custom script content? or pm me if this is private.

Bye,

 Jean

Hi!

I can't understand what component on the Game object that has the callback for handling the root motion. It work perfect the day before.

Okey, the "small scrip" is not actually small, but I the script work perfect so I just assumed that it could not have anything to do with this scrip. The scrip is "Inventory Master" and it's found on the asset store: https://www.assetstore.unity3d.com/en/#!/content/26310

Just wanted to say that this have happened once before and then I deleted the character and re-did all the FSM.

I'm so glad if you can help me out here, my whole project is just standing still for the moment and I have no clue how to get it back.

Do you need anything else to help me? some project files or anything?

Superthanks!

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Re: Animator keep switching "apply root Motion" to "handle by scrip"
« Reply #3 on: January 29, 2017, 04:04:31 AM »
Okey, I made some progress in this issue. I have identified the component(the last FSM) that causing the issue. To resolve is, I needed to delete the whole FSM, I was not enough to just disable it.

I embedded 4 pictures of the FSM if anyone can take a look at see why this causing a problem. It is a really simple FSM that is doing the following:

1. set the animation int that handles the different attack animations to 0. Set the attack button to mouse2

2. set the attack button to "null" (so the player can't attack do another attack while one is already playing). Set the animation int to 99.

3. Wait for the a animation event to happen (A sword swing). At one point in the swing toggle on a box collider around the sword and play one of 3 random sound clips.

4. Disable the box collider again and set the set the animation int to 0.

Anyone knows why this FSM switch my foot animation to "handled by scrips"?

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Re: Animator keep switching "apply root Motion" to "handle by scrip"
« Reply #4 on: January 29, 2017, 05:32:37 AM »
Okey, it seems that I'm the only one here haha.

Anyway, I think I found the issue and my best guess is that this is a bug somehow.

the failing state is state 2. (The one that sets anim int to 99 and string value to "null")

I have tried to recreate the problem in other scenes but it is a bit random. If I copy the whole state and paste it in another FSM the same bug appears. (The state doesn't even have to be active, or played for the bug to appear)

If the bug happens, the only way to resolve it is to delete the whole FSM-component and create a new one from the beginning.

So it kinda seems like this state is corrupt in some way. If I manually re-create the FSM and add all actions manually to each state (not copying) it works.

This is super weird. If this is NOT a bug and someone actually finds out what I am doing worng here I would be very very happy to know!

Thanks

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 6019
    • View Profile
    • jinxtergames
Re: Animator keep switching "apply root Motion" to "handle by scrip"
« Reply #5 on: January 29, 2017, 12:50:40 PM »
Hi,
That indeed seems to be a bug.
Could you send a bug report, you can find it in unity under playmaker/tools.

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • View Profile
    • Can't code? Who cares! Make games anyway!
Re: Animator keep switching "apply root Motion" to "handle by scrip"
« Reply #6 on: January 29, 2017, 03:31:55 PM »
I just uploaded some simple animator scripts that might be useful to help you fix/debug this issue- There are scripts to enable/disable root motion in specific animator states https://github.com/mdotstrange/animatorScriptsForPlaymakers
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

Krillan87

  • Beta Group
  • Full Member
  • *
  • Posts: 185
    • View Profile
Re: Animator keep switching "apply root Motion" to "handle by scrip"
« Reply #7 on: January 31, 2017, 05:03:16 AM »
I just uploaded some simple animator scripts that might be useful to help you fix/debug this issue- There are scripts to enable/disable root motion in specific animator states https://github.com/mdotstrange/animatorScriptsForPlaymakers

Oh nice man! This was actually my first go-to solution when I ran into the problem the first time but there is no action for this in unity (and you can't manually toggle root button in playmode). I will test your custom action.

Thanks a bunch for all help everybody <3