Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Timing question,

    I create two characters. Each character ia MonoBevaviour and contains a class I created called MovementManager that inot a MonoBehaviour that contains wrapper classes for FBBIK effectors.
    In LateUpdate() of the character I call MovementManager.Update().

    MovementManager.Update() loops through the wrapper classes, sets positions and weights for the underlying effectors and exits.

    In the Start() of my GameController scene I set target values in the wrapper classes to pose both characters in different stances.

    The strange behaviour is that in frame 1, character 2 assumes its correct pose. In frame 2 character 1 assumes its correct pose.

    The LateUpate() code is confirmed to be called in frame 1 for character 1 but the character does not assume pose until code is called again in frame 2.

    It is worth noting that Character 2's LateUpdate() code is called first.

    This can cause problems if i'm setting a flag at the end of the pose code like:
    If movement flag is true
    then set effector position and weight
    and then set movement flag to false.

    In this case Character 1 does not ever assume the pose since frame one sets the flag to false but the effectors don't actually move in the scene in frame 1.

    Is there anything on the timing of Unity3d and FinalIK that I'm missing that would cause this issue?

    Logging:
    Player2 @ frame # 1:Entering Update
    Player2 @ frame # 1:Current effector position:(-0.4, 1.0, 0.2) Effector target position:(-0.1, 0.3,
    Player2 @ frame # 1:Current effector position weight:0 Effector target position:1
    Player2 @ frame # 1:Leaving Update
    Player2 @ frame # 1:Current effector position:(-0.1, 0.3, -0.2) Effector target position:(-0.1, 0.3, -0.2)
    Player2 @ frame # 1:Current effector position weight:1 Effector target position:1
    Player1 @ frame # 1:Entering Update
    Player1 @ frame # 1:Current effector position:(0.4, 1.0, -0.2) Effector target position:(0.2, 0.4, -1.0)
    Player1 @ frame # 1:Current effector position weight:0 Effector target position:1
    Player1 @ frame # 1:Leaving Update
    Player1 @ frame # 1:Current effector position:(0.2, 0.4, -1.0) Effector target position:(0.2, 0.4, -1.0)
    Player1 @ frame # 1:Current effector position weight:1 Effector target position:1
     
    Last edited: Aug 17, 2014
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    I think the easiest thing by far would be to use a swinging animation on an upper body-masked layer on top of the locomotion. If you time the swing well enough so that the debris.y is at the right position, you won't even have to use any IK on it.

    Those swinging types of animations are quite hard to make procedurally with IK, because of the nature of the motion and the 2-handedness. With IK its easier to make linear animations from A to B.

    Pärtel
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Hi,
    The IK part of it is quite small, its mostly how you get the ragdolls to follow the animation. For that you could probably use the AnimFollow plugin from the store, or another solution that will look funny as hell, make a ghost ragdoll of your character, add spring joints to all the ragdoll bones that connect to their respective animated bones so your character will feel like a puppet pinned to its animation with a bunch of rubber bands. It needs a hell of a lot of tweaking and knowledge of the PhysX and dynamically changing the spring values, but it can be done. :)
     
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Hi, Lushdog,

    Its difficult to tell without seeing the project, but the only thing causing a 1 frame lag could be that your script is executing after the FBBIK. Go see the Script Execution Order and make sure your scripts are not at a higher value than FBBIK.
    You could also try disabling the FBBIK at Start and manually controlling when it updates like so:

    Code (CSharp):
    1. void Start() {
    2. ik.Disable();
    3. }
    4.  
    5. void LateUpdate() {
    6. MakeAllYourIKCalculations();
    7.  
    8. ik.solver.Update();
    9. }
    Everything FBBIK will ever do in that frame will be inside that ik.solver.Update();

    Pärtel
     
  5. ostrich160

    ostrich160

    Joined:
    Feb 28, 2012
    Posts:
    679
    Thanks for your help :)
    Is there no way to use this asset to help with creating this then?
     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    You'll need it down the line to make the punches meet the target and foot placement that needs to be accurate because the ragdoll feet can't go through the terrain and stuff like that, but you better get the physics done first, thats the tricky part.
     
  7. ostrich160

    ostrich160

    Joined:
    Feb 28, 2012
    Posts:
    679
    Ah, cheers mate, I'll get a basic model first and then use this kit to make it work better than, you have plenty of tutorials on your channel so I'll just use them when I get to that part. Thanks again
     
  8. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Hey Partel that worked great thanks.

    I did some more logging and for some reason at the end of frame 1 it told me that position weight was set to 1 but at the beginning of frame 2 it was set to 0. The update code was right right at the end of all other logic so i'm certain no other code was setting it to 0. Even stranger was that in Frame 3 it was set back to 1 and stayed at 1 for Frame 4 and onwards. Very very strange but it is working now with manual call to ik.solver.Update().

    Any adverse effects or anything i should know about of manually calling ik.solver.Update()?
     
  9. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Any built-in way to find parent effector? I found IKEffector.isEndEffector but I haven't found anything built-in to find parent effector of effector.
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    The only thing is that if your character has AnimatePhysics update mode, you'll have to check if a FixedUpdate has been called since the last time you solved IK. the IK components do that automatically, but if you disable them, you'll have to do it yourself if you wish to use AnimatePhysics.

    Hi,

    No, because internally they are not listed in a hierarchy, but a flat list. In which scenario would you need something like that?
     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    WendelinReich and GoGoGadget like this.
  12. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Well if I want to do an interaction using left hand but it's too far i need to change the left shoulder position weight to less than zero to get the shoulder into it right?
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Nono, just for reaching you don't need the shoulder effectors at all. Just set the hand effector position to the target, then you can use the "Pull" and "Reach" and "Pull Body Horizontal/Vertical" values to tune it right. If you set left arm Pull to 1 and all the other limb pulls to 0, then you can drag that character from the left hand as far as you need without ever loosing contact.
    With the Reach value you can bring the shoulder closer to the hand if you wish.
     
  14. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    218
    Can I use FINAL IK for ragdoll solution?
     
  15. Partel-Lang

    Partel-Lang

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

    What exactly do you mean by ragdoll solution?
     
    lushdog likes this.
  16. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Excellent! Thanks Partel.

    Matt
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Hi all,

    I was not quite happy with the Hit Reaction demo and some people have been confused tying to make it actually work with colliders and raycasting and stuff, so I decided to revisit that and made a redesign of it. That package replaces the Hit Reaction demo scene and the script (so don't forget to back up!).

    Cheers, :)
    Pärtel
     
  18. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Are Pull/Reach values in effect during Interactions? I ask as my character still won't lean into the reach.

    I think the issue is that i'm using all effectors at position weight 1 to pose the character into their initial position. Since all effectors are at weight 1 i can't have the should move to make the reach go further unless i lessen the weight of the shoulder to less than 1.

    Is my posing logic the wrong way to go?

    Matt
     
  19. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Yes, they are in effect at all times when the end-effectors of the limbs are weighed in. With the Interaction System, you can also animate those values, if you use the Reach/Pull weight curve types on the Interaction Objects.
     
  20. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Ok so it looks like I either :
    1. have to rethink my Posing logic to not use 1.0 position weights or
    2. continue posing with 1.0 weights and reduce the weight of parent effectors to make extending on reach possible
    Partel do you agree or am I totally headed in the wrong direction?
     
    Last edited: Aug 26, 2014
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    The way you'd normally reach to things is:

    1. set effector.position to the target
    2. lerp/smoothdamp effector.positionWeight to 1

    So usually you dont need to weigh in the parent effectors at all. Actually I don't think I have done it in any of my 25 FBBIK demos, maybe just one.
     
  22. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Hmmm, I guess the problem is that after frame 1 posing, all the effectors are at positionWeight=1 so if I need my character to reach farther than the length of arm, i need to relax the shoulder effector thus making it's positionWeight < 1.

    Perhaps I should rethink my posing logic. Am I doing something radically different than you are doing in your demos?

    Or, I'm using FinalIK to pose when I should be using some other method?
     
    Last edited: Aug 27, 2014
  23. jrf2574

    jrf2574

    Joined:
    Jan 18, 2013
    Posts:
    2
    Partel, do I still need to expose all of the bones in order to use finalIK if I check optimize game objects? I noticed a post from January that said I did but I wasn't sure if that had changed. Thanks, and awesome work!
     
  24. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    882
    someone have already try do climb system i'am not sure how do it for now thank's
     
  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Oh I see, you need to use all the effectors for getting to a specific pose? In that case, use effector.positionWeight only for the hands that need to reach targets, use effector.positionOffset instead of positionWeight for all the other effectors.
    You see positionWeight overrides positionOffset so those effectors can still be pulled out of place :)

    Yes, I'm afraid there's nothing that can be done about it, we need to access the bones somehow to change their rotations..

    That is quite a complex problem to solve. One way to do it would be fully procedurally, like you only move the root of the character and all the hands/legs independently raycast to find the closest stone to reach with IK.
    Another way would be to use animation clips climbing in each general direction, then use IK on top of it to correct the positions of the hands and feet to match the scene better. Thats how Assassins Creed does it if you can wrap it in a single sentence.

    Cheers,
    Pärtel
     
  26. notromus

    notromus

    Joined:
    Sep 1, 2014
    Posts:
    2
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Hi, Notromus,

    Thats a problem with using effector rotation. It can only guess what the best direction for the elbow would be and sometimes with certain target rotations it might not be what you need. You can try not using effector rotation at all and just rotating the hand when FBBIK is finished:

    Code (CSharp):
    1. public FullBodyBipedIK ik;
    2.  
    3. void Start() {
    4.   ik.solver.OnPostUpdate += AfterFBBIK;
    5. }
    6.  
    7. // Called by FBBIK each time it is finished solving
    8. void AfterFBBIK() {
    9. ik.solver.leftHandEffector.bone.rotation = targetRotation;
    10. }
    So you add a method to the FBBIK solver OnPostUpdate delegate to get a call from it each time it is finished solving and then just rotate the hand bone. Make sure effector rotationWeight is 0.

    Or if you don't like that and need full control over how the elbow bends, you can use the FBIKBendGoal script (as I see you are using old Final IK) or update your Final IK from the Store and use the bend goal targets built in to the solver.

    Cheers,
    Pärtel
     
  28. notromus

    notromus

    Joined:
    Sep 1, 2014
    Posts:
    2
  29. WendelinReich

    WendelinReich

    Joined:
    Dec 22, 2011
    Posts:
    224
    Hi Pärtel, I've been trying to play around with the new pole target in AimIK, but I've been unable to make it work. I've read your brief instructions and I've understood that one needs to set the pole axis to the 'free' (unconstrained) axis of the aim transform.

    But no matter which pole axis I use, the aim transform (the head of my dog) always twists into the same odd position when I set the pole weight to 1. I use a separate 'dummy' gameobject as the test-transform to change the pole position, and I've moved it about everywhere. It almost doesnt affect the aim transform, except that the aim transform suddenly jerks around 180 degrees at certain points.

    So my question is: is there something I could be doing wrong? Could you provide us with an example setup or scene which shows how to use the pole target?

    Thanks, Wendelin
     
  30. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    Hi Partel,

    I've got a problem that I hope you can help me with, I'm using Aim IK to aim a weapon at the player (all works fine) then I'm using Mecanim IK to re target the left hand on the weapon when it's aimed at the player, the aim script ..

    Code (JavaScript):
    1. function LateUpdate(){
    2.  
    3.     if((globalVarsScript.futureSoldierType1Alive[soldierNumber]) && (!knockedDown)){
    4.  
    5.         if(seePlayer){
    6.             theLookAtPosition = player.position + transform.up * 0.2;
    7.             ikAim.solver.IKPosition = theLookAtPosition;
    8.  
    9.             if(currentStateLayer02.nameHash == reloadState){
    10.                 lerpWieghtdown();
    11.             }else lerpWieghtUp();
    12.        
    13.             ikAim.solver.IKPositionWeight = lookWeight;
    14.  
    15.         }else{
    16.      
    17.             lerpWieghtdown();
    18.             ikAim.solver.IKPositionWeight = lookWeight;
    19.         }
    20.      
    21.     }else{
    22.         ikAim.solver.IKPositionWeight = 0;
    23.     }
    24. }
    And the Mecanim IK code ..

    Code (JavaScript):
    1. function OnAnimatorIK() {
    2.  
    3.     if(seePlayer) {
    4.            if(currentStateLayer02.nameHash == reloadState){
    5.                lerpWieghtdown();
    6.            }else lerpWieghtUp();
    7.  
    8.     _animator.SetIKPositionWeight(AvatarIKGoal.LeftHand,lookWeight);
    9.         _animator.SetIKRotationWeight(AvatarIKGoal.LeftHand,lookWeight);
    10.  
    11.     if(leftHandTarget != null) {
    12.             _animator.SetIKPosition(AvatarIKGoal.LeftHand,leftHandTarget.position);
    13.             _animator.SetIKRotation(AvatarIKGoal.LeftHand,leftHandTarget.rotation);
    14.         }
    15.     }else{  
    16.         _animator.SetIKPositionWeight(AvatarIKGoal.LeftHand,0);
    17.         _animator.SetIKRotationWeight(AvatarIKGoal.LeftHand,0);          
    18.     }
    19.  
    20. }  
    When the Mecanim IK code is run the left hand moves to the effector but when the weapon points at the player the hand does not move down with the effector (as seen in the video) is this something to do with the call order?

    I'd appreciate any help you can give me, thank you.

     
  31. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    What I have just noticed is the bullet cases being ejected on the other side are being ejected above the weapon, so the transform positions of the bullet cases and the hand effector are not changing when the weapon is aimed at the player with the Aim IK .. But if you look the transform position of the hand effector looks to be moving with the weapon but not returning new position X,Y,Z .. Why would this happen ?
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Thanks, Wendelin, I found a nasty bug thanks to that feedback.
    Please change the line 204 in IKSolverAim.cs to
    Code (CSharp):
    1. Quaternion toPole = Quaternion.FromToRotation(transform.rotation * poleAxis, poleDirOrtho);
    Otherwise it would always use Vector3.forward as the pole axis.

    Also take this new demo scene.

    When using the pole, you'll have to make sure the line from the gun to the aim target will not align with the line from the pole to the pole target, or else you will have a singularity problem whit the solver trying to aim 2 axes to the same direction.
     
    WendelinReich likes this.
  33. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Hi, great looking project!

    Its just that AimIK is solving after AnimatorIK. So right now you position the hand to the gun in OnAnimatorIK that does it's thing before LateUpdate and then AimIK updates in LateUpdate, but it should be the other way around. Also your bullet instantiating happens before AimIK solves.
    You need to update AimIK manually, call
    Code (CSharp):
    1. aimIK.Disable();
    in Start and then add
    Code (CSharp):
    1. aimIK.solver.Update()
    to be the first thing in OnAnimatorIK().

    I might be wrong about this, because obviously I hardly ever use OnAnimatorIK, but let me know if this doesn't work :)
     
  34. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    Hi Partel,

    Thanks for the reply, I've already tried the manual update of AimIK, and every thing else I can think of but with the same results, if you notice what I said about the bullet cases being ejected on the other side of the weapon they also stay in the original position as the weapon lowers with AimIK to aim at the player (who's on the floor :)) they do not follow the the weapon and they as the hand effector are child of the weapon and should go down with the weapon.

    In the above video you can see the hand effector moving with the weapon but the hand does not follow it, while the weapon is lowered I can grab the hand effector transform and move it around and the hand then follows .. Strange.
     
  35. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    Here is another video showing my problem, It may have nothing to do with IK but it's strange I've never seen this happen before, as you can see I've changed the look at to be the wrist so the weapon is way off target to exaggerate the problem, first I grab the hand effector and as you can see the hand follows, then I grab the bullet case game object and again that follows but at the beginning and through the transformation of AimIK the bullet case game object and the hand effector does not follow?

     
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    I did some testing...

    Apparently we can't do any procedural bone manipulation before Animator IK, because after OnAnimatorIK() is called, Mecanim will just overwite every single bone.
    So what is happening with your character right now in each frame is:

    1. Mecanim animates the character
    2. OnAnimatorIK gets called, you set the left hand to the left hand target. Everything is fine, but not aimed
    3. Mecanim computes the final pose of the character, overwriting all the bone rotations
    4. You instantiate the bullets in LateUpdate, the casings get spawned at the unaimed position of the gun
    5. AimIK updates in LateUpdate (see the Script Execution Order, AimIK has assigned itself to a high value, so it probably runs after your scripts).

    So thats how your left hand falls behind and the bullets seem to come out of nowhere.

    With Animator IK, there is no way to work around this problem, it is a big black box. What you can do is just drop it and switch to LimbIK or FBBIK instead.

    Cheers,
    Pärtel
     
  37. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    Thanks Partel for looking into and answering my problem.

    I went with Animator IK to keep things simple as I tried FBBIK and i thought it was to much as I only wanted to re-target the hand and also the characters legs bent when using FBBIK.

    As for LimbIK I've not used that (I think I've not used it:)) .. I'll look into using that.

    Thank you.
     
  38. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    OK Partel Lang shouldn't this work? I'm now using LimbIK.

    Code (JavaScript):
    1. function LateUpdate(){
    2. // Only aim at the player if the soldier is alive and NOT knocked down
    3.     if((globalVarsScript.futureSoldierType1Alive[soldierNumber]) && (!knockedDown)){
    4.  
    5.         if(seePlayer){
    6.        
    7.             theLookAtPosition = player.position + transform.up * 0.2;
    8.             ikAim.solver.IKPosition = theLookAtPosition;
    9.             ikLimb.solver.IKPosition = leftHandTarget.position;
    10.             ikAim.solver.Update();
    11.             //ikLimb.solver.Update();
    12.  
    13.  
    14.             if(currentStateLayer02.nameHash == reloadState){
    15.                 lerpWieghtdown();
    16.             }else lerpWieghtUp();
    17.          
    18.             ikAim.solver.IKPositionWeight = lookWeight;
    19.             ikLimb.solver.IKPositionWeight = lookWeight;
    20.             ikAim.solver.Update();
    21.             //ikLimb.solver.Update();
    22.  
    23.         }else{
    24.        
    25.             lerpWieghtdown();
    26.             ikAim.solver.IKPositionWeight = lookWeight;
    27.             ikLimb.solver.IKPositionWeight = lookWeight;
    28.             ikAim.solver.Update();
    29.             //ikLimb.solver.Update();
    30.         }
    31.        
    32.     }else{
    33.         ikAim.solver.IKPositionWeight = 0;
    34.         ikLimb.solver.IKPositionWeight = 0;
    35.         ikAim.solver.Update();
    36.         //ikLimb.solver.Update();
    37.     }
    38. }
    I've tried disabling

    Code (JavaScript):
    1. ikLimb.Disable();
    Still no luck ..

    Screen Shot 2014-09-08 at 21.18.10.png
     
  39. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    329
    I have a character in a seated position and I would like to parent the head to an object controlled programmatically in the scene. The final result would be the body moving along with the head, keeping the hands and legs in the same position.

    Would I be able to accomplish this with final IK?
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Right now you:
    1. set AimIK IKPosition
    2. set LimbIK IKPosition
    3. update AimIK
    4. update LimbIK

    but it should be:
    1. set AimIK IKPosition
    2. update AimIK
    3. set LimbIK IKPosition
    4. update LimbIK

    Hold on, Huxley, I'll reply you in a minute...
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    You are making a driving game with the Oculus DK2, aren't you? :)

    At this time, the FBBIK solver has no head effector, but as I've promised to look into it for 0.5, I've recently done some development on that matter and the initial results are very promising. I could give you a hacky, but working solution right away and once 0.5 is out, have the head effector nicely built into the solver.
     
  42. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    Thank you Partel Lang works fine now .. I really should read the docs :)
     
  43. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    I'm still interested in this asset. Does it come with Third Person shooting Demo yet (At least Third Person Aiming)?

    Thanks!
     
  44. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    329
    Hey partel, yes we're the one making the driving game. But we actually need a head effector for all of our VR player avatars, so really looking forward to v0.5. Great that you had already considered it adding it to your package.
     
  45. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    677
    Hi Partel Lang

    Hi I seem to have another problem now, when I'm one side of the soldier and the Limb IK comes in the shoulder twists, if I go to the other side of the soldier there is no twits, what's going wrong, have I missed something again .. ?

    My code

    Code (JavaScript):
    1. function LateUpdate(){
    2. // Only aim at the player if the soldier is alive and NOT knocked down
    3.     if((globalVarsScript.futureSoldierType1Alive[soldierNumber]) && (!knockedDown)){
    4.  
    5.         if(seePlayer){
    6.            
    7.             theLookAtPosition = player.position + transform.up * 0.2;
    8.             ikAim.solver.IKPosition = theLookAtPosition;
    9.             ikAim.solver.Update();
    10.             ikLimb.solver.IKPosition = leftHandTarget.position;
    11.             ikLimb.solver.Update();
    12.  
    13.             if(currentStateLayer02.nameHash == reloadState){
    14.                 lerpWieghtdown();
    15.             }else lerpWieghtUp();
    16.          
    17.             ikAim.solver.IKPositionWeight = lookWeight;
    18.             ikAim.solver.Update();
    19.             ikLimb.solver.IKPositionWeight = lookWeight;
    20.             ikLimb.solver.Update();
    21.  
    22.         }else{
    23.        
    24.             lerpWieghtdown();
    25.             ikAim.solver.IKPositionWeight = lookWeight;
    26.             ikAim.solver.Update();
    27.             ikLimb.solver.IKPositionWeight = lookWeight;
    28.             ikLimb.solver.Update();
    29.         }
    30.        
    31.     }else{
    32.         ikAim.solver.IKPositionWeight = 0;
    33.         ikAim.solver.Update();
    34.         ikLimb.solver.IKPositionWeight = 0;
    35.         ikLimb.solver.Update();
    36.     }
    37. }
    Screen Shot 2014-09-10 at 18.17.08.png

    Video ..



    Thanks.
     
  46. lushdog

    lushdog

    Joined:
    Apr 30, 2014
    Posts:
    15
    Sounds like a plan Partel.

    One question though. PositionOffset is not effected by PositionWeight correct?
    If so, how can I pose my character in Play Mode (to know what the Offset targets should be) without any effectors having any position weights?

    -Matt
     
  47. sowatnow

    sowatnow

    Joined:
    Jun 12, 2014
    Posts:
    308
    Hi Partel,

    I got couple of questions regarding this plugin. Although I have already purchased it :).

    Can I use this in multiplayer game without having too much impact on the performance of the game/data?
    Can I use this to animate player, such as walk, run, shoot etc?


    Thanks
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Hi, Venged,
    This demo scene is included in the package.

    Hi!

    You have "Target" as the Bend Modifer, but the "Bend Modifier Weight" is zero, which means the limb will always be bent in the same direction in world space even if you rotate the character.

    So set the Bend Modifier Weight to 1, with the "Target" modifier the bending direction will then rotate along with the IKRotation.
    You can also try with the "Animation" bend modifier, that will try to maintain the animated bending direction of the limb.
    Still set Ben Modifier Weight to 1.

    If you update your FinalIK from the store to 0.4, you will also get a bend goal built in to the LimbIK solver.
     
  49. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,131
    Hi,

    Yes, PositionOffset is not effected by PositionWeight.

    ik.solver.leftHandEffector.position = target;

    is the same as:

    ik.solver.leftHandEffector.positionOffset += target - ik.solver.leftHandEffector.bone.position;

    The difference is that the former overrides the latter, meaning if you have positionWeight 1, the positionOffset has no effect.

    Also, positionOffset does not use Reach, Pull or Push.

    Also, positionOffset was designed to be used additively, so we can have multiple offset modifiers (Inertia, Amplifier...) working on the character, so always use positionOffset += something. It will be reset to zero each time the solver is finished updating.

    Hi, and thanks for the purchase!

    You can use it in a multiplayer game, procedural animation effects like IK and ragdoll physics are not normally synced over the network. They are usually handled locally for each client just like particle and other visual effects, so in terms of multiplayer, there should be no difference.

    The other question, technically its possible, but there is no solution included (yet) that would bake this to normal animation. It would be probably easier (also on the performance) at this time to animate using an external 3d app.
    I'm working on a tool that would enable animating in Unity using all the FinalIK tools and baking the results, but it has been postponed by more urgent stuff in the list.

    Regards,
    Pärtel
     
  50. sowatnow

    sowatnow

    Joined:
    Jun 12, 2014
    Posts:
    308
    Sounds great, looking forward to that tool.

    Btw I got UFPS package aswell, is it possible to use this with UFPS?
    Since UFPS package comes with all the good FPS stuff, It would be good if we can use these two together to create an A class Full Body FPS character.
     
unityunity