Final IK

#2
Hi, Justin, I know you mentioned that Partel was working on the integration but when I asked him he said it's better you work on it since the integration requires some core code changes. That's what I thought too originally and I hope it's final.

This is what Partel Said,


"Opsive has started developing their own integration for FIK. The integration would require changes to their code base, so its better if it comes from them."

Could you please let us know the progress and I would really appreciate for your support.

Cheers!
 

Justin

Administrator
Staff member
#3
Hmm, there shouldn't be any code changes necessary to the base asset (that's actually why there is a base class for the ik component - to prevent any code changes from being necessary). I'm not able to add the FinalIK integration right now but when I can look at it again I'll send Partel another message to see if we can work together on an integration.
 
Last edited:
#4
Hmm.. I've waited a couple of weeks thinking that Partel is working on it. It's a bummer. Anyway, sure I appreciate if you can talk to Partel and figure out who will do the integration, otherwise I'll have to ask both of you all the time about the update. ^^
The integration is necessary for me to implement the weapon handling(easier setup and better performance) and others. Current IK solution is a bit limited, e.g., FullBodyIK.
Cheers!
 

Justin

Administrator
Staff member
#6
I haven't reached out yet - I'm not able to work on integrations right now so I have been holding off.
 
#7
Sure. Does that mean you will do the integration? If I know, I won't bother Partel any more, at least. ^^

I'm not in a super hurry but it's going to be important for my project for various weapon handlings and others.

Thanks.
 
#8
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();
        }
 

Justin

Administrator
Staff member
#9
OnAnimatorIK is called by Unity's Animator component so it's not in the regular FixedUpdate/Update loop. For the FinalIK integration I would not have OnAnimatorIK at all and instead modify it within Update/LateUpdate to go along with how FinalIK works. The weapons are actually fired within FixedUpdate.
 
Top