-
-
Notifications
You must be signed in to change notification settings - Fork 332
Description
I am running into the very same issue as this one:
#172
However, I don't think that the proposed fix there is actually the right solution.
I'm playing a simple idle animation on a character, and then want to fix up a hand position with IK. However, the result keeps jerking back and forth between two extreme positions. This happens due to the underlying idle animation.
See the following video. The purple sphere is used to calculate the pole vector. The pole vector goes from the shoulder joint towards the sphere (and gets normalized).
ik-moving.mp4
When the sphere is at a "critical" location, the IK result oscilates quite a bit.
However, I can also reproduce this without the animation (or rather a paused animation), just by moving the target position slightly:
ik-not-moving.mp4
As you can see, there are two angles where this issue appears. It doesn't happen when the sphere is above or below the model.
This leads me to believe, that some calculation inside the two-bone job is sensitive to what axis the pole vector points at. Ie. in the ozz samples Y is the up vector, but our engine uses different conventions. Maybe some step assumes certain directions?
I've stared at the code a bit, but can't make much out of it. In ComputeStartJoint() there is this piece:
Could it be that the SplatY and SplatZ assume what the ground plane is??
I've now printed the values for rotate_plane_axis_flipped_ss and can confirm that at the point of the problem, it flips from 0.34 | 0.27 | -0.90 to -0.34 | -0.27 | 0.90.
I also noticed, that this only happens because the sampled animation is putting the character into a very different pose than the rest pose. If I use the rest pose instead, everything is fine, but the idle animation rotates the arm about 90 degrees down.
Ie here I've used the rest pose, and then the IK doesn't have this flip:
ik-restpose.mp4
I'm pretty much out of ideas here, whether this could be my fault somehow. I don't see how I could pass a different pole vector to get the desired result.
