Search Unity

FINAL IK - Full Body IK, Aim, Look At, FABRIK, CCD IK... [1.0 RELEASED]

Discussion in 'Assets and Asset Store' started by Partel-Lang, Jan 15, 2014.

  1. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    205
    The "Optimize Game Features" offers the functionality to expose any transform from your model as well, but it what it doesn't keep is the transform hierarchy tree.

    Is the actual hierarchy mandatory for FinalIK or can it just work with the exposed bone transforms when not in a hierarchical fashion?

    P.S. Hope you enjoyed your holiday xD
     
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Yes, the hierarchy is also mandatory for the solvers. Even if it wasn't, you'd still have to expose almost every bone in the hierarchy for FBBIK to work, which kind of evaporates the usefulness of Optimize Game Objects in the first place.

    P.S The holiday was sweet, thank you, with a lot of magnificent mountains, beaches and ouzo :)
     
    dreasgrech likes this.
  3. frdfsnlght

    frdfsnlght

    Joined:
    Aug 2, 2012
    Posts:
    3
    Is it possible to get an evaluation version of Final IK? I've read almost all the posts and watched many of the videos, and it seems likely this asset may suit my project, but $90 is a bit more than I'm willing to spend to take that chance. Assuming it works for me, I have no problem shelling out the dough, but I can't know until I try it. Is there any possibility of getting an eval version?

    I thought I've seen some assets on the store that offer an eval. I have no problem if the eval version doesn't include source and prevents me from building my project. I just want to be able to integrate it and test it in the editor.

    If it matters, I'm most interested in the Grounder/CCD/AimIK portions. I'm particularly keen on the possibility of doing procedural walking and doing away with key-framed animations for a bunch of multi-legged robot-like things with guns.
     
    theANMATOR2b likes this.
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi!

    Sorry I don't have an evaluation version, but I don't mind refunding your purchase if it turns out to be something you can not use for whatever reason.

    Regards,
    Pärtel
     
    theANMATOR2b likes this.
  5. frdfsnlght

    frdfsnlght

    Joined:
    Aug 2, 2012
    Posts:
    3
    Well, that's good to know. It's a shame Unity doesn't offer some official support for eval versions of assets on the store.

    Perhaps I'll be making a purchase in the next few weeks when I get to that part of the project. Right now, I have some other intractable problems I'm trying to solve.

    Thanks.
     
  6. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220
    so far i'm impressed with the asset, and not many actually impress me at all, in fact i'm blown away at how effective this is to use, my first intensions was to use it with UFPS and remove their weapon system, but i couldn't get the arms to move as i feel they where animated with set weapons, Final IK has helped me resolve this issue with 1 weapon so far, i just want to ask a few questions, how do i set the Biped IK Left Hand Right Hand Targets Via Script. IK is all new to me. my intentions are to setup right hand and Left Hand Positioning per weapon and set the hand targets according to each weapon.

    i haven't found any documentation or Video Tutorials, they all seem to be Demonstrations of what it is supposed to do. but perhaps im just looking in the wrong direction, i have checked the PDF and youtube channel also but i cant seem to figure this part out. could you point me in the right direction please.
     
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, Aquilinajake, and thanks!

    Code (CSharp):
    1. bipedIK.solvers.leftHand.target = something;
    ...or you could use:

    Code (CSharp):
    1. bipedIK.solvers.leftHand.IKPosition = something;
    2. bipedIK.solvers.leftHand.IKPositionWeight = something;
    Please take a look at the User Manual page about BipedIK for more information.

    Since FinalIK 0.4 you can set FullBodyBipedIK solver iteration count to 0, which will disable the full body solving and make it work basically like BipedIK, with almost the same performance. But by using FBBIK instead you can very easily choose if you want full body behaviour or not. I made BipedIK before FullBodyBipedIK so I'm actually tempted to deprecate it at some point.
     
  8. RealSoftGames

    RealSoftGames

    Joined:
    Jun 8, 2014
    Posts:
    220

    if the performance is almost the same, but it is implemented differently, i would suggest leaving it for some people who may find one way easier to work with than the other =)

    just a quick question, i havent looked into Final IK much or any IK at all to be honest, but is their a Quick start guide, i opened the PDF and found a bunch of links, but i didnt know what each one does, perhaps this may be some where already, explaining what each component does and how to use it?
     
    Last edited: May 13, 2015
  9. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I want to create a sitting on car animation! Can you please give me an advise? I'm still new to this.
     
  10. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    153
    Hi Partel,

    I'm having some issues with the Full Body IK on a character.

    My character is the "Carl" model from Mixamo's character pack, without any changes to the rig or geo. I've added a custom animator and a set of stock unity animations (from the mecanim parkour tutorial) that are working. I've checked the IK pass box on the animator too. The model has 'Humanoid' Animation Type under rig and is not importing any animations.

    I'm also using your TouchWall script, to provide interaction with nearby walls.

    My issue is that if I apply Full Body IK with weight 1, the character's walk cycle becomes messed up. His legs behave like the ones on a ostrich, with the knees bending backwards and feet being projected forward at each step. However, if I lower the FBIK's weight to 0.2, the issue goes away but the remaining interactions become unnoticeable as well.

    I've tried "removing" all the weight on the leg effectors and just keep it on the torso/arms, but at no avail.

    What approach would you recommend on finetuning my model's FBIK? Is it a combination of weights and effectors directly on the FBIK component or should I look for something else (rig/animation settings perhaps)?

    Thank you in advance for reading and for the help!
     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Yes, you can right-click on the header of each Final IK component and select "User Manual" or "Script Reference".
    Or just go directly to the User Manual and click on the component that you are interested in.

    Hi!
    Please take a look at the "Driving Rig" demo scene.
    Basically just make a duplicate of the character and pose it to the seat.
    Then parent the important bones (ones that you will use as effector targets, such as hand and thigh and foot bones) to the seat and the wheel. Delete the rest of the duplicate character. Now attach the FullBodyBipedIK component on the real character, move it close to the seat (also parent it to the root of the seat) and assign the duplicate bones as effector targets.
    Also set the positionWeight value to 1 for those effectors.

    If your character has fingers, you can just attach the HandPoser script to the hand bones of the character and assign the duplicate hand bones as "Pose Root". Just like in the "Driving Rig" demo.

    Hi! Do you see any red/yellow dots on the knees of the character when you have the gameobject with FBBIK selected in the Editor? Click on them and see what the console says. Basically FBBIK samples the pose of the character in Start to know which way the limbs should be bent. Some characters (especially Mixamo's) have their legs/arms completely stretched out or even inverted. So just rotate the knees a bit in the editor so the little blue arrows on them face forward.

    Please take a look at this video (from 1:40) to see how it could be done.

    Cheers,
    Pärtel
     
  12. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    Thanks for help but I need to create something else. For example my character near to car door and press "G" then opening the door by his hand and then sit on the car seat! like GTA but have no idea if I can create something like this with Final Ik! can I?
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi!

    Final IK was not designed for animation authoring, but for adjusting the canned animation, making it fit the dynamic game environment. So it would be best if you created one "enter car" animation and used Final IK to make that animation conform to all your vehicle types.

    But that doesn't mean you can't do it with Final IK :)

    For example you can move the character close to the door, create target gameobjects for all the main effectors (hands, feet, body). Assign those gameobjects as effector targets in the FullBodyBipedIK inspector and set the position weights to 1.

    Parent those targets to one empty gameobject that is parented to the car. Add the Animator to that empty gameobject. While that is selected, go to the Animation window, create a new animation clip, save it somewhere and play the scene.

    Now you can start animating the target gameobjects in the timeline and since they are parented to the Animator, their postion and rotation will be keyframed. Once you are done, stop the play mode. You now have an Animator that controls effector animation.

    Now if the character wants to enter the vehicle, just move it to the door, blend in the effector position weights and play the effector animation with Mecanim.

    Cheers,
    Pärtel
     
  14. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    or use a Tweener (or bezier) curve etc ...;)
     
  15. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Hi Partel,

    Just wondering how to properly "reset" the interaction system when an interaction object becomes null mid-interaction. At the moment, I've tried calling ResumeAll, StopAll, both of those at the same time, but it seems like the interaction is still "stuck" at whatever time the object became null at.

    I'm on .4 also, would like to try and stick to .4 for the time being, but if it's a complex fix that's available in .5, I'll probably have to update anyway.
     
  16. RFLG

    RFLG

    Joined:
    Feb 7, 2011
    Posts:
    153
    Hi Partel, your solution worked like a charm! Issue solved! I'm currently tweaking the interactions ;)

    Concerning those, they work fine if the character is walking, but when it runs, things get a bit more complicated. Since the character only runs, its making the interaction trickier to apply.

    -First, I'm guessing that for the run speed, provably I need the interaction to happen faster, right? Could I achieve that just by changing the lerp speed on the TouchWalls script, or could it be better to change the speed on the interaction itself (interaction obj + interaction system)? What would you recommend?

    -Secondly, I wanted to create an "impact" interaction. On my game the character is running and may hit walls at full speed. Could the "hand on wall" interaction be modified to suit this as well? Having him stretch one or both arms forward to cushion the impact would do the trick. Currently the "hand on wall" uses sphere colliders to check for the lateral hits, how could I make it check for frontal hits as well?

    Thank you for the help!
     
    Last edited: May 18, 2015
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi!

    Please grab this patch, it should take care of this problem. If the InteractionObject is lost, it will just smoothly reset to defaults now. :)

    You too, please grab the same patch.
    There was a bug in the InteractionSystem, that didn't like faster speeds. I also changed the TouchWalls script to account for the InteractionSystem's speed.

    You can now just adjust the speed value of the InteractionSystem component to make everything uniformly faster/slower :)

    Cheers,
    Pärtel
     
  18. TH-Interactive

    TH-Interactive

    Joined:
    May 26, 2013
    Posts:
    34
    Hi Partel,
    Firstly, thanks for your excellent product, it is making our game look so much more professional.

    We are making an FPS which uses mocaped animations.
    I have scoured the thread and may have missed it but couldn't find help for this particular problem - I'm sorry if you have already helped someone else with this before!

    We really like the effector offset demo - it means we can have our run around and aim animations authored once and can blend in a crouch into the model so the character will crouch smoothly and still run around using the standard animations we have (therefore not needing two sets of animations for crouched/standing, etc).

    We are using an EffectorOffset to achieve this, just as you have in the demo.

    The problem is when combining it with FBBIK - we have a target set in FBBIK for the left hand to support the gun that is being held with the right hand.
    When we blend in the crouch using an EffectorOffset it is applying the EffectorOffset after the FBBIK solve and so the hand is up in the air while the rest of the body is crouching. I've attached screenshots illustrating this.

    I have tried almost any code that sounds like it might work to solve the left arm again after the EffectorOffset has updated but nothing seems to work.

    Can you point me towards a solution that will update the left hand to properly ik to the target after the EffectorOffset has updated?

    Thanks so much!
    -Alister

    Stand.jpg Crouch.jpg Settings.jpg
     
  19. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, Alister!

    EffectorOffset is not an IK solver on it's own, it just applies position offset to the FBBIK effectors. Those effectors can be used in two ways, one is using positionOffset and the other is using position and positionWeight. The latter will overwrite the former if positionWeight > 0.

    positionOffset allows for multiple simultaneous modifiers (such as EffectorOffset, Inertia, Amplifier, Recoil) to make modifications on the pose each frame. Position and positionWeight are more for interactions and pulling the character and stuff like that.

    Now the problem that you are facing is that you apply EffectorOffset to the character, then pin his left hand to the weapon's animated position (that is without offset). So the hand stays at the animated position of the gun, while the rest of the body moves down.

    If I'm not mistaking you should be able to fix it by just adding the offset of the right hand (from EffectorOffset) to the left hand effector's target position.

    Code (CSharp):
    1. ik.solver.leftHandEffector.position = leftHandTarget + effectorOffset.rightHandOffset;
    You should also make sure the right hand doesn't rotate in the solving process, or the weapon will rotate with it, making the left hand miss it. You can do it by setting "Maintain Hand Rot" to 1 in the FBBIK inspector.

    Cheers,
    Pärtel
     
  20. TH-Interactive

    TH-Interactive

    Joined:
    May 26, 2013
    Posts:
    34
    Hi Partel,
    Thanks so much for getting back to me so quickly!
    Unfortunately the gun does rotate and so the hand does not follow the target I have created totally - and since we are using an animation to aim, changing maintain hands rotation bends the player down towards the floor - so that won't work either.

    Is there no way to "re-solve" the left arm chain in a FBBIK manually after the EffectorOffset has modified all other targets? Like hooking something up to the solver's OnPostUpdate callback and resolve the arm somehow there?
    So the flow would be FBBIK base solve -> EffectorOffset modify to crouch position -> resolve left hand to match target
     
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi again,

    Here, try this script:
    Code (CSharp):
    1. public FullBodyBipedIK ik;
    2.  
    3.     private Quaternion rightHandRotation = Quaternion.identity;
    4.     private Quaternion leftHandRotation = Quaternion.identity;
    5.  
    6.     void Start() {
    7.         // Register to get some calls from FBBIK
    8.         ik.solver.OnPreRead += BeforeFBBIK;
    9.         ik.solver.OnPostUpdate += AfterFBBIK;
    10.     }
    11.  
    12.     // Called by FBBIK before it reads the current pose of the character
    13.     void BeforeFBBIK() {
    14.         // Remember the rotations of the bones
    15.         rightHandRotation = ik.references.rightHand.rotation;
    16.         leftHandRotation = ik.references.leftHand.rotation;
    17.  
    18.         // Find the position of the left hand relative to the right hand
    19.         Vector3 leftHandRelativePosition = ik.references.rightHand.InverseTransformPoint(ik.references.leftHand.position);
    20.  
    21.         // Right hand offset position
    22.         Vector3 rightHandPosition = ik.references.rightHand.position + ik.solver.rightHandEffector.positionOffset;
    23.  
    24.         // Move the left hand with the right hand
    25.         Vector3 leftHandTargetPosition = rightHandPosition + rightHandRotation * leftHandRelativePosition + ik.solver.leftHandEffector.positionOffset;
    26.  
    27.         ik.solver.leftHandEffector.positionOffset = leftHandTargetPosition - ik.references.leftHand.position;
    28.     }
    29.  
    30.     // Called by FBBIK after it has finished updating
    31.     void AfterFBBIK() {
    32.         ik.references.rightHand.rotation = rightHandRotation;
    33.         ik.references.leftHand.rotation = leftHandRotation;
    34.     }
    35.  
    36.     // Cleaning up the delegates
    37.     void OnDestroy() {
    38.         if (ik != null) {
    39.             ik.solver.OnPreRead -= BeforeFBBIK;
    40.             ik.solver.OnPostUpdate -= AfterFBBIK;
    41.         }
    42.     }
    Just add it to the character, assign the "IK" variable.
    It will lock the position and rotation of the left hand relative to the right hand when using EffectorOffset. So if you change "Right Hand Offset", the left hand will move along with it.

    Using multiple solvers/solving more than once per frame is always an option, but most things in this universe can be calculated for a single solver pass, so no need to waste the performance unless absolutely necessary.

    Let me know if this doesn't work.

    Cheers,
    Pärtel
     
  22. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    864
    Thanks heaps!
     
  23. ilesonen

    ilesonen

    Joined:
    Sep 11, 2012
    Posts:
    49
    Hey Pärtel,
    Could you help me out a little? I'm trying to figure out how to go smoothly from one Weight to another?
    I need to change HandEffector position and rotation weight to another over time.
    Thanks!
     
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, no problem..

    Code (CSharp):
    1. ik.solver.leftHandEffector.rotationWeight = Mathf.MoveTowards(ik.solver.leftHandEffector.rotationWeight, anotherWeight, Time.deltaTime * speed);
    2.  
     
  25. ilesonen

    ilesonen

    Joined:
    Sep 11, 2012
    Posts:
    49
    Working perfectly!
    Thanks man!
     
  26. Minsc

    Minsc

    Joined:
    Dec 30, 2013
    Posts:
    39
    Hello Pärtel,

    I find your package really cool, it have enormous potential for doing animations in a more procedural way rather than mocap or keyframing. Can you please show how you did the procedural animation for the mechanical steampunk spider? Did you use CCD IK directly and it did provide procedural animation or did you have to do out of the package scripting for the raycasting? Something I suppose like minimizing the relative coordinates of the tips of the legs compared to the root of the body?

    Thanks,

    Minsc
     
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, Minsc, and thanks!

    Basically controlling the spider is just moving the body around with the arrow keys. Each leg has a script on it that checks for the distance between the current position of the foot and it's ideal rest position relative to the body. If the becomes too great, it will simply raycast down towards the rest position to find another footstep. The IK target of that leg will then be interpolated to that new position.

    CCD just handles the IK, making sure the feet end up where they are told to end up by the script that controls the leg.

    Cheers,
    Pärtel
     
  28. Minsc

    Minsc

    Joined:
    Dec 30, 2013
    Posts:
    39
    Hi Partel,

    You're welcome and thanks for your help :)

    Best,

    Minsc
     
  29. Pedro-Alaiagames

    Pedro-Alaiagames

    Joined:
    Apr 15, 2014
    Posts:
    28
    Hello!

    Im working with finalIK and it´s a faboulous plug in.

    Ive got a problem with the hand poser script. When a interacction is finished the value of the poser wieght in the hand poser script is the last value in the curve used to sample the poser weight.

    Is there a way to get back to zero this value using a curve for not to change the hand pose to its original position in just one frame?...

    Sorry about my english and thankyou for your help.

    Pedro.
     
  30. Pedro-Alaiagames

    Pedro-Alaiagames

    Joined:
    Apr 15, 2014
    Posts:
    28
    SOLVED.
    Ive just created a curve and use a coroutine to acces to the values along the time.

    Code (CSharp):
    1. public class Class1
    2. {
    3.     float timer;
    4.     public AnimationCurve curveReleaseObject; //Curve to define the values to he HandPoser.Weight
    5.  
    6.     void CallFunction()
    7.     {
    8.         timer = 0.0f;
    9.         StartCoroutine("ResetPoserValues");
    10.     }
    11.  
    12.     IEnumerator ResetPoserValues()
    13.     {
    14.         while (timer <= 1) //Time for one second to get back to the original position
    15.         {
    16.             HandPoser.weight = curveReleaseObject.Evaluate(timer);
    17.             timer += Time.deltaTime;
    18.             yield return null;
    19.         }
    20.     }
    21.  
    22.  
    23. }
     
  31. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, Pedro, nice to meet you!

    I'm sure I understood, cant you just use the "Poser Weight" curve like this to fade back to 0 for the end of the interaction?

    PoserWeight.jpg
     
  32. Pedro-Alaiagames

    Pedro-Alaiagames

    Joined:
    Apr 15, 2014
    Posts:
    28
    Hi!

    Thanx for answer so fast!

    I use the interaction to take an object in the player hand.. so if I fade to 0 for the end of interaction the hand doesnt take the object properly... once the player release the object I fade to 0 using my curve with that script.

    I dont know if this is the better solution for this situation..

    Thanx for your help.
     
  33. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    The way I'd do it, make the interaction so that it fades all the weights to 1 and back to 0.
    Then create an event at mid point where all the weights are 1 and enable the "Pause" (and "Pick Up") checkbox for that event.

    So when the object is picked up, all weights are 1 and the interaction will be paused. To drop the object, just call interactionSystem.ResumeAll() and everything will fade back to 0. You'll have to unparent the object yourself though, you can add an event to the InteractionObject for that, that will call a message on your script.
     
    Pedro-Alaiagames likes this.
  34. Hedonsoft

    Hedonsoft

    Joined:
    Jul 11, 2012
    Posts:
    168
    Hi Partel! I'm working on a new tutorial for FinalIK's easy integration into UMA2. I've gotten FullBodyBiped finished but am having a problem with the way I'm handling AimIK.



    Code (CSharp):
    1.  //Setup AIMIK
    2.         Transform targ = GameObject.Find("Target").transform;
    3.         AimIK aim = umaData.gameObject.AddComponent<AimIK>();
    4.        
    5.         Transform[] spineBones = new Transform[3];
    6.         spineBones[0] = GameObject.Find("LowerBack").transform;
    7.         spineBones[1] = GameObject.Find("Spine").transform;
    8.         spineBones[2] = GameObject.Find("Spine1").transform;
    9.  
    10.         aim.solver.SetChain(spineBones, transform);
    11.         aim.solver.SetIKPositionWeight(1);
    12.         aim.solver.transform = targ;
    As you can see in the photo her torso is all twisted
     
  35. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi again, Hedonsoft, thanks for working on that tutorial! :)

    It's a common mistake with AimIK, the "Aim Transform" should not be the target, it should be the object that you need to aim at the target or the hand bone that is holding it.

    Cheers,
    Pärtel
     
  36. Hedonsoft

    Hedonsoft

    Joined:
    Jul 11, 2012
    Posts:
    168
    Thanks Partel! Using your great demos it's coming along well. Added FBBIK,AimIK, 3rdPersonController. The only problem I have now is that the cam always starts at the player's feet. Although I'm using the 3rdPersonController cam and controller the game always starts with the FPSCam at the player's feet. pressing 'C' switches to a third person view.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using UMA;
    4. using RootMotion;
    5. using RootMotion.FinalIK;
    6. using RootMotion.FinalIK.Demos;
    7.  
    8. public class FinalIKSlotScript : MonoBehaviour
    9. {
    10.  
    11.     BipedReferences references;
    12.     FullBodyBipedIK ik;
    13.    
    14.     public void OnCharacterCreated(UMAData umaData)
    15.     {
    16.         //Get References
    17.         GameObject root = GameObject.Find("Root");
    18.         Transform head = GameObject.Find("Head").transform;
    19.         Transform rightHand = GameObject.Find("RightHand").transform;
    20.         Transform leftHand = GameObject.Find("LeftHand").transform;
    21.         Transform neck = GameObject.Find("Neck").transform;
    22.         Transform targ = GameObject.Find("AimTarget").transform;
    23.         Transform camTarg = GameObject.Find("CameraTarget").transform;
    24.         targ.transform.parent = rightHand;
    25.  
    26.         // Setup FullBody Biped First
    27.         BipedReferences.AutoDetectReferences(ref references, root.transform, BipedReferences.AutoDetectParams.Default);
    28.         ik = umaData.gameObject.AddComponent<FullBodyBipedIK>();
    29.         ik.SetReferences(references, null);
    30.         ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA);
    31.  
    32.         //Setup AIMIK
    33.         AimIK aim = umaData.gameObject.AddComponent<AimIK>();
    34.         Transform[] spineBones = new Transform[3];
    35.         spineBones[0] = GameObject.Find("LowerBack").transform;
    36.         spineBones[1] = GameObject.Find("Spine").transform;
    37.         spineBones[2] = GameObject.Find("Spine1").transform;
    38.         aim.solver.axis = new Vector3(0, 1, 0);
    39.         aim.solver.SetChain(spineBones, rightHand);
    40.         aim.solver.SetIKPositionWeight(1);
    41.         aim.solver.transform = rightHand;
    42.      
    43.         aim.enabled = false;
    44.  
    45.         //FPS Cam
    46.         Camera fpscam = GameObject.Find("FirstPersonCamera").GetComponent<Camera>();
    47.         fpscam.nearClipPlane = 0.01f;
    48.         fpscam.depth=-1;
    49.         fpscam.transform.parent = head.transform;
    50.  
    51.         //AnimationController3rdPerson
    52.         RootMotion.FinalIK.Demos.CameraController mainCamera = GameObject.Find("Main Camera").AddComponent<RootMotion.FinalIK.Demos.CameraController>();
    53.  
    54.         mainCamera.target = camTarg ;
    55.         AnimatorController3rdPersonIK ac = umaData.gameObject.AddComponent<AnimatorController3rdPersonIK>();
    56.         ac.rightHandTarget = rightHand;
    57.         ac.leftHandTarget = leftHand;
    58.         ac.head = head;
    59.         ac.firstPersonCam = fpscam;
    60.         ac.useIK = false;
    61.        
    62.         //CharacterController3rdPerson
    63.         CharacterController3rdPerson cctp = umaData.gameObject.AddComponent<CharacterController3rdPerson>();
    64.         cctp.cam = mainCamera.GetComponent < RootMotion.FinalIK.Demos.CameraController>();
    65.        }
    66. }
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554

    Hi!

    I see the local position Y of the cam is -0.78, which indicates that the cam is positioned somewhere at the root of the character when you parent it to the head.
    So just make sure that after you parent the fps cam to the head, set it's local position to zero (or some other value that positions it to the eyes rather than the root of the neck).

    Cheers,
    Pärtel
     
  38. Mernion

    Mernion

    Joined:
    Jul 6, 2014
    Posts:
    13
    So, after several tries, I'm a little confused how to handle final IK (full body biped IK) and gun position in the hands of the character.
    I tried to follow video , but it looks like that interface changed, and Im not sure what the best way to handle weapon relative to character. Currently I want to place gun (which is two handed rifle) as a children of character. I tried placing it as right hand children, but for some reason I was not be able to edit hand position with the help of this small blue square. Am I doing something wrong? All I want is to adjust hands position relative to gun..would be perfect if I was able to adjust shoulder too, but its not important currently.
     
  39. Astronauts

    Astronauts

    Joined:
    Apr 7, 2015
    Posts:
    2
    Hi!

    The character can not climb stairs, If the capsule collider has not a large radius . How to solve this problem?

    You can check this, open the demo scene in Final IK - “Grounder”. Initially, the capsule collider has a radius = 0.5 and character without problems climbing stairs. Since the size of the capsule collider is much larger than the size of the character, I reduced the radius from 0.5 to 0.2. Now, the character cannot climb stairs.

    pic.png
     
  40. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ Partel,

    Does this product produce the components to add to gameObjects with the script already in place etc? Is there an editor (as seems to be the case) with special UI?
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, Mernion,

    Did I understand you correctly, you need to parent the gun to the character and then use Final IK to put the hands on the gun? If that's the case, please follow these instructions:

    1. Parent the gun to the root of the character, put it in front of the character or wherever where you need it.
    2. Make a duplicate of your characters, pose the duplicate's hand bones (and fingers) to hold the gun.
    3. Parent the duplicate hand bones (IK targets) to the gun, delete the rest of the duplicate character.
    4. Assign the IK targets as hand effector targets in the FBBIK inspector

    Screen Shot 2015-06-01 at 08.51.28.png

    5. Set "Position Weight" and "Rotation Weight" to 1
    6. Add the "Hand Poser" component to both hands (real hands, not the targets), assign the respective IK targets as "Pose Root". That will just rotate the fingers to match the posed target

    If you are not happy with the way the elbows are bent, maybe they go through the body or something, just add a "Bend Goal" and set "Bend Goal Weight" to 1 or something between 0 and 1.

    Screen Shot 2015-06-01 at 08.54.58.png
    Hi, Astronauts!

    Its a classic problem with capsule based character controllers. But your post got me thinking, what if you make the character's collider narrow (0.2) and then add a child game object to that and make it wide (0.7).

    1. Put that child on another layer ("Ground Collider").
    2. Make sure all your walkable surfaces (including the stairs) are on the "Ground" layer and the walls are on something else ("Default").
    3. In the Physics Settings, set the "Ground Collider" layer to only collide with the "Ground" layer.
    4. Make sure the "Ground" layer is included in the Grounder's layers and CharacterThirdPerson.cs Ground Layers.
    5. Download this script, its an updated CharacterBase.cs that works with multiple colliders, so the character won't slide down the stairs.

    So like that you have a dedicated wide collider for ground surfaces only and the character is still able to get close to the walls.

    Instead of the "Ground" layer that includes all walkable surfaces, you could also use a "High Obstacle" layer instead, that only includes stairs and stuff that the narrow collider can't traverse. Whatever suits you best.

    I didn't think compound colliders could be used like that, on multiple layers, but I tried and it works :)

    Hi, Duffer!

    Yes, for example the FullBodyBipedIK you can just drop on the character and you are ready to go (unless it didn't auto-recognize the bone references properly, but that is easy to fix manually). Each component has a custom inspector that makes it easier to set everything up. Check out my video channel and the User Manual for more detail.

    Cheers,
    Pärtel
     
  42. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi all!

    There will be a little Final IK kiosk at Unite Europe on the 25th of June, so I'll be sitting there the whole day and hopefully meet some of you, so come on over and say hi. :) I'll definitely prepare some demos about the stuff I've been working on lately.. ;)

    Cheers,
    Pärtel
     
  43. Pedro-Alaiagames

    Pedro-Alaiagames

    Joined:
    Apr 15, 2014
    Posts:
    28
    SOLVED...
    Thank you very much!

    Pedro.
     
  44. Hedonsoft

    Hedonsoft

    Joined:
    Jul 11, 2012
    Posts:
    168
    Hey Partel!

    My UMA2 demo is coming along good, got aim and interactions added. When it's done I'd like to have you take a look at it before I put it on the UMA wiki.

    One of the last things I need to address is after picking up a weapon using

    Code (CSharp):
    1.  
    2. if (Input.GetKey(KeyCode.E))
    3.             {
    4.                 ik.enabled = true;
    5.                 interactionSystem.TriggerInteraction(closestTriggerIndex, false);
    6.             }
    7.  
    I want to then use this weapon for AimIK. How do I get the name of the object that was picked up?
     
  45. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Hi Partel, I'd like to use Final IK for hand interactions in my game, it's first person & I just use arm models, no body or legs. Can you suggest a workflow/solution please?

    Thanks
     
  46. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi!

    you can get a call from the Interaction System each time it picks something up like this:

    Code (CSharp):
    1. public InteractionSystem interactionSystem;
    2.  
    3.     void Start() {
    4.         interactionSystem.OnInteractionPickUp += OnInteractionPickUp;
    5.     }
    6.  
    7.     void OnInteractionPickUp(FullBodyBipedEffector effectorType, InteractionObject interactionObject) {
    8.         Debug.Log(interactionObject.name);
    9.     }
    But if you are switching weapons, it might be best to use the hand bone instead of the weapon as the "Aim Transform".

    Hi, Derkoi,

    For the hand positions, you can use LimbIK. You can animate it's target in play mode using the Animation Window.
    I am not a big fan of using IK to solve the fingers though. You'd need 10 solvers and it really is a waste of performance no matter how fast the solvers are. Besides, I dont think it is easier to animate finger IK targets than just animating the finger bones. I have usually just animated the fingers in Unity using the Animation Window.

    Best Regards,
    Pärtel
     
  47. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,260
    Thanks for the reply. I was hoping to use something like the box holding video you made. Where I can pose the hand in that way, would that work or would I be better making a complete character and animate the arms that way?
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    You don't need to have a complete character to animate the hands. Even if you had a complete character with animation on it, you can just add an Animator to the hands and it will play on top of the normal animations.
    In the box holding video, the fingers are static, I make a duplicate of the character, posed it's hand bones to the box and used them as IK targets. Then there is a script called HandPoser.cs that just rotates the finger bones to match the target hand's pose.
     
  49. Hedonsoft

    Hedonsoft

    Joined:
    Jul 11, 2012
    Posts:
    168
    I have my hand set as my Aim transform but something is wrong. The aim is pointing up even though the target is set to the hand.
     
  50. Hedonsoft

    Hedonsoft

    Joined:
    Jul 11, 2012
    Posts:
    168
    Fixed it. For some reason I had to set the transform axis to -1,0,0. Maybe it's a UMA thing. Does this make sense?