Final IK

chrisk

Member
Hi, Justin,
I know Final IK is being looked at and I'm creating a thread for the progress and future discussions.

Cheers!
 

chrisk

Member
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
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:

chrisk

Member
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
I haven't reached out yet - I'm not able to work on integrations right now so I have been holding off.
 

chrisk

Member
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.
 

chrisk

Member
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
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.
 

chrisk

Member
Hi, Justin, I'm still trying to get the ScopeView to work and here is a link to the view to illustrate few problems.


I'm using FinalIK's solver and as you can see, there is a mismatch between the scope and the camera.

I created ScopeViewType and the only thing it does is to follow the Anchor(Scope) with given LookOffset. There is no spring action or lerp in Move().

I think the reason for the mismatch is that UCC update loop and FinalIK update are different. The problem is that I'm really sure how to fix it.

You can also verify it by looking at the bullet decal. It always trying to shoot at the certain angle regardless of aim angle. (Aim is adjusted by FinalIK's AimIK)

And here is one more thing.
As I move the character left to right and jump, the Weapon will stutter quite a lot. Even when I remove FinalIK solver, it still stutters. FPS is about 90fps and I don't think it's because of rendering lag.
Upperbody animation is just a fixed pose and I don't think it's caused by the animation. Perhaps, it doesn't update its location with interpolation?

You won't notice the stutter unless you bring the camera close to Character and I think no one noticed it until I try the ScopeView.

I'll really appreciate if you can help.

Cheers!
 

Justin

Administrator
Staff member
This is getting into the nitty-gritty of the integration so I won't know the answer until I really get into the FinalIK integration. I'll let you know when I do.
 

krazor

New member
i just tested Final IK, and it works flawlessly with UCC without adding any extra scripts or code. just add the 3 components to your character, Aim IK, LookAtIK, Full Body Biped IK & Limb IK for controlling the right hand, i followed along with the tutorial from Final IK, but the script i added was causing many glitching issues even after removing the IK from UCC, after disabling it and arranging the transforms for each category i ended up with a beautiful 3rd person IK setup

you will need to create your own script that hooks into UCC though that changes the values per item your holding for the IK values, this can be a pain but it is the cleanest IK setup i have so far. hope this helps

 

chrisk

Member
Yeah, I have it almost working too but I have a problem with AimIK where the weapon doesn't fire pointed by AimIK. Does yours fire at the aim?

And another issue is stuttering as seen in the Video. You won't see the stuttering unless you bring the camera close to your weapon, so please try it and let us know.

I hope those two problems will be fixed by the official integration.
 

krazor

New member
give me a little gota find out how to add decals to my hit marks, but i dont get any stuttering in mine, i didnt add any code to a script that modified the Ik components, that caused the stuttering for me.
 

krazor

New member
ok i see what you mean about the weapon not firing due to the Look Sensitivity and the weapon not actually facing the direction its meant to. i wonder if there is a way to force it to look quicker or check if its actually looking in that direction. this is the only issue im having so far, is there a known fix for it?


Fixed this issue by changing the Look Sensitivity to -1 on the weapon itself in Third Person Shootable Weapon Properties
 
Last edited:

DankP3

Member
Yeah, I have it almost working too but I have a problem with AimIK where the weapon doesn't fire pointed by AimIK. Does yours fire at the aim?

And another issue is stuttering as seen in the Video. You won't see the stuttering unless you bring the camera close to your weapon, so please try it and let us know.

I hope those two problems will be fixed by the official integration.
is the failure to fire the look sensitivity of the weapon? it would give a warning in the console and is the first issue i hit when setting up crude IK settings?
 

krazor

New member
is the failure to fire the look sensitivity of the weapon? it would give a warning in the console and is the first issue i hit when setting up crude IK settings?

changing the look sensitivity to -1 fixed the issue, no errors in console just wouldnt let me shoot past a certain angle. very small one as well. though i would like to know what causes this issue
 

DankP3

Member
if the look sensitivity then i suspect it is the angle of the weapon aligning along the expected angle. Changing this value has consequences though - if you set you weapon to autofire and autoreload it will fire during reload even when the gun is not pointing in the correct direction and during the reload animation.
 

krazor

New member
just set the fire to not work during the reload, can be set by time or im sure you can check based on if anim is still playing or state still active for reloading so far i havent had this issue, but i also dont have a reloading animation, i might make a quick test one where the gun is pulled off screen to test it though
 
Top