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. Partel-Lang

    Partel-Lang

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

    That EffectorAnimator thing was put on hold, I ran into some brick walls and I need Unity to open up some things like to author humanoid motion in Unity and such, before I can make it a nice and smooth product without very hacky workarounds.

    I'll give it another try at some point, but in the meanwhile, you might be interested in something like this instead if you wish to animate in Unity.

    Cheers,
    Pärtel
     
  2. Hedonsoft

    Hedonsoft

    Joined:
    Jul 11, 2012
    Posts:
    168
    Hi again! When picking up items, is there a way I can get the character to bend down at the knees or do I need to add an animation to do this?
     
  3. Partel-Lang

    Partel-Lang

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

    In the FBBIK inspector, under Body, there is "Pull Body Vertical", make sure it is 1. That will make the character bend down more at the knees if hand effectors are reaching down.

    If 1 is not enough, go to IKSolverFullBodyBiped and increase the Range attribute at line 54.
     
  4. Hedonsoft

    Hedonsoft

    Joined:
    Jul 11, 2012
    Posts:
    168
    Fantastic thanks again! :)
     
  5. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    Hi,

    Can I add Limb IK to the left and right arm and control them in script, how would I call them in order?

    I know how to use one, like below, but is 2 possible?

    Code (JavaScript):
    1. private var ikLimb : RootMotion.FinalIK.LimbIK;
    2.  
    3. function Start ()
    4. {
    5.     ikLimb = GetComponent(RootMotion.FinalIK.LimbIK);
    6.     ikLimb.Disable();
    7. }
    8.  
    9. function LateUpdate ()
    10. {
    11.      ikLimb.solver.IKPosition = sawPickPoint.position;
    12.      ikLimb.solver.Update();
    13.      i += Time.deltaTime/testPickupSpeedAA;
    14.      i = Mathf.Clamp(i, 0, 1);
    15.      lookWeight = Mathf.Lerp(0.0, 1.0 ,i);
    16.      ikLimb.solver.IKPositionWeight = lookWeight;
    17.      ikLimb.solver.Update();
    18. }
    Thanks.
     
  6. ilesonen

    ilesonen

    Joined:
    Sep 11, 2012
    Posts:
    49
    Hi Partel,
    I've been using Final IK for few days now and I'm very pleased of my purchase, really great and helpful tool!
    I've simple question. I've been playing with the Carry Box Demo and it seems easiest way to interact with objects. The setup would be perfect for my need but I'd like the box/object to move along with the animation. Simplest thing is to place the box under the pelvis bone, that way the motion looks more natural. The problem is that the hand targets won't work so accurate anymore and they are losing their positions when rotating or moving the box. Anyway to fix this problem?
    Thanks!
     
  7. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    FinalIK looks like the exact product I need, but I was wondering. I'm making a mech game and I'd like to have it so that some of the legs have pistons. Not like the example on the first page where the piston goes around in a circle, but rather between two points. How would I accomplish this in FinalIK while also using it to solve feet touching the terrain properly?
     
  8. Partel-Lang

    Partel-Lang

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

    No problem, just do the same thing for the other arm, something like this:
    Code (JavaScript):
    1. var ikLimbLeft : RootMotion.FinalIK.LimbIK;
    2. var ikLimbRight : RootMotion.FinalIK.LimbIK;
    3.  
    4. function Start ()
    5. {
    6.    ikLimbLeft.Disable();
    7.    ikLimbRight.Disable();
    8. }
    9. function LateUpdate ()
    10. {
    11.     // Left
    12.      ikLimbLeft.solver.IKPosition = sawPickPoint.position;
    13.      ikLimbLeft.solver.Update();
    14.      i += Time.deltaTime/testPickupSpeedAA;
    15.      i = Mathf.Clamp(i, 0, 1);
    16.      lookWeight = Mathf.Lerp(0.0, 1.0 ,i);
    17.      ikLimbLeft.solver.IKPositionWeight = lookWeight;
    18.      ikLimbLeft.solver.Update();
    19.    
    20.      // Right
    21.      // Your IK code for the right arm...
    22.    
    23.      ikLimbRight.solver.Update();
    24. }
    Hi and thanks!

    The reason why it happens is that when you parent an IK target to one of the bones of the character, you'll get circular dependency. You set IK effector positions to the box, IK solves for the full body, the hands will end up where the box was, but since IK also moved the body, the box (parented to the pelvis) won't be there anymore.
    So what you need to do is not parent the box to the pelvis, but use a tiny bit of code that just puts it there instead. The code won't run again after IK solves, so the position/rotation box will not be affected by IK.

    Code (CSharp):
    1. public Transform bone;
    2.    
    3.     private Vector3 localPosition;
    4.     private Quaternion localRotation;
    5.    
    6.     void Start() {
    7.         localPosition = bone.InverseTransformPoint(transform.position);
    8.         localRotation = Quaternion.Inverse(bone.rotation) * transform.rotation;
    9.     }
    10.    
    11.     void LateUpdate() {
    12.         transform.position = bone.TransformPoint(localPosition);
    13.         transform.rotation = bone.rotation * localRotation;
    14.     }
    As a little bonus, using code instead of parenting will give you more options over the motion of the box relative to the pelvis. For example you might want to smoothly interpolate towards the position:

    Code (CSharp):
    1. void LateUpdate() {
    2.         transform.position = Vector3.Lerp(transform.position, bone.TransformPoint(localPosition), Time.deltaTime * lerpSpeed);
    3.         transform.rotation = Quaternion.Lerp(transform.rotation, bone.rotation * localRotation, Time.deltaTime * lerpSpeed);
    4.     }
    That will give the box a little weight or at least the illusion of it. :)

    Hi, Murgilod,

    None of the Final IK components can use prismatic joints (like cylinders) in the solving process. But all components support dynamic prismatic changes to the bone hierarchy. In other words, Final IK can't use the cylinder to reach out for the target, but you can write your own logic for the cylinder that extends/contracts it before IK solves, and Final IK will not have a problem with it. You could for example check the distance between the root of the chain and that target and if it's more than the combined length of the chain, extend the cylinder to make the chain longer.

    Cheers,
    Pärtel
     
  9. ilesonen

    ilesonen

    Joined:
    Sep 11, 2012
    Posts:
    49
    Thanks Pärtel!
    I don't know much about coding so could you give little more instructions?
    I tried it like this and it sort of works, it gives the motion of the pelvis bone to the box but the problem is that it's also locking the box so I can't rotate or move it around anymore.

    public FullBodyBipedIKik; //ReferencetotheFullBodyBipedIKcomponent

    publicTransform leftHandTarget, rightHandTarget, bone; //ThehandIKtargets (posedandcopiedfromruntime)

    private Vector3localPosition;
    private QuaternionlocalRotation;


    void Start() {
    localPosition = bone.InverseTransformPoint(transform.position);
    localRotation = Quaternion.Inverse(bone.rotation) * transform.rotation;
    }


    void LateUpdate() {
    //SettingIKpositionandrotationforthehands

    transform.position = bone.TransformPoint(localPosition);
    transform.rotation = bone.rotation * localRotation;

    ik.solver.leftHandEffector.position = leftHandTarget.position;
    ik.solver.leftHandEffector.rotation = leftHandTarget.rotation;

    ik.solver.rightHandEffector.position = rightHandTarget.position;
    ik.solver.rightHandEffector.rotation = rightHandTarget.rotation;
    }
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    No problem. You can also approach it like this:
    Code (CSharp):
    1. public Transform bone;
    2.    
    3.     private Vector3 lastPosition;
    4.     private Quaternion lastRotation;
    5.    
    6.     void Start() {
    7.         lastPosition = bone.position;
    8.         lastRotation = bone.rotation;
    9.     }
    10.    
    11.     void LateUpdate() {
    12.         transform.position += bone.position - lastPosition; // Add the position delta of the bone to this Transform
    13.         transform.rotation *= Quaternion.Inverse(lastRotation) * bone.rotation; // Add the rotation delta of the bone to this Transform
    14.    
    15.         lastPosition = bone.position;
    16.         lastRotation = bone.rotation;
    17.     }
    Basically it's just checking how much the pelvis has moved (no matter how) since the last update and adding that to the box... same thing with the rotation.
     
  11. ilesonen

    ilesonen

    Joined:
    Sep 11, 2012
    Posts:
    49
    Works perfectly!!
    Thank you! :)
     
  12. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Okay, when I can, I'll give a deeper look into this, thanks! It seems that to make it fully compatible (ie. not completely flipping inwards) I'll just need to make sure I have my constraints set up properly.
     
  13. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Alright, I have another question. The game I'm working on requires me to use constant interpolation for the animation to give it a more hand-drawn look in motion. Is there a way to accomplish this using FinalIK? It seems all the demos I've seen has it so that the movement looks at least slightly tweened.
     
  14. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    I don't quite understand, what do you mean by " constant interpolation for the animation to give it a more hand-drawn look in motion"?
     
  15. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    Oh, sorry, yeah, it's a bit of an edge case I'm dealing with.

    Basically, I'm animating so that every 12 frames per second (or 24, depending) is where the animation is keyed, but with no smoothing between frames. It's essentially what they did in Guilty Gear Xrd to make it look like animated cels rather than 3D models in motion.

     
  16. Alphalpha

    Alphalpha

    Joined:
    Oct 9, 2013
    Posts:
    74
    Huh; interesting effect. So, if I understand you correctly, you want to take an ordinary continuous animation and update your model with that animation only every 12 or 24 frames, to give a kind of 'stop motion' look to it.

    If that's the case, you don't need FinalIK (not to discourage you from buying it anyway!), you could just disable the animator and write a small script that increments a counter every frame until it reaches 12 or 24, whereupon it calls the Update() function of the animator and resets the counter.

    I'm not sure how the animator and its update function work when the animator is disabled, but something along those lines should work.
     
  17. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    10,151
    My main problem is that I still need to do things like sync foot positions on terrain, have characters reach toward things, stuff I can't really bake into a skeletal mesh, ya know?
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    What Alphalpha kindly suggested was also my initial thought. But after your reply this came to mind:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. /// <summary>
    5. /// Continuously forces a character to a pose that is sampled at the specified frame rate.
    6. /// </summary>
    7. public class StopMotion : MonoBehaviour {
    8.  
    9.     [Tooltip("How many frames per second will the sampling of animation be performed?")]
    10.     [Range(1, 60)] public int frameRate = 12;
    11.  
    12.     private Transform[] children;
    13.     private Vector3[] localPositions;
    14.     private Quaternion[] localRotations;
    15.     private float nextSampleTime;
    16.  
    17.     void Start () {
    18.         // Find all child Transforms
    19.         children = (Transform[])GetComponentsInChildren<Transform>();
    20.         localPositions = new Vector3[children.Length];
    21.         localRotations = new Quaternion[children.Length];
    22.  
    23.         // Sample the initial pose
    24.         Sample();
    25.     }
    26.  
    27.     void LateUpdate () {
    28.         // If time for the next frame, sample the pose of the character
    29.         if (Time.time >= nextSampleTime) Sample();
    30.  
    31.         // Always force the character to the last sampled pose
    32.         for (int i = 1; i < children.Length; i++) {
    33.             children[i].localPosition = localPositions[i];
    34.             children[i].localRotation = localRotations[i];
    35.         }
    36.     }
    37.  
    38.     private void Sample() {
    39.         // Record the local positions and rotations of all the child Transforms
    40.         for (int i = 1; i < children.Length; i++) {
    41.             localPositions[i] = children[i].localPosition;
    42.             localRotations[i] = children[i].localRotation;
    43.         }
    44.  
    45.         // Set the time for the next sampling
    46.         nextSampleTime = Time.time + 1f / (float)frameRate;
    47.     }
    48. }
    So you add this component to the root of your character. It basically just samples the pose of the character at the specified frame rate, then forces the character to that pose each subsequent frame until the next sampling.
    That way you can use all the IK components as you normally would and won't have to hassle with Mecanim. :)

    It's a bit wasteful though, to animate more often than necessary. So if you are on the edge with performance, it would be wiser to do like Alphalpha suggested, make a script that controls updating of Mecanim AND the ik solvers. Disable the IK components in Start using ik.Disable(); and update their solver manually with ik.solver.Update(); only after you update Mecanim. Grounder updates only if FBBIK updates so no need to worry about the Grounder.

    Cheers,
    Pärtel
     
    Last edited: Apr 16, 2015
    WendelinReich likes this.
  19. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    Body effector Rotation not exist ?
     
  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    No, because it would conflict with thigh and shoulder effector positions.. But it can be simulated, take a look at the "OffsetEffector" demo scene (not to confuse with "Effector Offset").
     
  21. Dave3of5

    Dave3of5

    Joined:
    Jan 20, 2015
    Posts:
    32
    I hate to post this type of thing as you probably get these posts all the time, but do you have any videos / documentation for using this with melee animations / systems. The things I mean would be like execution animations, procedural swings, combos ... etc. Anything at all would be helpful here.

    Again I apologise if this has been said a thousand times but from what I've seen this really looks like the product I've been looking for !

    Good job on a great product :)

    David
     
  22. DreamEnder

    DreamEnder

    Joined:
    Apr 12, 2011
    Posts:
    191
    Hi. I'm not sure if this has been covered, but can Final IK be used to simulate a quadruped such as a horse?
     
  23. ilesonen

    ilesonen

    Joined:
    Sep 11, 2012
    Posts:
    49
    Hi Pärtel,
    Is it possible to limit effectors position from script? So, the effector would stop after reaching the limit position and not move any further.
    Thanks.
     
  24. Partel-Lang

    Partel-Lang

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

    Yes, you can find multiple uses for Final IK in melee systems.
    Please take a look at those videos:
    Motion Absorb
    Punching
    Hit Reaction
    Aiming Swings

    All of them were made with demo scenes that are included in the package.
    Note that those are not fully procedural effects, but rather procedural modifications to the base animation.

    What kind of simulation are you looking for? If it's foot placement then no problem. You can also do stuff like head look at and such.

    Hi!

    Yes, you could spell it like this:
    Code (CSharp):
    1. void LimitEffectorPosition(Vector3 effectorPosition, Transform limitFrom, float limit) {
    2.         return limitFrom + Vector3.ClampMagnitude(effectorPosition - limitFrom, limit);
    3.     }
    Use it from LateUpdate if you want to limit the hand effector's position from the shoulder or any other body part.

    Cheers,
    Pärtel
     
  25. DreamEnder

    DreamEnder

    Joined:
    Apr 12, 2011
    Posts:
    191
    I was thinking of making a 3d sidescroller game with a horse that has to walk over obstacles, sort of like a trials game.
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    In that case, the GrounderQuadruped component of FinalIK would do the job.
    Anyway, if it doesn't, I don't mind refunding your purchase. :)

    Cheers,
    Pärtel
     
  27. RifS

    RifS

    Joined:
    Nov 27, 2013
    Posts:
    33
    Hi Partel,

    Here's my scenario:
    I want my characters to be handling a rope (attached to some kind of ceiling) with just his left hand while swinging back and forth. And I want the character to be able to detach himself at anytime, landing on the ground, and move around normally.
    My current character movement controller is just using 2 capsule colliders (for body and feet). So I don't use any ragdoll at all.

    I saw the "Mapping to Ragdoll example" as the closest one I want. However, I need the "stiffness" on the overall character movement when the character is being moved around. The one in example looks very ragdoll-ish if I am moving it with high speed.

    How can I go with Final IK to get something I described?

    It's similar like the one showed in here, except I want the arm segments to be heavily affected by the force from the rope, while the other body parts still retain the animation without being affected by force that much.
     
  28. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi! sorry for the wait...

    In the "Mapping To Ragdoll" demo, the character acts very ragdollish if you move it around from the "Target" gameobject. If you move it from the root (try moving the "Idle Example" gameobject), it is completely stiff. You probably want something in between so try this:

    1. Uparent "Target" from "Idle Example"
    2. Add this little script to "Target":

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.FinalIK;
    4.  
    5. public class TransferMotion : MonoBehaviour {
    6.  
    7.     public Transform to;
    8.     [Range(0f, 1f)] public float transferMotion = 0.9f;
    9.    
    10.     private Vector3 lastPosition;
    11.    
    12.     void Start() {
    13.         lastPosition = transform.position;
    14.     }
    15.    
    16.     void Update() {
    17.         Vector3 delta = transform.position - lastPosition;
    18.        
    19.         to.position += delta * transferMotion;
    20.        
    21.         lastPosition = transform.position;
    22.     }
    23. }
    3. Assign the "Idle Example" gameobject as "To".

    Now move the "Target" around and see how it does. See how adjusting "Transfer Motion" value changes the stiffness of the character. :)

    Cheers,
    Pärtel
     
    RifS likes this.
  29. bhads44

    bhads44

    Joined:
    Feb 19, 2013
    Posts:
    37
    Hi,

    I've got AimIk attached to a character, with the solver set to full weight when the character is armed with a weapon.
    The problem I'm getting is a strange one. When the character with the AimIK script is selected in the heirarchy and Play is initiated in non-maximize screen mode, the system works well. However if another ojbect in the heirarchy is selected during play, then (although the weapon is perfectly aligned towards the target) the character is very jumpy.
    Also, if the character is selected in the heirarchy and then play is initiated in maximize screen mode, then the character becomes very jumpy as soon as it is armed. It continues to remain jumpy even when not armed.
    I also have the Grounder component attached, and when this is disabled in the inpsector the problem goes away whether in maximise screen mode or not and regardless of which object is selected in the heirarchy.
    I need both components working in conjuction. Any help is apprecaited.

    Regards.
     
  30. Partel-Lang

    Partel-Lang

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

    That sounds strange indeed. What do you mean by "jumpy", is it jittering or something?
    Do you have animator update mode set to "Animate Physics"?

    Pärtel
     
  31. bhads44

    bhads44

    Joined:
    Feb 19, 2013
    Posts:
    37
    That sounds strange indeed. What do you mean by "jumpy", is it jittering or something?
    Do you have animator update mode set to "Animate Physics"?


    Thank you very much. I just switched animate physics to normal, and now it's working!
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Thats great, but one more question, are you updating the IK solvers manually by calling ik.solver.Update?
     
  33. bhads44

    bhads44

    Joined:
    Feb 19, 2013
    Posts:
    37
    Thats great, but one more question, are you updating the IK solvers manually by calling ik.solver.Update?

    Yes. Ik.slover.Update() is used as part of the positionlefthand method, after the pistol/rifle has been aimed.
     
  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    OK I know what the problem is. With Animate Physics animation updates only in fixed time step frames, so it is necessary to first check if a FixedUpdate has been called since the last solving. Otherwise IK will solve more than once before animation overwrites the pose again in the next fixed time step. Thats where the jitter comes from.
    It became evident in maximized screen mode probably because the frame rate (and fixed frames per floating frames ratio) is different like this.

    So if using Animate Physics, ik.solver.Update should only be called in the fixed time step frames (where FixedUpdate has been called), like this:

    Code (CSharp):
    1. bool fixedFrame;
    2.  
    3.     void FixedUpdate() {
    4.         fixedFrame = true;
    5.     }
    6.  
    7.     void LateUpdate() {
    8.         if (!fixedFrame) return;
    9.  
    10.         // Update IK here
    11.  
    12.         fixedFrame = false;
    13.     }
    It's an ugly hack I know, but unfortunately there is no Monobehaviour.OnAnimated callback for us to know when animation has been applied to the model.
     
  35. RifS

    RifS

    Joined:
    Nov 27, 2013
    Posts:
    33
    Thanks! it works like what I wanted now.
    How about having the ragdoll able to stand straight on a ground after being released in hung position? Is there a feature in Final IK I can use for this?
     
  36. Partel-Lang

    Partel-Lang

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

    Please import this package.
    I updated the Mapping to Ragdoll demo to support smoothly blending in and out mapping.
    You can define where the character is released by changing "rootTargetPosition" and "rootTargetRotation" of the PendulumExample.cs script.
    I also added TransferMotion to the idle example to see if it works with that.

    Cheers,
    Pärtel
     
    RifS likes this.
  37. RifS

    RifS

    Joined:
    Nov 27, 2013
    Posts:
    33
    Thanks Partel!

    I haven't fully understand and implement it yet, but just from looking at your modified example, are these the step-by-step :
    1. Turn off the "Target" GameObject
    2. Move the "weight" value in PendulumExample.cs to 0
    3. Keep updating the rootTargetPosition/rootTargetRotation according to my custom collider position/rotation in the Update() function
     
  38. TechiTech

    TechiTech

    Joined:
    Dec 13, 2014
    Posts:
    212
    I'm having problems with AimIk. I'm using a weight layer (Uzi layer) that has a mask that only effects the arms. So shooting animation will play and only the arms will be affected. When it's in its idle aim it's ok but when it goes into shoot state on the same layer it then has problems. The shoot state animation keeps facing the wrong way. any ideas whats causing this.

    1:Base layer : Walk, ect
    2: Uzi layer : "Idle state" TO "Shoot state" (layer has arms mask)

    also my character in base state is facing up, but when on masked layer(uzi) it's ok. Any ideas?

    Using Unity 5. Humanoid rig.
     
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    No need to turn off the Target gameobject. You should just blend out the "weight" value smoothly while updating the rootTargetPosition/rotation.

    Hi!

    Can you send me some screenshots or a video to support@root-motion.com?
    It's a bit difficult to understand what might be going on without them.

    Cheers,
    Pärtel
     
    RifS likes this.
  40. TechiTech

    TechiTech

    Joined:
    Dec 13, 2014
    Posts:
    212
    nevermind Partel. I don't think it's going to work properly.. I think it's related with the the lenzo character pack on the asset store. It's already given me problems when retargeting them in third party software. "Bones issue".

    I'm near to end of finishing my game and I can't be bothered to have to deal with re-rigging ect all the models. Just another asset store pain in ass product.(lenzo)

    Thanks anyway
     
  41. Partel-Lang

    Partel-Lang

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

    I'll be on a little vacation in Crete for the next week so support might be slower than usual :)

    Cheers,
    Pärtel
     
    Zaddo67 and ksam2 like this.
  42. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Hi. I have a question, I'm using enteraction to drawing a colt gun out of cover by pressing G button but how can I return it back to its place by pressing G again?
    Is there any invert action for this?
     
  43. ldl01031

    ldl01031

    Joined:
    May 1, 2014
    Posts:
    35
    Hi there,

    First - warning - newbie question coming... :) I created a character using Autodesk Character Generator (https://charactergenerator.autodesk.com/). It works fine in every respect (runs, walks, etc.). However, when I place the FullBodyBipedIK on it, I get 'yellow knees' - and this message:
    "The bend direction of this limb appears to be inverted. Please rotate this bone so that the limb is bent in it's natural bending direction. If this limb is supposed to be bent in the direction pointed by the arrow, ignore this warning.".
    And things definitely don't work right.
     
  44. Obsurveyor

    Obsurveyor

    Joined:
    Nov 22, 2012
    Posts:
    277
    Just follow the directions, go to the lower leg bones and rotate them a bit back so the knee joints aren't 100% vertical.
     
  45. ATMEthan

    ATMEthan

    Joined:
    Dec 27, 2012
    Posts:
    54
    Hello!

    Let me start by saying this IK system is amazing!! I would love to use it but with my current project I am not sure if it will integrate well. My project is basically a model mirror of the user. Using this plugin https://www.assetstore.unity3d.com/en/#!/content/18708 I use a Kinect and apply the users movement to model. The project works but it isn't close to be 100% perfect when the model mirrors the user. I was toying with the idea of applying an IK system to the model in hopes that this would make the model flow much more naturally. What are your thoughts on this? I'm not too sure how your IK system would respond to the model being controlled by the kinect/user and before I drop 90 bucks I just wanted to get your opinion first.

    Thanks and great work man!!!
    -Ethan
     
  46. ldl01031

    ldl01031

    Joined:
    May 1, 2014
    Posts:
    35
    Thanks much - I'll try that. I didn't try making any small adjustments since it sounded like something was completely backwards.
     
  47. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,080
    Anybody know how can I change MoveMode from Directional to Strafe with a line of code?
    For example I need when I press "F" move mode get changed to Strafe from Directional
    Please help thanks.
     
  48. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    205
    Can FinalIK work in conjunction with Unity's "Optimize Game Objects" feature?

    I'm getting trouble getting them to work together since the Optimize Game Objects flattens the transform hiearchy and FinalIK demands the hierarchy.
     
  49. Zaddo67

    Zaddo67

    Joined:
    Aug 14, 2012
    Posts:
    489
    I am trying to use Final IK to make my character hold a gun using FBBIK. I am starting with the carry box demo script.

    It appears my forearm won't twist.

    In the images below, I am rotating the right hand target. Attempting to turn the hand over so the palm is facing up. The solver, instead of twisting the forearm, is rotating the shoulder, pushing the elbow inside the body.

    The FBBIK srcript has all the transforms mapped correctly. The elbow is hinged correctly.

    What else can I do, so the solver will twist the forearm?

    Thx.

    Edit: In the carry box demo, I tested with the Humanoid Dummy included with final IK. It works ok. I also tried positioning the arm in the correct position in the muscle rigging, my character and the dummy could both move their arms into box holding position ok.

    When I placed my character (note it is a Mixamo character), in the carry box demo scene, I got the elbow in the side problem again. I can't see any differences in the rigging of the two characters. Note: I did delete the fingers on the target, because they are named differently on the Mixamo character.


    Edit2: I sent you a PM with a link to a example scene.

    Ok.png notwist.png
     
    Last edited: May 10, 2015
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,554
    Hi, all, I'm back now, sorry for the delay!

    You are using the Interaction System to draw the gun, right? In that case, make the interaction longer to also blend the weights back out, I mean it should be drawn at half time. Then just add an Interaction Event at that half time and check the "Pause" checkbox. So when the gun is out, it will pause the interaction, and when you need to put it back, call interactionSystem.ResumeAll();

    Hi, yes the pose of the character is sampled at Start to see which way the limbs bend. When the yellow warnings appear, the knees are probably inverted. You just need to rotate the knee bones in the Editor a bit so they are bent in their natural bending directions and the little blue arrows on the knees face forward.

    Please see this video (from 1:40) to see how it can be done.

    Code (CSharp):
    1. public CharacterThirdPerson characterThirdPerson;
    2.  
    3.     void Update () {
    4.         if (Input.GetKeyDown(KeyCode.F)) {
    5.             characterThirdPerson.moveMode = CharacterThirdPerson.MoveMode.Strafe;
    6.         }
    7.     }
    You also need to add
    Code (CSharp):
    1. using RootMotion.FinalIK.Demos;
    on top of your script if you wish to refer to Final IK demo scripts.

    Hi!

    No, you can't use the Optimize Game Objects feature, sorry. It hides the bone transforms, but we need access to the bones to manipulate them procedurally, no way to work around that.

    Hi!

    If it's a Mixamo rig, first check if the elbow bending direction is correct. See if the blue arrows point towards the natural bending direction of the elbow in the Editor when you have the game object with FBBIK selected.

    If you need very specific behaviour for the elbow and hand rotations, it is best not to use effector rotation, but to just rotate the hand bone with a script and use a bend goal for the elbow. Usually for guns I just make a game object for the bend goal and parent it to the root of the character or the pelvis. Then set "Maintain Hand Rot" to 1 in the FBBIK inspector, set hand effector rotation weight to 0 and in the code replace
    Code (CSharp):
    1. ik.solver.leftHandEffector.rotation = something;
    with
    Code (CSharp):
    1. ik.references.leftHand.rotation = something;
    That way you always have 100% control of the elbow and hand rotations.

    Best Regards,
    Pärtel
     
    ksam2 likes this.