Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    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. Licarell

    Licarell

    Joined:
    Sep 5, 2012
    Posts:
    434
    Yeah I had to change my shorts!
     
  2. hamyshank

    hamyshank

    Joined:
    Jan 31, 2013
    Posts:
    88
    Bump

    Looks like the update is ready! 8)
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Finally! :D

    Dont forget to backup your project before upgrading!

    Cheers,
    Pärtel
     
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    It seems like a small relic testing script named Button.cs has sneaked into the package, it is not namespaced so it might conflict if you already have a script with the same name. Just delete this script, it is not used.
     
  5. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Hello!
    I’m porting foot-placement to the Full body Ik system and placement works fine...
    But when I align foot to the surface, really weird rotation artifacts happens unless I set effector rotation weight to zero. Do you have any idea why FBIK is doing that? Do I need to adjust something beyond ik rotation here?
     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    FBBIK effector rotation works differently from BipedIK or Unity's IK rotations. The FBBIK rotations are dependent on the bone orientation. If you write ik.solver.leftFootEffector.rotation = ik.solver.leftFootEffector.bone.rotation, then your effector rotation will match the bone rotation and it will be maintained the same. That makes some things more difficult, but it also makes a ton of other things a lot easier. I'm considering to switch BipedIK to this approach as well.

    If you want to align the foot to the ground normal, you would have to do it by using rotational offset, something like:

    Code (csharp):
    1.  
    2. // Get the rotation from the default world up to the ground normal...
    3. Quaternion groundNormalRotation = Quaternion.FromToRotation(Vector3.up, groundNormalFromRaycast);
    4.  
    5. // ...and rotate the foot by this rotation.
    6. ik.solver.leftFootEffector.rotation = groundNormalRotation * ik.solver.leftFootEffector.bone.rotation;
    7.  
    Cheers,
    Pärtel
     
  7. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Partel you are a genius :)
    Thank you very much, I didn’t really notice the different behavior, it’s working like a charm now!
     
  8. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,649
    So, you need to update your tool.
    Thanks to both of you. :D
     
  9. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Yes, I am just adding an ‘adaptive’ option to make easier to make foot-place not affect full-body behaviour (or affect if you want to);
    Left foot has adaptive turned on, it moves solver only when has contact to floor, right is turned off (on image only);
    It causes the hole body try to reach the contact point.
    Thanks to FinalIK there’s no need to go on adjusting character controllers’ height anymore, we just turn on a bool and the character with FBIK will try its best to reach the IK goal :D




    Loving it!
     
  10. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Sweet Bruno!

    Do you have a guide on how to use FinalIK with your Mecanim Foot-Placement? :D

    (I believe you might've mentioned somewhere, either on this thread, Partels original one or yours)

    Thank you!

    -Steven
     
  11. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Just updated.

    It is really simple to use, i.e this is the FBIK version:


    It is all about curves, really. You simply adjust offsets and curves, checking if curves are doing a good job with your animation;
    The offsets are a way to tell the IK what is the height of your foot’s mesh model, you adjust this to make the mesh to mimic real foot collisions.
    Curves are used to let your animation playback correctly at the same time IKs are avoiding obstacles for the legs.

    This simple curve will work for most animations, you adjust it or assign a new one when your animation changes to fit exactly ‘where leg can’t be a foothold anymore’:


    Sometimes you may want to change how foot rotation reacts to the surface it is aligned to, so you could adjust ’sole curves’ as you want.
    And it is that simple :)
     
  12. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    So wait, otherwise all we do is add the FBFoot Placement script and it immediately recognizes FinalIK and/or its effectors?
     
  13. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    Yes, just add the script to the character with FinaliK Component, uncomment the ‘//#FINALIK’ on line 1 and it works.
    Also don’t forget to choose a layer to raycast with. Unity sets “Mask” to ‘nothing’ by default. Change to ‘everything’ or any other layer you want.
    In my projects I leave on “Level” layer so characters have foot placed with anything scene related but nothing else.


    At this moment I am having trouble to login back with Asset Store tools. I think it crashed or something and now I’m unable to send some more stuff... I hope it’s not just me.
     
    Last edited: Feb 19, 2014
  14. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Not that I mind editing the code, but IF I didn't ask you just now, it would've taken me longer to discover the comment...

    ...maybe make it an exposed boolean so you can just toggle it on/off from the script? Might be easier for others who will undoubtedly ask you this question again, hehe.

    Anyway thanks Bruno! :D
     
  15. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
    I had to do that because some users do not have FinaliK and they always email about any compiler error;
    If you don’t have FinaliK installed and import foot placement that way without compiler directives, Unity will scream red errors and that would make ppl mad haha
     
  16. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Ah of course, durr! :D

    Never mind!! :D

    ThAnkS mAn!
     
  17. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
  18. BrUnO-XaVIeR

    BrUnO-XaVIeR

    Joined:
    Dec 6, 2010
    Posts:
    1,687
  19. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    You'll need world class base mobcap data and a lot of it, but other than that, it all can be done with Final IK. :)

    Cheers,
    Pärtel
     
  20. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Hmmm so you have a new update, which requires Unity 4.3.4, and after all the updating I'm getting an error in your Playmaker implementation:

    Code (csharp):
    1. Assets/Plugins/RootMotion/FinalIK/3rdParty Support/Playmaker/FBBIKEffector.cs(44,35): error CS0426: The nested type `Mode' does not exist in the type `RootMotion.FinalIK.IKEffector'
    2.  
     
  21. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    The mocap can wait as long we have the basic system, even if it does not look that good!
     
  22. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
  23. SteveB

    SteveB

    Joined:
    Jan 17, 2009
    Posts:
    1,451
    Yea I was going to say, you only need the animation, however you create it and of whatever quality. :D
     
  24. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,492
    Looks like a horizontal tracking on top of an animation, it should be possible but you would need a policy for the "ball physics" (direction and force to send the ball after a grab).Maybe if you want to go fancy and entirely procedural a tracking of the distance that drive the animation weight (grab phase), but you may have problem of sync if things get out of hand, so maybe adding a release policy to keep sync. And a lot of tweaking to make it look natural.
     
  25. Silly_Rollo

    Silly_Rollo

    Joined:
    Dec 21, 2012
    Posts:
    501
    How do you assign the spines of a Look At IK script via code? I was poking around in the api doc but didn't see how to reference it.
     
  26. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    Is there any way to have a mecanim character's hands slide across any wall when near it? Like Naughty Dog games.

    Something like this:
    http://www.youtube.com/watch?v=RfQUosJh2DU


    If so, would any scripting be required? To do this without any scripting would make this an easy buy.
     
  27. niosop2

    niosop2

    Joined:
    Jul 23, 2009
    Posts:
    1,059
    Yes and yes.
     
  28. vivin

    vivin

    Joined:
    Jul 10, 2013
    Posts:
    15
    Just bought this plugin today, have been playing around with it and getting some interesting results. The documentation and example scenes are much help :)

    I do have one question/query thought. After applying a FBBIK to my character, it changes his idle animation quite heavily. During the idle anim, he scratches his left arm with his right arm. With FBBIK turned off this looks fine, but with it turned on, his arm goes through his body, I have no idea why this could be happening. This is with default settings, the bone references look correct as well.

    has anyone else run into similar issues?

    Also really excited to see what sort of foot IK solution will be available in the future. I have had a play around using Bruno's footIK solution, but its always nice to have a native solution :)
     
  29. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    If I understand correctly, it is possible with the current version of FinalIK but it will be very difficult to make it look natural ?
     
  30. 3

    3

    Joined:
    Sep 16, 2012
    Posts:
    387
    Well, awesome!

    Are there any examples or tutorials that show how to do this?
     
  31. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi, Steve, I have not updated the Playmaker Actions yet, I will do it today.

    Its possible theoretically, yes, I'm not sure how realistic the end result would be though, with a lot of tweaking.. You could for example just animate the balls and use Mecanim curves to set hand effector weight.

    Code (csharp):
    1.  
    2. lookAt.solver.SetChain (Transform[] spine, Transform head, Transform[] eyes, Transform root);
    3.  
    Yes it can be done, it needs a bit of scripting though, just raycast/spherecast from the neck towards the direction where you'd normally put the hand and set the hand effector to the RaycastHit.point.

    Hi, thanks for the purchase! :)

    You can try to adjust the initial pose of the character. In the scene view if you click on the FBBIK character you see the solver armature on top of it. The little arrows on the elbows and knees point to the direction the limbs will be bent to. You can try to rotate the elbow/knee bones slightly to change that direction.
    See this video on how it should be done.

    If that doesn't help, it might be that your elbows are not rigged as hinge joints in the animation software you are using.
    FullBodyBipedIK considers all elbow and knee joints as hinge joints, meaning the forearm can not twist relative to the upper arm. With the most common rigs, like the 3ds Max Biped, it is not a problem, as the rig prevents this kind of animation from the start. There are rigs however that allow for that kind of twisting. It will not break the FBBIK solver, instead, FBBIK will force the elbow or knee to restrain to a hinge joint even if there are no effectors enabled. It will not change the end position of the limb, it might slightly change the bending direction of the limb and the twist rotation of the bones in the limb. You can try this:

    Code (csharp):
    1.  
    2. ik.solver.GetBendConstraint(FullBodyBipedChain.LeftArm).bendBone = IKConstraintBend.BendBone.Second;
    3.  
    This will get the bending direction by the animated rotation of the second bone (forearm) instead of the first that is the default.
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Sorry, I dont have a tutorial/demo scene about that yet.

    Cheers,
    Pärtel
     
  33. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
  34. Madasebrof

    Madasebrof

    Joined:
    Feb 1, 2014
    Posts:
    3
    FINAL IK - Effector Animator Concept--Just wondering if you'd be willing to share this as I was writing a version of this myself it would save me the headache! Even if it's "proof of concept", that'd be great...

    Great product, all the best....
     
  35. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Yeah, why not..

    Here you go :)

    Just make sure to read the ReadMe in the package root folder.

    Cheers,
    Pärtel
     
  36. duencil

    duencil

    Joined:
    Dec 17, 2012
    Posts:
    91
    Bought this package recently and am having problems applying FBBIK to the first character I've tried it on. Immediately on pressing Play, his right shoulder twists and both arm and hand suddenly face 180º from forwards. The character is available on the asset store, though I expect I can send it to you for testing purposes, Partel. It appears to use a standard 3dsmax biped skeleton, at least from bone naming, so I expected it to work.

    On another note, I find myself unable to connect to www.root-motion.com . I dont know why, I've been trying for a week or so, and seem to need a web proxy to connect.

    Looking forward to seeing this product working.
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi Duencil, and thanks for the purchase!

    It would be the quickest if you could send me a package with the character and the animation to support@root-motion.com, I'll get it sorted out for you.

    But I have no idea, why you can't access root-motion.com, there are a lot of people visiting that site from all over the world.

    Cheers :)
    Pärtel
     
  38. snow404

    snow404

    Joined:
    Dec 1, 2012
    Posts:
    11
    I bought your package! My headakes are magically gone ! :)

    I have a question thought... In the manual it is written :
    FullBodyBipedIK does not have elbow/knee effectors. That might change in the future should there be a practical demand for them. Elbow and knee positions can still be modified though as bend goals are supported.

    How can I set the bend goals positions like I do for the solver positions( ik.solver.leftHandEffector.position )?
     
  39. DigitalAdam

    DigitalAdam

    Joined:
    Jul 18, 2007
    Posts:
    1,202
    After reviewing all the vids and docs, this system is very impressive! Before I purchase though, I want to ask if a couple of my ideas are possible with Final IK. I'm almost confident that it will achieve my requirements, but I wanted to run it by you.

    I rather not create separate animations for un-holstering a side arm; placement can be either the thigh, hip, or under arm. Can I use this system to aid in the hand placement?

    Also I saw a vid on the Motion Amplifier; can I use that to alter walk cycles without having to create unique animations, such as moving hip rotations to go from the default walk to something sexier?

    Thanks.
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi, and thanks a lot for the purchase! :)

    The bend goals dont work like the effectors, they just change the bending direction of the limbs.
    To use them, create a new gameobject and add the FBIKBendGoal script.

    Hi, Adamz,
    Yes, you can do the holstering.. You can just attach effector targets to the points where you want to holster the arm and then interpolate effector weight.

    And yes, you can play around with the Amplifier to make the walk sexier, amplifying the horizontal motion of the thighs should do it I guess :)

    Cheers,
    Pärtel
     
  41. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Hi Partel, I'm using UMA in my game and I've added FBBIK and lookat, via script as in your tutorial. I notice that when I've added the FBBIK, without moving any effectors etc my walk animations are effected on the legs and it doesn't look correct.

    Is there anything I can do about it?

    Thanks
     
  42. KrayonZA

    KrayonZA

    Joined:
    Mar 5, 2013
    Posts:
    52
    Hi

    Check the effectors on the knee's the UMA knee's are close to zero on the T-Pose so the FBBIK wont know which was they should bend.

    Bring in the UMA race prefab into the scene and adjust the knee's a little bit on the T-Pose so the IK knows which way they should bend.

     
  43. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Thanks for the help, it helps a little but I'm still getting really bad issues on the female, no matter what positions I try I can't seem to stop it from doing this with the right leg....

    $Screen Shot 2014-03-05 at 10.31.37.png
     
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    I see there are a number of UMA devs having this problem it is difficult to solve this in play mode. But as all UMA skeletons use the same bone orientations, I bet I can come up with a script that solves it once and for all. Hold on... :)

    Pärtel
     
  45. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Thanks Partel, looking forward to the fix. :)
     
  46. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    OK, I'm done..

    If you are in a hurry with this, download the patch and import to your project.

    I made it possible to use pre-defined limb orientation definitions or even to make your own very easily so you won't have to worry about how your character is posed at the time of FBBIK initiation.

    This is all you need to do for UMA:
    Code (csharp):
    1.  
    2. using RootMotion;
    3.  
    4. // Call after FBBIK has initiated
    5. ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA);
    6.  
    I have made 2 pre-defined biped limb orientations, for UMA and for 3ds Max Biped (BipedLimbOrientations.MaxBiped) But you can also fill in your own custom definition in the editor...

    Code (csharp):
    1.  
    2. public BipedLimbOrientations customLimbOrientations;
    3.  
    This is how the biped limb orientations definition looks like (this is the same as MaxBiped):

    $Screen Shot 2014-03-06 at 3.21.55 PM.png

    Imagine your character standing in I-pose (not T-pose) with legs together and hands on the sides...

    The Upper Bone Forward Axis is the local axis of the thigh/upper arm bone that is facing towards character forward.
    Lower Bone Forward Axis is the local axis of the calf/forearm bone that is facing towards character forward.
    Last Bone Left Axis is the local axis of the foot/hand that is facing towards character left.

    Thats it. I will add this to the next update so no need for patching again in the future. :)

    Cheers,
    Pärtel
     
  47. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Hi Partel, thanks for the patch, it's working almost perfectly but there's still some slight change in the legs. I've made a video:



    Maybe that's as good as it's going to get?
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    No. Thing is that with the current version, the elbow/knee joints are forced to 1 DOF (degrees of freedom) hinge joints, to avoid the risk of the limbs getting flipped in some cases because of animation import/compression/blending/keyframe reduction artefacts. Some animating rigs however allow a bit of elbow/knee rotations around all axes, so that motion is currently lost, that's why it looks different for some characters.

    But just today it seems like I have finally found a solution for having 3 DOF joints and all the characters and animations I have tested so far come across completely lossless, only limit is that the limbs can't be reversed (like broken from the knee/elbow). I mean with this you can have FBBIK on and the animation looks exactly the same. It still needs to go through all phases of testing before I add it to the package but so far so good. :D

    If you (or anyone else) is interested in trying this out and helping to test it, I can make another early bird patch :)

    Cheers,
    Pärtel
     
  49. derkoi

    derkoi

    Joined:
    Jul 3, 2012
    Posts:
    2,255
    Would love to try it out. Thanks again :)
     
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Last edited: Mar 7, 2014