So I’m trying my hand at Inverse Kinematics, but the thing I notice is if I add something like a bounce motion or tilting, then the IK goes to the wrong position. Like, it goes to what would have been the correct position without the other animation applied, but offset the same distance as the bounce motion.
So for example I have something like this, where I have a hand holding a spoon.
It hard to tell without seeing your controller,
one hint could be that you are using multiple layer in your controller, in this case you need to specify which layer has an IK pass, and of course the layer with the leaning forward animation should have the IK pass checked.
Also you want to to setup your IK goal only on this layer. If you leaning forward animation is on layer 1 then modify your code like this
I was only using the base layer, but since you mentioned I’ve tried the multiple layers. I tried IK layer as layer 1 and Animation Layer as Layer 2 and then switched it the opposite order.
This is what it looks like with IK on Layer 2, anything jump out as suspect?
I have also tried the IK Layer as Override.
There are no transitions, only one animation playing on a loop.
I don’t think it’s a bug with Unity, I still think it’s something I’m overlooking, because I haven’t the experience with IK.
You can see in the image Soldier@t-pose because I tried it with a Mixamo model to confirm it wasn’t that I didn’t rig properly, and the same problem happens with the soldier. That I repeat it both times, I can’t believe it’s a bug and not something I’m doing wrong.
Could it be a masking thing? The rig is imported as humanoid, and I did try out a mask at some point, but I hadn’t tried every combination in terms of I could apply a mask to the animation layer that ignores the one arm, or maybe apply the opposite mask to the IK layer?
I could kluge together something where I store the resting position of the shoulder, and use the difference between that and the current shoulder position to offset the spoon position. But people are combining animations with IK all the time. There has to be a simpler method that I’m just unaware of.
The problem come from your animation clip EatingLoop. You are using a generic clip to animate your humanoid avatar.
To understand why it doesn’t work you need to know what the animator evaluation pipeline look like.
Evaluate State Machine
Evaluate clips
Retarget humanoid clip
Write transform for first IK pass
for each layer with IK → Evaluate IK pass, Write transform
Write generic transform animation.
So basically you are overwriting your IK pass with your generic animation.
Simply keyframe the same clip ‘EatingLoop’ in blender and import as a humanoid. And replace your old clip in the controller with this new one.
Also you don’t need to have Base Layer, Animation Layer and IK layer. You could all do this in your base layer.
I originally did it all in the base layer, and only made them separate layers while casting around for possible solutions.
So no way to make a humanoid animation clip in Unity? I’d been doing all my animation in Unity so I could put off learning to animate in Blender, but if it’s necessary for advanced features I guess I’ll have to learn.
No unfortunatelly it’s not possible to keyframe a humanoid clip in unity right now. We would need to write a complete humanoid keyframing tools like you can found in blender, max or maya