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

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Could you PM a voucher for your package? I'll send you mine in return and then I'll see what can be done.
    Cheers
     
    ftejada likes this.
  2. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    Hi,

    Yeah, I have the PM on the player already.

    Thanks for the script Partel. I'll give it a whirl and report back as soon as I'm able. Got a lot on today so it'll probably next week.

    On which gameobject do I put this script? I have this hierarchy:

    - root
    - Behaviors
    - Puppet
    - Character Rig

    Also, that script wants a ref to a BehaviourPuppet component. Where should that component be placed?
     
    Last edited: Apr 7, 2017
  3. DryginUnity

    DryginUnity

    Joined:
    Nov 20, 2016
    Posts:
    7
    Here's the animation, hope it works !
     

    Attached Files:

  4. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Hi Partel,
    I'm following your tutorial for the interaction system, (
    ) but my human mesh is not moving their arm to the target, I have set the weight curves etc, I think it is setup ok but don't see anything moving.. how can I debug this?
    My full body bipied ik has weight of 0... is this the problem?
    Thanks for any help with this.
     
  5. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    You can put that on the Puppet gameobject, doesn't really matter. The BehaviourPuppet component can be found under Behaviours (if you were using that, if not, drag one in from PuppetMaster/Prefabs/Behaviours/Puppet.prefab.

    Hey, thanks for the clip, it was most useful. I adjusted the CharacterAnimationThirdPerson script to not use root rotation in calculating the "Turn" parameter for the animator. Please import this patch to fix it.

    Hey,
    Yes, if you IK component has 0 weight it will not do anything. InteractionSystem depends on the FBBIK component, if it is not updated, neither is IS.

    Best,
    Pärtel
     
  6. Partel-Lang

    Partel-Lang

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

    Just submitted FIK 1.6.1 for review, will take care of all the annoying editor obsolete API warnings in Unity 5.6.

    Cheers,
    Pärtel
     
    Griffo, tapawafo and Arganth like this.
  7. bcv

    bcv

    Joined:
    Sep 1, 2012
    Posts:
    34
    Hello great work on FinalIK and PupperMaster, was wondering if there's a way to pin a knee somehow ? I find that if my character is for example kneeling and I try moving the head using a FBBIK Head Effector the whole body moves with it, only the feet stay in place.

    Would be nice to be able to select a body part and pin its translation or rotation, or even both. Is there a way ?
     
  8. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476

    Thanks Pärtel, I suspected that my issue is related to the weight setting but I am seeing other strange behaviour when setting it to value 1 on my model, see screenshots:

    With weight setting 1 the player's body becomes really bendy and does not seem to keep the bones/limbs in correct direction, especially noticeable with legs:
    1.PNG
    2.PNG

    Then I change weight value to 0 and the body is perfect:
    3.PNG
    4.PNG

    So currently I cannot use weight setting on 1 but obviously it seems I need to. Why is my body going all bendy/wrong directions with weight set to 1? Is that normal? All the lines are blues so I think I have rigged it up ok.
    Thanks for any advice on this matter :).
     
  9. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    There's no way to pin the knees currently. But try pinning the body effector instead, that would keep the knees in place.

    Hey,
    You probably need to adjust the knee bones in the Editor. Take a look at this.

    Best,
    Pärtel
     
  10. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Many thanks Pärtel, that is one of the first things I checked, to see if I have any yellow/red markers, but no it all appears blue on my model, see:
    3.PNG

    I am not sure what to do next, even if the markers/bones are blue should I still rotate the knee bones to see that helps, or can you provide any other ideas/guidance (would be much appreciated of course!)?
     
  11. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    Hi Partel,

    I've tried the script and now the limbs just freely move through each other as though there were no colliders.

    I have done these steps:

    On the Enemy, setup like this:

    upload_2017-4-11_12-54-29.png

    I added these components to the Enemy_Puppet. Like this:

    upload_2017-4-11_12-55-9.png

    Dragged in the Enemy_Puppet to fill the references for 'Puppet' and 'Puppet Master'.

    Then set all the upper body pin weights in the PM component to 0.5.

    I did the same with the Hero (VRIK) character.

    All the limbs are as they were setup when adding the puppet - non kinematic
     
  12. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    Also, btw, we have noticed that a puppet's feet can be wobbly when locomoting. Any ideas on how to mitigate that?
     
    Last edited: Apr 11, 2017
  13. caoyuxi

    caoyuxi

    Joined:
    Jul 9, 2015
    Posts:
    10
    hello guys i goy some problem with leg in VR IK on HTC Vive, it works fine with the demo pilot model rig, but on my custom human rig, my knee leg wont move when the whol body rotate, so it look weird when it looks back. Capture2.PNG

    Capture1.PNG

    the feet move correctly but just the knees are not fellow the feet or the body rotating direction, i tried all parameters on VRIK, but didnt find the solution, anybody have idea??
     
    Last edited: Apr 11, 2017
  14. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel-Lang Hi, Im using removing muscles to shoot the enemy to bits, but I'm also going to pool the puppets, so my question is can I rebuild a puppet when Ive dismembered it so I can then re-pool it?

    Thanks.
     
  15. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @Partel-Lang

    I talked to jbooth of Megasplat and he told me that he passed his asset to be able to do an integration concerning the problem I published:


    I tried to integrate it but since the Final IK script did not let me access the Megasplat script and I did not recognize the namespace of JBooth. And I have not found a solution for that. Do you have any idea why this problem might be?

    I would like to ask how long it may take to integrate it and upload the update.

    regards
     
  16. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Could you send me that model and the animation clip with which you are seeing this problem?

    Hey,
    The knees are probably just slightly, unnoticably inverted in the Editor. Try rotating the knee bones so the legs are slightly bent in their natural bending direction.

    Hey,
    There's no built-in method for that. Anyway, the process of rebuilding all the joints and everything would probably be slower than just instantiating a new one.

    Hey,
    Yes, I'm working on it with JBootn, I can update you on this next week.

    Cheers,
    Pärtel
     
    ftejada and Griffo like this.
  17. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Thank you.

    Can you let me know as soon as I have one? And I'll send the invoice

    regards
     
  18. manuel_rochon

    manuel_rochon

    Joined:
    Nov 9, 2015
    Posts:
    23
    Hi Partel,
    where can we find the full release notes for the new version?
    I'd like to see what changed before downloading.

    thanks!
     
  19. Jerrith

    Jerrith

    Joined:
    Sep 8, 2015
    Posts:
    6
    mrstruijk, mfleurent and tapawafo like this.
  20. ksam2

    ksam2

    Joined:
    Apr 28, 2012
    Posts:
    1,079
    I think there should be one more effector type (Upper Arm) for interaction system. I can't setup an exact same position as my biped target because I can't match "Upper Arm" with target.

    Thanks for this cool asset again.
     
  21. LVermeulen

    LVermeulen

    Joined:
    Jun 26, 2013
    Posts:
    39
    I noticed some models need a different VRIK setup - since they have different bone rotations. Do you know if there is anyway to get around this? To automatically set the right bone rotations depending on the model
     
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    We're still working on it, I'll try to remember to update you when we have something.

    Hey,
    Same as all assets, click on the version number on the Asset Store page of the asset or go to the Download Manager, find the asset and click on "Release Notes". There is also a "Plugins/RootMotion/FinalIK/Final Change Log.pdf" with the full 27 pages of notes since day 1 (01/15/2015).

    Hey, thanks for sharing this video, love your characters!

    I'll get my hands on those trackers this week hopefully so I will try to make a Vive tracker demo using VRIK.
    You seem to have some twitchiness in the legs though, does that come from the tracking or do you think it is a problem with the IK?

    Hey,
    You can do interactions with upper arms, just use the shoulder effectors.
    Or you could use the "Reach" and/or "Push" curves in the InteractionObject to adjust the upper arm/shoulder.

    Hey,
    I don't have an automated solution for that at the moment, sorry.

    Best,
    Pärtel
     
    ftejada likes this.
  23. Badin

    Badin

    Joined:
    Jul 21, 2015
    Posts:
    14
    Hi, sorry by asking something someone could have asked before on this long thread.
    Does Puppet Master only work with humanoid characters?
     
  24. Jerrith

    Jerrith

    Joined:
    Sep 8, 2015
    Posts:
    6
    My guess would be the IK. Though I've cut most of it off, you can see the movement of the trackers by themselves at the start of the video, and it's quite smooth. With the mounting system I had at the time of the video, there was a bit of jitter whenever I put my foot down, but other than that case, I'd expect it to be smooth.

    Great to hear you'll be getting trackers soon - they're quite fun to work with, and VRIK works quite well considering you haven't had to work with. I imagine it will be even better once you've had a chance to use them.

    I guess one other thing I should mention is this: In my arm setup, if my arm is fully extended (such that the target is slightly beyond the reach of the model's hand) and I then rotate my hand, all the rotation seems to be absorbed by the wrist, with none of it going up to the lower arm - as such, it's hard to rotate the shield up and down. Is there a good way to allow some of this rotation to reach the lower arm as well?
     
  25. JamesK24

    JamesK24

    Joined:
    Feb 28, 2017
    Posts:
    20
    Hello guys. I am currently using hand posers and interaction target for my avatar. The avatar is holding on to a stick. During gameplay, the stick rotates infinitely according to the user interface. That causes my avatar's hands to be twisted according to the rotation of the stick and it would look like pretzels in the end.. Which component do I have to use to solve this? I've tried using rotation hinge by giving limits to the Y axis but the hands still seem to rotate all the way..
     
  26. JamesK24

    JamesK24

    Joined:
    Feb 28, 2017
    Posts:
    20
    The screenshots bellow are the situation
     

    Attached Files:

    • 12.PNG
      12.PNG
      File size:
      116.8 KB
      Views:
      828
    • 13.PNG
      13.PNG
      File size:
      106.9 KB
      Views:
      822
  27. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    Hi Partel,

    I think you missed my question re the script you provided me with not working. I posted it on the 11th with some details of the setup to ensure I'm following your instructions correctly.

    Cheers

    Mat
     
  28. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi @Partel-Lang

    I'm starting with Final IK and I've been trying to integrate the AimIK into my character to be able to target the enemies in the scene for several days. Although I have configured the parameters a thousand times, I have looked at all their video tutorials and the manual, I have not achieved the results that I would like because my character behaves strangely and unreal in certain situations.

    Thinking that I was probably doing something wrong, I tried one of their example scenes and I see that the same problems happen.

    My question is, can these problems be solved in some way, for example with "Rotation limits" or something else?
    Or is it simply not possible?

    I leave video so you can see what I mean:


    regards
     
  29. JoeTheGG

    JoeTheGG

    Joined:
    Aug 18, 2013
    Posts:
    42
    Absolutely wonderful plugin Partel, you are a genius. Messing around with your VRIK stuff and really having a great time with it.

    I am having one issue though, I am trying to parent my player prefab (which contains the VRIK as a child) to a fast moving object (airplane). When the object starts moving the all the IK pieces activate as if the player himself is "running" at the speed of the object the player is parented to.

    Is there a simple solution to let the IK system know when the movement is coming from an different object?
    (P.S. sorry if been asked before)
     
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    PuppetMaster works on any character. The setup process is easier with Humanoids though, as the bone references will be automatically assigned. BehaviourPuppet (collision handling, getting up) is designed for bipedal characters only though.

    About the arm, you can try adding a bend goal object, parent it to the controller and move it in the direction you wish for the elbow to bend. Then you can control how much rotation goes to the elbow by using the Bend Goal Weight. In the current version there is a bug with that, blending of that weight not working right, but you can fix it with this patch.

    Hey, did you try to use the limit on the bone or the stick?
    If it was the bone, you'll have to make the rotation limit apply after IK. Disable the rotation limit component and call rotationLimit.Apply() in an ik.solver.OnPostUpdate delegate:
    Code (CSharp):
    1. void Start() {
    2. rotationLimit.enabled = false;
    3. ik.solver.OnPostUpdate += AfterIK;
    4. }
    5.  
    6. void AfterIK() {
    7. rotationLimit.Apply();
    8. }
    Hey,
    It is the Pole doing this, the aiming direction and the pole direction align when you move the target right beneath the character. Get rid of the pole or move it programmatically with the target, perhaps like this:
    Code (CSharp):
    1. void LateUpdate() {
    2. ik.solver.poleTarget.position = ik.solver.transform.position + Quaternion.LookRotation(ik.solver.target.position - ik.solver.transform.position) * Vector3.up;
    3. }
    Hey and thanks! :)
    Yes, please take a look at the "VRIK (Moving Platform)" demo, there is a code sample too.

    Cheers,
    Pärtel
     
  31. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    Doh! You missed me again. You gave me a script that doesn't work as you expected. I provided details of the setup in an earlier post and I'm really curious to know what's wrong with the setup.

    Cheers
     
  32. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Hi Partel,
    I'm using VRIK in a multiplayer game and wanted to know the correct setup for my avatar.

    I originally had an issue with the avatar feet being frozen on the Y axis, so I added a Full Body IK and Grounder IK to fix the issue.

    Is that the recommended setup? Thanks.
     
  33. Jerrith

    Jerrith

    Joined:
    Sep 8, 2015
    Posts:
    6
    Updated to the latest version of Final IK and applied your patch. Still not seeing the result I'd like to, but - it may be my fault. Right now, I have a tracker on my elbow that I'm attaching to my lower arm bone, and I'm using a weight of 1. I may need to try switching that to the upper arm, or with a weight of less than one.

    Vive Trackers are shipping again, as of today, so your back ordered trackers should arrive within the next day or two. :)
     
  34. silentneedle

    silentneedle

    Joined:
    Mar 14, 2013
    Posts:
    280
    Hey Pärtel,

    I don't know if I've asked this already, but is there any way to setup hit reaction without defining every effector hit points manually?
     
  35. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    QUOTE="fup, post: 3028872, member: 1034591"]Hi Partel,

    I've tried the script and now the limbs just freely move through each other as though there were no colliders.

    I have done these steps:

    On the Enemy, setup like this:

    View attachment 226476

    I added these components to the Enemy_Puppet. Like this:

    View attachment 226477

    Dragged in the Enemy_Puppet to fill the references for 'Puppet' and 'Puppet Master'.

    Then set all the upper body pin weights in the PM component to 0.5.

    I did the same with the Hero (VRIK) character.

    All the limbs are as they were setup when adding the puppet - non kinematic[/QUOTE]

    Hey, so sorry for missing that, my apologizes!
    Does the leg crossing happen when the puppet is pinned or down on the ground?
    That script blends off mapping when there are no collisions, if the limbs start moving through each other while the puppet is pinned, I'm guessing it's from animation. If the foot crossing happens, pause the game, then select the PuppetMaster gameobject to see all the colliders. If the colliders are not crossing, then its probably needs to be fixed on the animation side.
    Also make sure "Internal Collisions" are enabled in PuppetMaster settings.

    Hey a Hinge limit does not allow for much motion for the hand, it will be able to rotate only around a single axis, so it will easily lose contact with the stick. I suggest you try RotationLimitAngle and give it a twist limit, to allow for some rotation around the other axes too.
    I'm not entirely sure I understand the problem you are facing though.. You have a golf game and a club that's rotation is controlled by user input, then you need to put the hands on the club with IK? Would it not be easier to just have a swing animation and scrub it's normalizedTime by user input, then use IK just to modify the direction or whatever?

    Hey,
    In the latest FIK there is a "VRIK (Grounder)" demo, that has been set up with VRIK, GrounderIK and 2 LimbIK components for the legs, check it out.


    What is the result you are seeing then? Perhaps you could record a video or something?
    About the shipping, not to where I live, heh.. But the good news is a friendly local VR enthusiast borrowed me his trackers, so I can give it a try now..

    Hey,
    I don't have a good solution for this at the moment, sorry. The easiest would probably be to use a prefab of the HitReaction component, then make a script that just goes through all the HitPoints and assigns their colliders, as they are the only things in there specific to the character. Oh, also the bones in "Bone Hit Points".

    Best,
    Pärtel
     
    silentneedle likes this.
  36. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    695
    Hi thanks for the reply

    I have tried the code that he told me and the problem gets worse . It is true that taking the pole seems to be solved.

    You who have more experience in your asset ... If the Pole generates these types of problems, why use it?

    For what practical cases can the pool serve, if it generates so much problem?

    regards
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    The pole is used for orienting another axis of the Aim Transform at another target. It could be useful for instance if you needed to adjust the left/right bending of the spine when aiming forward. But of course you don't need to use it at all in most cases. In FIK it is used only in one demo that is specifically about the pole.
     
    ftejada likes this.
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hi all, I made a quick test run for VRIK with Vive trackers.

    It is just the initial test, didn't pay much attention to the accuracy of matching the tracker targets to my feet and body, but it works. Basically just added VRIK, set locomotion weight to 0, created head, pelvis, hand and foot targets, parented them to the trackers, adjusted their localPosition/Rotation to roughly match my real self. Set Pelvis Position Weight and Pelvis Rotation Weight to 1, same for the feet. Also parented bend goals to the foot anchors and set bend goal weight to 0.5 for the legs so the knees would bend more with turning the feet. Also, the root of the character needs to be parented to the pelvis tracker.

    Cheers,
    Pärtel
     
    tapawafo likes this.
  39. zeb33

    zeb33

    Joined:
    Nov 17, 2014
    Posts:
    95
    I can't find the correct rotation on hands for finalik with leap motion, any ideas?
     

    Attached Files:

  40. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    I'm working with Biped Ik and VRIK Rigs, and trying to figure out how to set joint rotation limits. For example on the shoulder, the arm shouldn't be able to bend backwards, and the rotation of the arm/wrist should be limited to make sure impossible body positions are not done on the avatar.

    I watched:


    But i don't see how to do that on full character rigs.
     
  41. FiveFingerStudios

    FiveFingerStudios

    Joined:
    Apr 22, 2016
    Posts:
    510
    Patel,
    Thanks for the quick reply. Just a general question. Do you think its would make sense to use walking and running animations in combination with VRIK (does VRIK allow blending?) to get the avatars to move a bit more natural?
     
  42. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    @sbmhome I've been thinking the same thing lately
     
  43. MaskedGibbon

    MaskedGibbon

    Joined:
    Mar 26, 2016
    Posts:
    10
    I'm sure this has probably been asked before, but the search feature on this forum doesn't seem to be up to the challenge... so, what would be the best way to enhance my melee animations (swinging punches/swipes/etc) to ensure that they hit the target? i.e, ensure they're aimed at the target, and also extend/retract their reach to an extent when necessary.

    I've been playing with fbikboxing (animation warping, amplifier and effector offset), but it seems pretty challenging to say the least.

    Fbikboxing just about does the trick, but because they are mostly swinging attack animations it can look a little janky when stretching to hit the target (though since I'm modifying the flow of the animation at runtime that's probably unavoidable?).

    Btw, great asset (just a bit overwhelming with all the options).
     
  44. DerekMcKinley

    DerekMcKinley

    Joined:
    Jun 24, 2014
    Posts:
    19
    Hi
    I wonder if there is any way to smooth out the animations, I mean something like automatic cleanup like this program does.


    Basically it is to control the speed with which the change of animation is executed and I think that adjusting some parameter in FBIK would be the solution, but I have no idea how I can do this.
     
    Last edited: Apr 30, 2019
  45. Jerrith

    Jerrith

    Joined:
    Sep 8, 2015
    Posts:
    6
    Here's a quick and dirty video of what I'm seeing with the arm.



    Basically, all the hand rotation (specifically, the twist) is being absorbed at the wrist, while I'd like to see some of it move up to the forearm, which would cause the shield to rotate up and down. (You can't twist your wrist like that in real life. :) )

    You can see my VRIK component configuration here: http://jerrith.com/images/vrik.png (old version, but nothing has changed significantly since I updated to the latest.)

    Oh, and sorry to hear you can't get Trackers in your area. :( That's really unfortunate.
     
  46. rotsin

    rotsin

    Joined:
    Feb 22, 2013
    Posts:
    15
    Hi Partel,

    I've written a support mail but didn't hear anything back and I figured I could maybe try my luck in here. My issue is related to Aim IK, the question is, how could I control the speed at which the bones rotate towards the target. Currently, when changing targets or when moving targets very fast, they immediately rotate towards the target. I've been trying to interpolate their rotation targets, but that doesn't really seem to work.
     
  47. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Try with this updated version of VRIKLeapMotion, it uses axes instead of those rotation offsets. I don't have a demo for it yet though, sorry, there are tooltips though. Parent a new empty gameobject to the leap hand models and assign them as hand targets.

    Hey,
    As for now rotations can be limited using the rotation limit components in the package. But they'll have to be updated after VRIK, meaning disabled them at Start and then call rotationLimit.Apply() in a vrik.solver.OnPostUpdate delegate.

    Code (CSharp):
    1. public RotationLimit[] limits;
    2. public VRIK ik;
    3.  
    4. void Start() {
    5. foreach (RotationLimit limit in limits) {
    6. limit.enabled = false;
    7. }
    8.  
    9. ik.solver.OnPostUpdate += AfterIK;
    10. }
    11.  
    12. void AfterIK() {
    13. foreach (RotationLimit limit in limits) {
    14. limit.Apply();
    15. }
    16. }
    17.  
    18.  
    Hey,
    Yes, just set locomotion weight to 0, then you'll be able to use any animation on the legs.

    Hey,
    For swinging animations it is best to use AimIK, please take a look at the "Aim Swing" demo.

    Hey,
    Don't have a solution for that, but play around with keyframe reduction/compression params in the animation import settings, they might help you smooth it out a bit.

    Hey, have you tried using the TwistRelaxer component? Take a look at the "VRIK (Twist Relaxers)" demo. If you don't have twist bones in the arms, the component can also be used on the forearms.

    Hey,
    I got your e-mail, its just under a pile of other support requests received over the weekend, was just about to get to that :)

    Anyway, you could use a script like that:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.FinalIK;
    4.  
    5. public class AimIKSmoothing : MonoBehaviour {
    6.  
    7.     public AimIK ik;
    8.     public float maxDegreesDelta = 50f;
    9.  
    10.     private Quaternion[] localRotations = new Quaternion[0];
    11.  
    12.     void Start() {
    13.         ik.solver.OnPostUpdate += AfterIK;
    14.  
    15.         localRotations = new Quaternion[ik.solver.bones.Length];
    16.  
    17.         for (int i = 0; i < localRotations.Length; i++) {
    18.             localRotations[i] = ik.solver.bones[i].transform.localRotation;
    19.         }
    20.     }
    21.  
    22.     void AfterIK() {
    23.         for (int i = 0; i < localRotations.Length; i++) {
    24.             ik.solver.bones[i].transform.localRotation = Quaternion.RotateTowards(localRotations[i], ik.solver.bones[i].transform.localRotation, Time.deltaTime * maxDegreesDelta);
    25.  
    26.             localRotations[i] = ik.solver.bones[i].transform.localRotation;
    27.         }
    28.     }
    29. }
    30.  
    You can try with Quaternion.Slerp instead of RotateTowards for a different kind of interpolation.

    Cheers,
    Pärtel
     
  48. Jerrith

    Jerrith

    Joined:
    Sep 8, 2015
    Posts:
    6
    I should have known you would have anticipated this and had a solution already. :) That works *perfectly*, and does exactly what I'm trying to do. Thank you!
     
    Partel-Lang likes this.
  49. probitaille

    probitaille

    Joined:
    May 5, 2015
    Posts:
    34
    Hey! I just received 3 Vive trackers and I actually can use 2 of them to track my feet.

    I was wondering if is there a way to add a new solver for the third Vive tracker. I want to bind it with the pelvis.

    Thank you for your response.

    EDIT: Hey, I just saw that there is a pelvis target under head target in the VRIK inspector. So, I guess it's the solver I was looking for.
     
    Last edited: Apr 25, 2017
  50. ryancampfire

    ryancampfire

    Joined:
    Jan 4, 2017
    Posts:
    31