I guess, no one is taking charges and I started the integration.
I added bunch of FinalIK components, AimIK, LookAtIK, GrounderIK, FBBIK and set the up correctly.
To control each of components, I created a new MyCharacterIK and I update FinalIK solvers from the LateUpdate().
Everything seems to work fine except one thing. The fire doesn't fire from nozzle, instead, it fires from the default position.
I think the problem is that UCC doesn't know that FinalIK has changed weapon location.
Looking at the original CharacterIK, it looks like all of the IK is handled in OnAnimatorIK().
Thus, I also try to move the updating FinalIK solvers from LateUpdate() to OnAnimatorIK(). But this time, FinalIK doesn't seem to have any effect.
I guess this is probably the last hurdle I need to figure out.
Can you please tell me what's going on here?
Here is a snippet of the code for the OnAnimatorIK(). If you change the function name to LateUpdate(0, FinalIK will work fine except the weapon firing location.
Thanks for your help.
Code:
private void OnAnimatorIK(int layerIndex)
{
// Find out how the left hand is positioned relative to the right hand rotation
Vector3 toLeftHandRelative = rightHand.bone.InverseTransformPoint(leftHand.bone.position);
// Rotation of the left hand relative to the rotation of the right hand
leftHandRotationRelative = Quaternion.Inverse(rightHand.bone.rotation) * leftHand.bone.rotation;
if (m_Aiming || m_ItemInUse)
{
// Switch aim poses (Legacy animation)
Pose();
// Match AimIK target with the LookAtIK target
m_AimIK.solver.IKPosition = m_LookAtIK.solver.IKPosition;
// Update Aim IK. This will change the position and the rotation of the right hand that holds the gun, so we will need pin the left hand back to the gun handle
m_AimIK.solver.Update();
}
m_DynamicBone.LateUpdate();
// Position the left hand on the gun
leftHand.position = rightHand.bone.TransformPoint(toLeftHandRelative);
//leftHand.positionWeight = 1f;
// Making sure the right hand won't budge during solving
rightHand.position = rightHand.bone.position;
//rightHand.positionWeight = 1f;
m_FBBIK.solver.GetLimbMapping(FullBodyBipedChain.RightArm).maintainRotationWeight = 1f;
// Update FBBIK
m_FBBIK.solver.Update();
// Rotate the head
m_LookAtIK.solver.Update();
}