Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. Want to see the most recent patch releases? Take a peek at the patch release page.
    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. Mihailkostov

    Mihailkostov

    Joined:
    Feb 19, 2016
    Posts:
    4
    Hey,

    I never realized the root position is what is causing that! I tried playing around with it and it does seem to affect just this problem - if it's too far behind it makes the character look hunched, too far ahead makes the chest push forward like in the pictures above.

    Now, I can manually change that but with no permanent solution. However, I discovered another strange behaviour linked to that in my tests - strangely enough, the body seems to be perfectly fine in about the middle of my Vive play area. If I move physically forward closer to the edge of the space, the pelvis position changes somehow and the character's chest pushes forward. Moving back physically makes the hips extrude forward instead and appear hunched back.

    I am using a mixamo character so for Root I have set the parent of the Mixamo Hips subobject, which is the holder of the VRIK script. Tried changing the pelvis weights to 0, but that makes the pelvis float around in a strange way, often too far ahead or sometimes far behind. I wonder what causes the root to move too far ahead or behind when I walk around in physical space? That unfortunately makes it impossible to adjust in Scene view to the right spot, since the right spot will change depending on where I am in the room. Infuriating! Not with the asset or anything, it's wonderful, just that I can't seem to figure it out!

    Let me know if you can think of a solution, would be really appreciated!

    Mihail
     
  2. roomera

    roomera

    Joined:
    Sep 27, 2016
    Posts:
    13
    Hi Partel -

    A while back, you had shared a video preview of the VRIK Roomscale Locomotion in action... I was curious if this is still in progress, or if you have plans on releasing it at some point? Thanks!
     
  3. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    43
    I added following code at the top of the method, right before instantiating and adding FBBIK to the model then I confirmed that the model have Animator and it is humanoid.
    Code (CSharp):
    1. Debug.Log("Animator:" + actor.GetComponent<Animator>());
    and as you indicated me, I found the following warning.
    I am sorry I found this among +999 warning which I generally ignore.. This should have been told to you when I first post about this issue.
    What should I do for now?
     
    Last edited: Jul 10, 2018
  4. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    The reason you are seeing different behaviour in different parts of the room must be that you are not moving the root along with the trackers. Set root position to match horizontally to the position of the pelvis tracker in each Update. Set it's rotation also so that it's heading matches the heading of the pelvis tracker in each Update (only rotate around Y). Then move the root back a bit along it's Z axis if it's still necessary to improve the spine bending.

    Hey,
    I dumped it, as I could never achieve good enough results with a set of parameters for both room-scale, non-room-scale, as well as thumbstick procedural locomotion no matter how much I tweaked. People usually want to use animation so they could get exactly the kind of animation styling they're looking for so I've been experimenting with fully animated locomotion istead and had much better results with blend trees. I've used Kubold's Movement Animset, so I'm thinking about making an integration package to that, as I don't own those locomotion anims, so I can't make a demo out of it for you guys. I tried with my own locomotion anims, but they suck compared to Kubold's. :)

    Hey,
    Weird stuff.. If it's a Humanoid, it assignes the references using Animator.GetBoneTransform() and that can fail only if the Animator is disabled at the time of using it or if the head bone is not referenced in the Avatar. So please make sure the Animator is enabled when you build the FBBIK and also check the Avatar Configuration scene to see if the head bone is assigned to the Avatar.

    Best,
    Pärtel
     
    Kagyu likes this.
  5. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    43
    Thank you so much for your help. I found the cause and the solution.
    I was trying to add FBBIK to a GameObject which was gotten from an asset bundle before it was actually instantiated.
    At that moment, the GameObject had an Animator, a head transform and a humanoid type. It really seemed to be good enough to be applied FBBIK but its Animator was not activated yet.
    Your solid advice really helped me out of this issue. Without it, I would never toughtabout checking its Animator with "isActiveAndEnebled."
     
  6. sniffle63

    sniffle63

    Joined:
    Aug 31, 2013
    Posts:
    30
    Is there a way to move the ragdoll while hes getting up so hes ina specific position once hes standing. Or a way to get him to walk back to the spot he fell down at after getting up? I can think of custom ways of doing it, but before i go about doing that. I figured id check and see if im missing anything on how to do it and couldn't find anything with a google

    i orignally tried to lerp his position during the OnFixedUpdate inside of BehaviourUpdate.cs but he doesnt move untill after hes done getting up
     
  7. niki_kyl

    niki_kyl

    Joined:
    Dec 15, 2016
    Posts:
    2
    Hello Partel-Lang,

    We are working on a nultiplmult game and using VRIK to procedurally generate the animation of the characters. While the room-scale animation works fairly well, we are facing issues working with the animation with teleport. It somehow tries to make the entire distance in a single step and it bends low to the destination coordinates and gives a very weird movement.

    Does the teleport translates to small steps with VRIK and we are setting up the parameters wrong or do we need to solve it differently?

    Thanks
    Nikita
     
  8. chalitnc

    chalitnc

    Joined:
    Aug 9, 2012
    Posts:
    13
    Hi Partel-Lang,

    I have an effect I'm trying to achieve and would like to hear your wisdom on it - Using VRIK, I'm trying to get make it such that only the upper body is solved, but the legs act according to an animation. So far, I've set locomotion.weight to 0, plantFeet to false, however it seems I am still lacking something else. Thanks!
     
  9. teighshiclbw

    teighshiclbw

    Joined:
    Jun 26, 2018
    Posts:
    10
    Is it possible to rotate lower body but keep upper body's orientation?


    I have a run forward animation, lower body rotate towards the front .


    Here's a run left animation.
    I want to achieve similar result base on run forward animation, only lower body rotate towards the left, upper body keep its orientation.
    Can I done this using Final IK?
    Because I don't want to make a new "lower body rotate towards the left but upper body rotate towards the front" animation.
    This will save a lot of time.
    Thanks!
     
  10. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    271
    i am not a animation expert but thats always possible with a simple mask on the upper/lower body and then just disable the other
    https://unity3d.com/de/learn/tutorials/topics/animation/avatar-masks

    Final-Ik is of course great ;)
     
  11. teighshiclbw

    teighshiclbw

    Joined:
    Jun 26, 2018
    Posts:
    10
    Thanks for your reply.
    I have only one run forward animation
    I had already tried avatar mask before post this.

    Sadly, it won't work or I don't know how to get it work.
    I tried six diffrent ways:
    1. Upper Body Additive
    2. Upper Body Override
    3. Lower Body With Root Additive
    4. Lower Body With Root Override
    5. Lower Body Without Root Additive
    6. Lower Body Without Root Override

    Shaking more obviously, became a cripple or rotate the whole body.
    Anyway, it's just won't work.

    So my last hope is Final IK has some feature to rotate only lower body
     
  12. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,

    I don't have a tool for moving the ragdoll to a specific position once it is standing. But if you need it to walk back to somewhere, that can be done with a character controller that has some AI on it that is able to move it just like any NPC you'd have in a game.

    Hey,
    Move the character and it's IK targets to the new position, then call ik.solver.Reset();

    Hey,
    Setting locomotion.weight to 0 should do it, what exactly are the problems that you were seeing?

    Hey,
    You should approach this the other way around - not turning the lower body, but rotating the character root to the desired movement vector (to turn the lower body) and keeping the upper body facing another direction by rotating the spine bones. It can be done with AimIK. Just turn the root heading towards where you want to run and AimIK target towards where you want to aim.

    Cheers,
    Pärtel
     
  13. chrisabranch

    chrisabranch

    Joined:
    Aug 15, 2014
    Posts:
    91
    I paid for puppet master and followed the directions for invector..... it will not work.
    So, i paid for Ootii TPC, follow the Integration instructions and it still wont work.
    puppet master was $75 final ik was $75
    Ootii TPC was $70 and invecter the same.. :(:(:(:(:(

    i'm down over $350 trying to get something to work with puppet master other then the useless standard unity controller (useless to me).
    has anyone got invector to work with puppet master? the integration instructions it came with are very old and out dated. PLEASE HELP.... Thank you


    if someone can get invector working with puppet master i'll be Sooooo grateful other wise i think i just wasted a whole lot of money :'(
     
  14. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    Sorry about the integration packages not working. It's difficult to maintain third party integrations as they update their packages frequently and sometimes those updates break the integration. I've updated my Ootii's package just last week though so please try that. Looks like Invector has changed their product listing altogether since I made the integration so I'll add it to my todo list to make it work again.
     
  15. chrisabranch

    chrisabranch

    Joined:
    Aug 15, 2014
    Posts:
    91
    thank you, i just tried the Ooti package, it's almost works right but, has glitches, like when i drag the pin sliders.
     
  16. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    803
    I finally bought Final IK and its amazing. Thank you for the asset. My characters are running around turning their heads to look at interesting things, and their feet are firmly planted on the ground now:)

    I have a spider based on the CCDIK robot and it work great the first time i enable it. But if i disable and then re-enable the gameobject, the legs eventually stop animating, like 1 or more with each disable/enable until they are all not animated. just sticking out straight. It does this on the original demo spiderbot too.

    I tried checking the Fix Transforms box to no avail, although im not sure if this is related?

    Does anyone have any idea what might help? I really love how it looks.
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    Please don't adjust the pin slider manually when using BehaviourPuppet (known issue in the current version). call behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned) to unpin the puppet when you need to ragdoll.

    I updated the Invector's integration package (works with Basic Locomotion FREE, not sure about the others as they have 7 different controllers nowadays).

    Hey and thanks for the purchase!
    It's been years since anyone asked about the mech spider, I almost forgot I had it in the package :)
    But the problem was just a co-routine stopping when you deactivated it, please grab this fix.

    Cheers,
    Pärtel
     
    protopop likes this.
  18. StormBringerStudios

    StormBringerStudios

    Joined:
    Apr 19, 2014
    Posts:
    46
    Is there any tutorial or sample how to make VRIK lower part feet use animation and upper IK? I disabled locomotion by setting weight to 0, set feet animator and used avatar mask for lower part, still not working for some reason.

    Would be cool to have working example.
     
  19. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    803
    You made me so happy. That was one of two remaining bugs that i had placed i the "big problem" list. The fix worked great and i can't believe it was so simple.

    The spider demo was what brought me to the Final IK party:) It made my jaw drop, and its really cool what you can do with Final IK. Not just spiders but so many other little game touches. Thanks again.

     
  20. Mihailkostov

    Mihailkostov

    Joined:
    Feb 19, 2016
    Posts:
    4
    Hello Partel,

    Thank you so much for the feedback on the root positioning issue! I managed to resolve it and it turned out to be an entirely different issue. I had played around with the scales of some objects in the Camera Rig dependence, one of which was its parent and one the controller itself. That made the pelvis go nuts and once all scales were back to 1 it was all fine.

    I am trying to calibrate now for different heights and it works fantastically! 2 more questions regarding that.

    Firstly, I am creating a scene in which you switch bodies during play time. Is it possible to calibrate just once at the beginning and then have all the rest of the models match the height of the user? Also, since the second body is in a seated position for which I don't track the feet - how would you go about calibrating that? It's a driving scenario so you will sit down on a chair in real life and then change the perspective to a seated avatar.

    And secondly, when I calibrate the only things that seem to matter are the rotation of the head needing to match the rotation of the 3d Model I am calibrating into. Is there any way to create the correct calibration regardless of whether the person is looking at the exact direction? I have a workaround for that, but it would be ideal if I eliminate the risk of wrong calibration.

    Thanks again!
    Mihail
     
    Last edited: Jul 20, 2018
  21. BenWoodford

    BenWoodford

    Joined:
    Sep 29, 2013
    Posts:
    11
    Having this weird issue with the arm solvers in VRIK right now. When I rotate my left hand clockwise, the hand will reach a point and suddenly the forearm will rotate towards the chest when it should be rotating away from it. Similarly when I rotate the left and anti-clockwise I end up with the elbow pointing outwards when it should move inwards.

    Any thoughts? Probably just one value I've got wrong here.
     
  22. SKNKanimation

    SKNKanimation

    Joined:
    Feb 24, 2017
    Posts:
    4
    If you're already getting the calibration from a standing position, you can just retain the scale value and use that, but then you'd need to re-scale the car and the seat and stuff, too, otherwise your user might be too little or too big for the car. I save the calibration data in the save file so the user doesn't need to recalibrate when he/she starts the program later.

    For the avatar orientation thing I changed the code around in the //head section of the calibrator script. I commented out the line that stars headTarget.rotation and added headTarget.localEulerAngles = new Vector3(0, -90, -90); after it parents it to the headset a couple lines later. Those rotations probably vary based on the model. It might be wrong but I'll see if the new version fixes it before I make a better fix. I'm not sure if it's a bug or if it's working as intended.
     
  23. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    It should be as easy as just setting locomotion weight to 0. Could you please send (support@root-motion.com) a video or something so I could understand what is happening in your project?

    Hey, thanks for sharing the video, that spider looks really creepy :D
    Good luck with the game!

    Hey,
    About the scale, if the other models have the same height, you could just set their localScale to the same value as the model that was initially calibrated.

    If you switch to a seated position, you can unparent the foot targets from the trackers and move them to the floor of the vehicle. Maybe need to make the body tracker static like that as well. There's a driving example in the "VRIK (Basic)" demo scene too.

    About the head rotation issue, it's a bug in the current version, please import this patch.

    Hey,
    Would adding TwistRelaxer components to the forearm bones fix this issue?

    Cheers,
    Pärtel
     
  24. XaneFeather

    XaneFeather

    Joined:
    Sep 4, 2013
    Posts:
    83
    Any plans of supporting the new animation jobs system to reduce workload on the main thread?

    For non-humanoid characters with a 4x+ the amount of bones compared to humanoid characters, this new system might alleviate some of the performance concerns we found when using Final IK on our rigs.
     
  25. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    215
    Hello,

    I have a generic rig of first person hands and sword, Im wondering how to make a sword swing animation based on where the player is looking at. Do I have to make one cut swing animation and then use Aim IK ?

    I want to achieve the same thing that they show on this video (starting at 01:35).
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    Yeah, already working on making Job versions of my solvers. Will require a complete rewrite though, so expect it to take some time. Currently arrays are not supported so I'll have to figure out how to convert the heuristic solvers (CCD IK, FABRIK, Aim IK), but I'll probably work it out one way or another. Its all experimental stuff...

    Hey,
    Yes, it would be great if you had a base animation that just swings forward. Then you can use AimIK just like in the "Aim Swing" demo.

    Best,
    Pärtel
     
    laurencew likes this.
  27. Bamfax

    Bamfax

    Joined:
    Jun 12, 2016
    Posts:
    20
    Hi Pärtel, Everyone,

    does VRIK expose a reference transform.forward? I would like to use the chest forward orientation as reference for the player forward (instead of using head/cam orientation, to get a sloppy follow), but having an animation on the body makes using references.chest.forward a little shaky.

    Edit: Ups, well, transform.forward is the vrik reference forward orientation without head rotation. Sometimes life is simple.

    Thank you and cheers,
    Olli
     
    Last edited: Jul 26, 2018
  28. togawa83

    togawa83

    Joined:
    Feb 26, 2017
    Posts:
    1
    With Unity 2018.2.1f1.
    The following errors occured.
    Assets/Plugins/RootMotion/Editor/RagdollManager/JointInspector.cs(15,40): error CS0619: `UnityEngine.EventType.mouseDown' is obsolete: `Use MouseDown instead (UnityUpgradable) -> MouseDown'
    Will it be fixed in the next release?
     
  29. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    You could also use ik.solver.spine.faceDirection, that gives you a good forward vector for the spine.

    Hey,
    Just opened my project in 2018.2.1f1 and it was automatically fixed by Unity's automatic API updater. Did you allow it to run?

    It just changed "mouseDown" to "MouseDown".

    Best,
    Pärtel
     
  30. AdamAlexander

    AdamAlexander

    Joined:
    Jul 24, 2015
    Posts:
    56
    I'm trying to make an arm IK using CCDIK that works similarly to the arms in VRRIK. I want the arms ik to match the targets position and also the rotation. But with CCDIK I can only see a way to match the target position, not the target rotation. I don't want to use the VRIK because I need to use rotation limits and I don't need iks for the rest of the body.. just the arm. The IK is for a mech which the player is piloting.

    Do you have any tips on how this can be done?
     
  31. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    CCD and FABRIK are not able to solve for the rotation of the target, it's just the nature of the algorithms. I might have a solution for you though, could you please give me a screenshot of the mech arms?

    Best,
    Pärtel
     
  32. egoza1997

    egoza1997

    Joined:
    Oct 4, 2017
    Posts:
    1
    Hi! Maybe its not the right place to ask, but i am going to buy this asset and just want verify before, is it possible to change constraints for joints throw code? And please, can you give me some small tip what type of 3d object do i need.I tried another scripts with just rigged 3d model and sure it didnt work because I am missing something.How to connect all part together, now its just parts of model. Thank you in advance:)
     
  33. cameronpennerVR

    cameronpennerVR

    Joined:
    Sep 12, 2017
    Posts:
    4
    Hey. I was having some problems but I fixed them. Thought I'd post the solution here in case it could be implemented in the official version, or maybe helps someone else.

    I was having problems automatically hooking up VRIK on characters that had no shoulders. It would just throw a ton of out of bounds errors and leave them in a t-pose. My solutions is as follows:

    Code (CSharp):
    1. //in IKSolverVRArm.cs
    2. //line 125 - 128
    3. private VirtualBone shoulder { get { return bones[0]; }}
    4.             private VirtualBone upperArm { get { return bones[hasShoulder? 1 : 0]; }}
    5.             private VirtualBone forearm { get { return bones[hasShoulder ? 2 : 1]; }}
    6.             private VirtualBone hand { get { return bones[hasShoulder ? 3 : 2]; }}
    7.  
    8. //line 347
    9. VirtualBone.SolveTrigonometric(bones, 0, 1, 2, position, GetBendNormal(position - upperArm.solverPosition), positionWeight);
    This way it actually handles a lack of shoulder bones better.
     
  34. cameronpennerVR

    cameronpennerVR

    Joined:
    Sep 12, 2017
    Posts:
    4
    Hi, I'm getting another problem.

    Using the VRIK solver, I will sometimes get models that will have very thrusty hips. in this case both the shoulders and hips are rotating quite a bit from pretty subtle movements. I've played with a lot of settings and can't find anything that will turn this down but still look reasonable. I'm not using any feet or hip trackers. Just the head and hands.

    I've tried to fix this by selecting different bones in the humanoid configuration. Sometimes it'll fix things and sometimes it won't. The application I'm working on allows users to import their own characters, so it's important that the solution will be able to automatically apply itself, and doesn't need too much manual labor to get it looking right.

    This is what a normal character will look like: And this is a thrusty character:
    notthrusty.gif thrusty.gif

    Here's my VRIK settings:
    upload_2018-8-1_16-47-28.png

    Any help would be appreciated. We've been struggling with this for a while and can't find a good solution.
     

    Attached Files:

  35. AdamAlexander

    AdamAlexander

    Joined:
    Jul 24, 2015
    Posts:
    56
    Sure, heres a picture:
    upload_2018-8-3_11-42-14.png

    I've solved the left hand. The wrist is solved to the target position and then the hand is rotated to match the target rotation.

    The right gun-arm is a bit more tricky.. I want the gun to have a rotation limit applied. So I guess I'm looking for a way to combine an aim-ik with a ccdik. A solution which solves both of these would probably do what I'm looking for.
     
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    Did you mean by joint constraints the limits on their rotation?
    In Final IK only CCDIK, FABRIK and AimIK are able to use rotation limits on the joints. In FullBodyBipedIK and VRIK the joints are not limited, but a there are internal constaints in the solver that try to keep the bones angled right.

    About the type of 3D object you need, Final IK works on any character that has a hierarchical bone structure so normally it's nothing you have to worry about.

    Hey,
    Thanks for that, it is a known issue and has already been fixed for the next version.

    Hey,
    Could you please send me that weird teddy character fbx with VRIK on it with those settings (support@root-motion.com)?
    I've seen this issue before in games, but haven't found a good way to reproduce it yet.

    Hey,
    You could run LimbIK on that gun arm to get it positioned roughly where you need it to be, then use AimIK on top of it to take care of the aiming.
    Assign spine and left arm bones to AimIK. You'll have to add IKExecutionOrder.cs to make AimIK solve after LimbIK.

    CCD and AimIK can't be combined to work like that, they'll start fighting each other.

    Best,
    Pärtel
     
  37. TheMessyCoder

    TheMessyCoder

    Joined:
    Feb 13, 2017
    Posts:
    395
    Hi All, Today (Saturday 4th of August) I will have a live dev interview with the creator of #FinalIK & #PuppetMaster > RootMotion on my twitch stream!

    So pop in and feel free to ask any questions you like in chat as i check out Final IK and PuppetMaster.

    9pm UK time, 4pm ET, 3pm CT, 1pm PDT Live Unity Game Dev!!!

    http://www.twitch.tv/theMessyCoder

    rootMotionPreview.jpg
     
    Partel-Lang likes this.
  38. mostlyhuman

    mostlyhuman

    Joined:
    Mar 16, 2013
    Posts:
    29
    Using FBBIK with Grounder FBBIK and the character model keeps randomly disappearing on start. You can still see the character's capsule collider just no mesh rendering even though the mesh renderers are enabled. If I disable these two scripts the issue goes away. Any ideas?
     
  39. Bamfax

    Bamfax

    Joined:
    Jun 12, 2016
    Posts:
    20
    Pärtel,

    as always, thank you for your answer and always being present on the threads :).

    What would be a good way to pickup a gun from a hip holster using VRIK, thinking of the different stances the avatar (walk, crouch, fly, idle) could be in? I had a few shots at it, having the gun parented to the right thigh and am a little unsure what the best way is.
    a) Using an animation, it of course fails to align the hand with the gun as soon as an idle animation is playing underneath.
    b) Setting the gun as VRIK right hand target, this seems to be more or less exact depending on what the gun is parented to (checking while idle animation is playing). Parenting the gun to Pelvis instead of right thigh seemed to give a more exact placement of the hand on the gun.

    My next approach would be to unparent the gun from the character rig, have its transform follow an attachpoint on the rig, then start playing a "grab" animation and also weighting in the VRIK right hand weights, as well as the finger rotations using your scripts from your post #2920 from Dec 1st (https://forum.unity.com/threads/fin...d-ik-1-0-released.222685/page-59#post-3307469).
     
  40. AntLewis

    AntLewis

    Joined:
    Feb 2, 2010
    Posts:
    149
    Hey @Partel-Lang, just bought the plug-in and love it! Building on your interaction tutorial where you are picking up a sphere and sending a OnPickUp event, I'm trying to have the character pick up, pause, then replace an object back to it's original position and rotation. Couple of questions on this:

    1. Is there a simple way to replace an object to it's starting position, or is it a matter of caching the objects original transform, then lerping the effectors position/rotation to this value? I've done this below, but after the pause the hand just snaps back to it's initial position - any pointers on where I'm going wrong would be appreciated, with the approach or the code.
    2. Also, is it possible to replace the object back to it's original rotation?


    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using RootMotion.FinalIK;
    5.  
    6. public class PickupObject : MonoBehaviour {
    7.     private InteractionObject m_object;
    8.  
    9.     // Offset when character is looking at item
    10.     public Vector3 holdOffset;
    11.     // Offset calculated to return item
    12.     private Vector3 returnOffset;
    13.  
    14.     private float m_holdWeight, m_returnWeight;
    15.     private FullBodyBipedIK m_ik= null;
    16.  
    17.     // Object initial transform
    18.     private Transform m_originalPosition;
    19.  
    20.     private Vector3 startingPosition;
    21.  
    22.     bool pickUpState = true;
    23.  
    24.     private void Awake()
    25.     {
    26.         m_object = GetComponent<InteractionObject>();
    27.         m_originalPosition = this.transform;
    28.     }
    29.  
    30.     IEnumerator OnPickUp()
    31.     {
    32.         m_ik = m_object.lastUsedInteractionSystem.GetComponent<FullBodyBipedIK>();
    33.  
    34.         while (m_holdWeight < 1.0f )
    35.         {
    36.             m_holdWeight += Time.deltaTime;
    37.             yield return null;
    38.         }
    39.  
    40.         // Pause
    41.         yield return new WaitForSeconds(1.0f);
    42.  
    43.         // now calculate starting position of hand which we'll lerp to in Late Update
    44.         startingPosition = m_ik.solver.leftHandEffector.position;
    45.         pickUpState = false;
    46.      
    47.         // To return it to it's original position, we calculate a new hold offset
    48.         while ( m_returnWeight<1.0f )
    49.         {
    50.              m_returnWeight += Time.deltaTime;
    51.             yield return null;
    52.         }
    53.  
    54.     }
    55.  
    56.     private void LateUpdate()
    57.     {
    58.         if (m_ik == null) return;
    59.  
    60.         if (pickUpState)
    61.         {
    62.             // m_ik.transform.rotation keeps it in local space.
    63.             m_ik.solver.leftHandEffector.positionOffset += m_ik.transform.rotation * holdOffset * m_holdWeight;
    64.  
    65.         }else if ( pickUpState == false)
    66.         {
    67.             m_ik.solver.leftHandEffector.position = m_ik.transform.rotation * Vector3.Lerp(startingPosition, m_originalPosition.position, m_returnWeight);
    68.         }
    69.     }
    70.  
    71. }
    72.  
     
  41. sbmhome

    sbmhome

    Joined:
    Apr 22, 2016
    Posts:
    252
    I'm having issues with LookAt IK.

    It seems to work differently depending on the pose of when its first enabled.

    Is there a full proof way I can make sure my character looks forward correctly every time?

    For instance, is it possible to have the target first assigned to a temp Transform that is straight ahead (maybe even parented to the head of the character), enable it and then switch the target to the real target?

    This issue comes up every once in a while and I want to fix it permanently.
     
  42. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    Does enabling "Update When Offscreen" on the SkinnedMeshRenderer and setting "Culling Mode" to "Always Animate" on the Animator help? Sounds like the IK is pulling the character out of mesh renderer's bounds so it gets culled. There's no way to update said bounds unfortunately.

    Hey,
    That's a bit tricky stuff, as you can't parent an object that you want to interact with IK to the hierarchy that is used by that IK. I mean you can, but as that object's parent moves by the effect of IK, after the IK it won't be where it was when the IK target was read so the hand will end up offset. It's a circular dependency thing. In Dead and Buried I did the holstering by additional LimbIK on the arms that runs on top of VRIK. That LimbIK is weighed in only when the holsters are used and then you can set the LimbIK target to an object parented to the body, as the body is not used by the LimbIK.

    Hey and thanks for the purchase!

    If you go to the "Interaction" scene, click on the "Ball" gameobject and set "Reset Delay" to a high value like 100 or something in the ResetInteractionObject component just so it wouldn't drop the ball right away. Then play the scene and click to pick up the ball. Once you have the ball, move the right hand effector's position weight slighter to 1. Hand effector position was left to where the ball was picked up so the dummy moves the ball back to where it was. At that point you can just unparent the ball. That's how you should be able to do it.

    Hey,
    Yes, the IK samples the pose when it first initiates to find out which axes of the bones face forward and stuff like that.
    You should start with LookAtIK enabled and disable it after it initiates.
    You can do so by using the solver.OnPostInitiate delegate:
    Code (CSharp):
    1. void Awake()
    2.     {
    3.         ik.solver.OnPostInitiate += OnPostInitiate;
    4.     }
    5.  
    6.     void OnPostInitiate()
    7.     {
    8.         ik.enabled = false;
    9.     }
    or by just checking ik.solver.initiated in an update loop and disabling it if it returns true.

    Cheers,
    Pärtel
     
  43. sbmhome

    sbmhome

    Joined:
    Apr 22, 2016
    Posts:
    252
    Thanks for the code. I was disabling the component onEnable in my script and it probably didn't finish initialization.
     
  44. f1chris

    f1chris

    Joined:
    Sep 21, 2013
    Posts:
    204
    Hi @Partel-Lang ,

    I’m using Final IK mostly ( for now) for Foot IK. With the character controller I’m using, I have no choice to have a capsule collider. Problem is a high step like this (see pic) the collider doesn’t move up, whatever the capsule radius and the zero friction applied.

    I know i can shorten to the capsule and/or move it up a bit but how do i detect that exact moment like we see on the pic where the foot is planted on a specfic IK position ?

    If I’m using grounder.solver.Leg[1].isGrounded , it’s also detecting when is ground on normal position.

    Maybe some of you having other tricks to achieve same result.

    Thx
     

    Attached Files:

    Last edited: Aug 8, 2018 at 2:57 PM
  45. Bamfax

    Bamfax

    Joined:
    Jun 12, 2016
    Posts:
    20
    Hi Pärtel,
    thanks for your reply. I would try to avoid using another solver on top, if possible. Doing some more tests, it seems to work out fine if I keep the gun outside the character armature. Unless you recommend otherwise, I will follow this route.
    InteractionOject seems to have everything needed for that. I may try to come up with a barebones InteractionSystem for VRIK on basis of FBBIK InteractionSystem. Would you consider moving positionWeight and rotationWeight of the BodyParts to the base class and exposing a GetEffector()/GetBodyPart() on the IKSolverVR in a future iteration of VRIK? This would allow a similar lean code as is currently on the FBBIK InteractionObject:
    Code (CSharp):
    1. solver.GetEffector(effector).positionWeight = Mathf.Lerp(solver.GetEffector(effector).positionWeight, value, weight);
     
  46. DespairBear

    DespairBear

    Joined:
    Nov 1, 2013
    Posts:
    116
    Is there any way to invert the bend of a Limb IK? It's bending the wrong way on my quadraped's front legs and the trig limbs are having some wonky behavior
     
    Last edited: Aug 10, 2018 at 12:50 PM
  47. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,674
    Hey,
    You could use
    Code (CSharp):
    1. grounder.solver.legs[0].IKOffset
    to determine how high the foot is, but you can't get the information about if the foot is planted or not. Grounder simply does not know or care about that. All it does, is offset the feet based on ground height. isGrounded only lets you know if there is ground within stepDistance beneath the foot.

    Increasing collider radius helps with sliding over obstacles, but you can't increase it too much as the character won't be able to get close to walls at some point. You could actually create 2 colliders for that Rigidbody. One is on a layer that collides with the walls and is a thin capsule collider. The other is on a layer that only collides with walkable surfaces and is a big sphere collider that can slide over just about anything.

    Another option would be to create a hovering character controller, that has a thin capsule and that spherecasts down to find ground height and makes the rigidbody hover a few feet above it by adjusting Rigidbody.velocity.y. Should work like car suspension.

    Hey,
    Yeah, if you keep the gun outside of character armature and update it's position by script, the IK will work, although it will lag a frame behind (that's why it works), but I'm sure it would not be noticable.

    About the VRIK InteractionSystem, VRIK is a completely different solver internally and actually it doesn't even have effectors, so it's not that easy. I have avoided doing something like IS for VRIK because in VR you can just move your hands to wherever they need to be. To interact with objects, all you need to do is tween the IK target from it's default position relative to the hand controller to the position where it's on the object.

    Hey,
    Yeah, LimbIK samples the pose at Start to find out which way to bend the limbs, so all you have to do is rotate the middle bone so that bone1, bone2, bone3 form an "arrow" that points towards the wanted bending direction.

    Best,
    Pärtel
     
    f1chris likes this.
  48. 4sascha

    4sascha

    Joined:
    Mar 9, 2017
    Posts:
    33
    hi Partel,
    do you have some best practice startup/recommendation to sync two ore more vrik s for an local multiplayer.
    best,
    Sascha
     
  49. DespairBear

    DespairBear

    Joined:
    Nov 1, 2013
    Posts:
    116
    Wouldn't this solution distort the model a bit? I'm new to rigging/animation so sorry if that's a dumb question :p
     
  50. VP_3

    VP_3

    Joined:
    May 12, 2018
    Posts:
    78
    Hi @Partel-Lang

    I am sending some newbie questions becasue I didnt found yet the answers :)

    1. can I use most of the behaviours from you examples for quadrupeds ? if yes what I should be careful on settings ?
    2. the IK motions properely set up with an input controller like rewired will work on xbox ?
    3. can a character have multiple behaviours set up with the IK scripts (eg from your examples) and not have conflicts ? if not wich ones cannot be combined ? If yes, how should I do it ? I just add the components on the player and the aditional objects ?
    example: i want my char to walk, climb, shoot, pickup stuff, carry stuff, had inertia effect, kick (punch/feet), getting hit/absorb ... do I need to have controller for that or the scripts get triggered by the interactions with the objects ?
    further more: can an object be hit/shot/destroyed with all 3 scripts on it ?

    LE: Puppet Master + Final IK are better to use for the above ?

    thank you!
     
    Last edited: Aug 11, 2018 at 8:27 PM