Why does Animator.pivotWeight always return 0.5f?

Hello,
I’ve been trying to use this float to figure out which foot I should apply IK on dynamically:

but…
Animator.pivotWeight returns 0.5f every time I read it.

I’ve tried different setups and different locations where I could call it (like update or OnAnimatorIK to see if it changed eventually, or if it was overridden at some point by something else, but nothing happened.

I’ve tried looking this up everywhere and so far no clear answers, so I’m asking again to see if anyone has figured this out before.
Is it deprecated? (because I’ve seen people claim this… “works”?)
or perhaps I’m using it incorrectly?

If it doesn’t work, is there a better alternative than having to go through the hassle of modifying curves in the original animation FBX files? (because that gets nasty real quick when you have a lot of animations)

By the way, my character is using an Humanoid rig (not generic) and I’m using Unity 2019.3.
and if it helps for anything, I had the same problem way back in Unity 5.6.

Thank you!

Anyone…?

I’m having the same problem on the same version of Unity. I think it might be a bug in Unity, but someone with deeper knowledge into Mecanim would have to confirm.

Looks like in 2019.3 pivotWeight returns 0.5 when you disable “Apply Root Motion”. In 2017LTS it works either way, haven’t checked other versions.

Is this a bug or intended functionality?

Enabling “Apply Root Motion” does make it return something different than 0.5f in 2019.3, but I don’t want to have my character move via root motion when I manage that through code.

I downloaded 2017 LTS and I can confirm that Animator.pivotWeight works there without enabling root motion.

I tested in 2018 LTS and 2019 LTS too but it doesn’t work if root motion isn’t enabled.

As far as I’m concerned, there’s no reason for animator.pivotWeight to work differently than it does in 2017 LTS when Root Motion is disabled.

I don’t know if this is a bug, but if it’s by design, I suggest they add it back as an option; like a checkbox below “Apply Root Motion” that it’s called “Legacy Pivot Weight” or something of the same nature.

It’s infinitely times better to write a 2-line code to figure out which foot is planted rather than having to manually go through every animation modifying their curves.

I think I’m going to wait for a couple days, and then report this as a bug to see if I get a definitive answer whether it is or not; seeing that more people have had this problem for a big while but nobody knows how or why this doesn’t work the way we expect it to work.

1 Like

After trying to figure it out, I finally found that the Root Motion Node must be set to None. So now I can use animator.PivotWeight to get the pivot weight on the feet.

Before that, I set the Root Motion Node to be Root then animator.PivotWeight always return at 0.5.

I’ve done this, and it still only returns 0.5, anyone have any idea?

Interesting, all my animations already had this property set to “None”.
Like HuginnRaven says, this still returns 0.5f.

After reading your reply, I thought that It depends on the Animation that you used.
For the testing purpose, I just now changed the Animation to another one(from Asset Store) and set Root Motion Node to Root, the value returns correctly but before that, I used the old one.

Maybe not related to the Root Motion Node. Just forget about it.

6747298--777910--Untitled.jpg

I don’t think this has anything to do with the Root Motion Node property.
I tried changing it to multiple things and nothing really changes about this issue.

pivotWeight only gets calculated when Apply Root Motion is enabled on the Animator component, but that’s not required in 2017 LTS somehow.

Run into the same issue, but pivotWeight returns .5f even with Apply Root Motion enabled. I’m using 2020.2.7f1.

I found that is has something to do with the Root Motion Node, as Thanawat-BEST mentioned. If I simply disable the Motion Node - Animator.pivotWeight starts working as expected. In my case it didn’t really help cause I need Root Motion Node to be imported from animations, and not generated by engine.

oh

It depends on the animation as well. You could try other animation sets.
In some animations, changing the Root Motion Node does not help to get pivotWeight.

2 Likes

2021.3.3f1.180 - returns 0.5f with root set or root set to none ?
2021.3.4f1.xxx - returns 0.5f with root set or root set to none ?

Has anyone figured this out? Do you have to be using root motion ?

Confirm this worked

Problem is this workaround breaks root motion animation. best way is to use then Ik to do check