Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    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. awardell

    awardell

    Joined:
    Feb 5, 2014
    Posts:
    53
    This worked great. Thanks!
     
  2. Dynablaster

    Dynablaster

    Joined:
    Feb 28, 2014
    Posts:
    7
    Hi Partel, I am having a bit of an issue... Its with Aim IK. I use it to aim with a character, so I have all the poses set up for forward, back, left, etc. and I have those same poses for firing on a next layer which overrides the aiming layer once character is firing but I failed to realize that since my animation is modifying the hand transform(which is aim target) that makes the spine of the character move(because its in the IK chain) when I only need the the parts I animated for the firing animation(the arms) to move... I guess there is no way around this?
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    There is... Try using the AimController (check out the "Aim Controller" demo). If you enable "Use Animated Aim Direction", it will make AimIK work in additive mode, allowing you to maintain all your recoil, reload, equipping and other animations. If the aiming becomes inaccurate, that means the character is not aiming exactly forward in the animation and you'll have to tweak the value of "Animated Aim Direction" to fix it. Also if you are switching to aim right pose, you'll have to slerp that vector to (1, 0, 0).

    Best,
    Pärtel
     
  4. Dynablaster

    Dynablaster

    Joined:
    Feb 28, 2014
    Posts:
    7
    Hi, yeah I scavenged this thread and found someone asking you the same thing and he also said he just couldnt get it to work and I cant too. I looked at the Aim Controller demo and I added the firing animation layer to it and my animations and they work, I make the character walk forward using root motion and move away the aim target and then I trigger fire and its really working but when I try to do the same with my character then its not working or half working so to speak. When the character is standing I can move around and aim and trigger fire animation on top of IK and its working but when I start moving the whole upper body starts too which is not what happens when its strictly AimIK without the Use Animated Aim Direction. I just cant replicate what happens in the demo. I suspect its the AimTransform, in your demo its in the MP40 weapon but I just put it straight as child of hand transform. Does this matter? Thats the only real difference that I see between your demo and my setup since they are both using identical animator controller and animations.

    Yeah I thought its something like this I wanted to first try figure it out on my own I learn more that way. I will try to do this when I first resolve the main issue. Thanks for the tip!

    // Offset mode
    if (useAnimatedAimDirection)
    {
    aim.solver.axis = aim.solver.transform.InverseTransformVector(aim.transform.rotation * animatedAimDirection);
    }

    Also you said to use this line only if you dont want Aim Controller. I used SimpleAimingSystem in my original setup so if I manage to get it to work with Aim Controller I would like to still use SimpleAimingSystem script since it has poses setup. So I just put this line at the end of the LateUpdate or before the aim.solver.Update()?

    I am sorry I am bothering you with so many questions I just really want to make this work... Thanks again!
     
  5. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    607
    Hello, I've tried searching the thread but couldn't find so please accept my apologies if question has been asked before.

    What would be the way to use FinalIK to point to a specific location/orientation an object held in right or left hand in a skinned mesh hierarchy (==> imagine touching something with the tip of a harry potter wand, but held item could be any shape and require a specific orientation).

    Tried a bunch of combinations, best i've got was to use a CCD IK on right arm with a fake bone at tip of item, but i can't control the orientation of the item so it get rotated however it feels like.
     
    Last edited: Apr 13, 2021
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    Sounds like you are using an upper body masked layer for aiming on top of locomotion on the base animation layer?
    The upper body usually starts to sway left-right when you walk because the static aiming pose on the upper body layer masks out spine motion from the locomotion clip. Could bake aiming into the locomotion animation, then use the second layer with a mask enabled only for the arms to do all the recoil and reloading stuff.

    Yes, can add those lines into SimpleAimingSystem. Actually make a copy of that so your work would not go missing the next time you update FIK.

    Hey,

    Basically you'd want to calculate hand position and rotation relative to the tip of the wand (add a new child gameobject to the end of the wand).

    Code (CSharp):
    1. private void LateUpdate()
    2.     {
    3.         Quaternion toWandSpace = Quaternion.Inverse(wandTip.rotation);
    4.         Vector3 handRelPos = toWandSpace * (ik.solver.rightHandEffector.bone.position - wandTip.position);
    5.         Quaternion handRelRot = toWandSpace * ik.solver.rightHandEffector.bone.rotation;
    6.  
    7.         Quaternion targetRot = target.rotation;
    8.         ik.solver.rightHandEffector.position = target.position + targetRot * handRelPos;
    9.         ik.solver.rightHandEffector.rotation = targetRot * handRelRot;
    10.     }
    Alternately, if you prefer mouse clicks over writing code, you could just duplicate the hand hierarchy with the wand in hand, assign the duplicated hand as the IK target. Parent the duplicated hierarchy to a gameobject at the tip of the wand and use the whole thing as your IK target.

    Best,
    Pärtel
     
    _met44 likes this.
  7. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    607
    Haaa ok so i have to use the FBBIK for this, I saw example codes with the effector but couldnt find it before... Just now it occured it was an option only for FBB.

    Thanks a lot for the help. Good Job on the amazing plugin btw ;)
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Thanks!
    But you don't necessarily need FBBIK for this, can do with LimbIK too for example.
    Instead of ik.solver.rightHandEffector.position/rotation you'd write ik.solver.IKPosition/IKRotation.
     
    _met44 likes this.
  9. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    607
    Oh ok thanks for clarifying, will be very helpful !
     
  10. billnguyenme

    billnguyenme

    Joined:
    Dec 5, 2020
    Posts:
    92
    Update: Found it, I had create a transform called lefthand target and change the value of maintain rotation to 0 in second hand IK!

    I'm currently having an issue where the animation blending is causing the second hand to lose grip/contact with the weapon. For example, I have an idle animation called "Not Aim" and another one called "Aim". It's using a float Parameter called Aim. I use this parameter to blend in Final IK weights as well.

    I was wondering if FinalIK is able to deal with this issue, basically maintain the second hand on the weapon at all times. I'm currently using the systems incorporated in the Second Hand on Weapon demo along with LookAt and AnimationController functions in final IK.

    If there is any documentation or examples on dealing with maintaining limb contact during mecanim transitions any help would be much appreciated. I also have puppetmaster if that's needed for this case. Thank you!
     
    Last edited: Apr 19, 2021
  11. stepkka

    stepkka

    Joined:
    Apr 5, 2017
    Posts:
    4
    Hello! I'm trying to set up some custom poses for my character in Editor, but EditorIK script does not seem to work. I put Dummy from Final IK samples on the scene, add VRIK and EditorIK scripts, set Head, Pelvis, Right hand, Left hand targets, but the character is still in the initial pose.. When I press Play it sets the pose.

    Edit: Unity 2020.1.16
     
    Last edited: Apr 19, 2021
  12. TyI3orG

    TyI3orG

    Joined:
    Mar 22, 2021
    Posts:
    6
    Hello, I am using VRIK with a character and want him to be able to sit on a chair, similar to the Interaction Trigger scene which uses FBBIK. Is there anyway to get the type of fluid motion using VRIK? For clarification I want the upper body to still be controlled by VRIK, but the lower body to be overridden to sit on the chair, like the Interaction Trigger scene where the pilot can sit on the bench. I have plant feet on, so my plan is to have the character sit in the chair and then use a custom adjust height script to adjust the XR rig to the sitting head height.
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey, sorry for the delay guys, was on a little vacation last week.

    Hey,

    Could do this:
    1. Play the scene, pause the game while the character is playing the "Aim" animation.
    2. copy the character
    3. stop play mode
    4. paste the character into the scene
    5. parent the second hand bone of the pasted character to the pasted gun
    6. parent the pasted gun to the original gun, set localPos/Rot to zero
    7. parent the pasted second hand bone to the original gun, nuke the rest of the pasted rig
    8. use the pasted second hand bone as the IK target. While you have position and rotation weights at 1, it will remain locked to it regardless of animation.

    Hey,
    Are you using the latest FIK? The EditorIK component was redesigned. You'll have to add EditorIK, create an EditorIKPose asset (Create/Final IK/Editor IK Pose), assign it to EditorIK, click on "Store Default Pose" and then "Start Solver".

    Hey,
    There's a seated VRIK example in the "VRTIK (Basic)" demo scene, have you tried setting it up like that?

    Best,
    Pärtel
     
    PixelFireXY likes this.
  14. PixelFireXY

    PixelFireXY

    Joined:
    Nov 2, 2011
    Posts:
    36
    Hello Pärtel, thank you for this amazing plugin!

    Atm I need to bake animations with the keyframe reduction and everything works fine if the animation is not too long.

    But because I have used motion capture and the animation is very long, when I save the baked version Unity freeze and most of the time crash.

    I don't have so much experience in AnimationCurve, Keyframe, and something like that... How/where can I edit the code to split the baked clip into smaller animations? I tried to edit the methods GetReducedKeyframes or SetCurves but I really cannot understand how it works.

    Thanks!
    Matt
     
  15. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey, how long are those animations approximately?
     
  16. PixelFireXY

    PixelFireXY

    Joined:
    Nov 2, 2011
    Posts:
    36
    More than one minute (some 5-10 minutes).

    I also need to split it because 5-10 minutes of animation is really heavy.
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Looks like it's public static Keyframe[] GetReducedKeyframes() in BakerUnitilities.cs that causes this long processing time.
    I tried baking a 5 minute clip and it took another 4 mins or so to process it.

    Were you recording the mocap in Unity with Baker or using an external mocap application and using Baker to reprocess those fbx clips?

    If it's recording in Unity, can't you make a button to start and stop the baker in smaller segments when you need it? Like if you're recording a list of actions, you could press a button to restart baking after every action. Or do you need the recording to be continuous?

    If it's externally recorded fbx, then can use Unity animation import settings to cut it up to smaller pieces.

    Best,
    Pärtel
     
  18. PixelFireXY

    PixelFireXY

    Joined:
    Nov 2, 2011
    Posts:
    36
    Thank you for your answer, the animation is imported in unity and then baked. So based on your answer I found this script: http://wiki.unity3d.com/index.php?title=FbxAnimListPostprocessor&oldid=12944 to easily split big animations into smaller ones.
    Also, I optimized a bit your code to make the bake smoother (I had to use coroutines because AnimationClip can be only in the main thread and cannot be used in Tasks...)

    Code (CSharp):
    1. protected override void OnSetCurves(ref AnimationClip clip)
    2.         {
    3.             ReferenceClass<AnimationClip> referenceClip = new ReferenceClass<AnimationClip>(clip);
    4.  
    5.             StartCoroutine(OnSetCurvesAsync(referenceClip));
    6.         }
    7.  
    8.         private IEnumerator OnSetCurvesAsync(ReferenceClass<AnimationClip> referenceClip)
    9.         {
    10.             AnimationClip clip = referenceClip.Value;
    11.  
    12.             float length = bakerMuscles[0].curve.keys[bakerMuscles[0].curve.keys.Length - 1].time;
    13.             float lengthMlp = mode != Mode.Realtime ? clipLength / length : 1f;
    14.  
    15.             var musclesAmount = bakerMuscles.Length;
    16.             var totalAmount = musclesAmount + (bakeHandIK ? amountWithbakeHandIK : amountWithoutbakeHandIK);
    17.  
    18.             int i;
    19.             for (i = 0; i < musclesAmount; i++)
    20.             {
    21.                 yield return null;
    22.  
    23.                 bakerMuscles[i].SetCurves(ref clip, keyReductionError, lengthMlp);
    24.  
    25.                 UpdatePercentageText(i, totalAmount);
    26.             }
    27.  
    28.             yield return null;
    29.             UpdatePercentageText(i, totalAmount);
    30.  
    31.             rootQT.SetCurves(ref clip, IKKeyReductionError, lengthMlp);
    32.  
    33.             UpdatePercentageText(++i, totalAmount);
    34.             yield return null;
    35.  
    36.             leftFootQT.SetCurves(ref clip, IKKeyReductionError, lengthMlp);
    37.  
    38.             UpdatePercentageText(++i, totalAmount);
    39.             yield return null;
    40.  
    41.             rightFootQT.SetCurves(ref clip, IKKeyReductionError, lengthMlp);
    42.  
    43.             UpdatePercentageText(++i, totalAmount);
    44.             yield return null;
    45.  
    46.             if (bakeHandIK)
    47.             {
    48.                 leftHandQT.SetCurves(ref clip, IKKeyReductionError, lengthMlp);
    49.  
    50.                 UpdatePercentageText(i, totalAmount);
    51.                 yield return null;
    52.  
    53.                 rightHandQT.SetCurves(ref clip, IKKeyReductionError, lengthMlp);
    54.                 yield return null;
    55.             }
    56.  
    57.             UpdatePercentageText("Saving complete!");
    58.  
    59.             yield return new WaitForSeconds(timeBeforeClearUIText);
    60.  
    61.             UpdatePercentageText(string.Empty);
    62.         }
    63.  
    64.         /// <summary>
    65.         /// Calculate the percentage and update the UI text.
    66.         /// </summary>
    67.         /// <param name="currentItemIndex">The current position in the app progress.</param>
    68.         /// <param name="totalAmount">The total amount of work.</param>
    69.         private void UpdatePercentageText(int currentItemIndex, int totalAmount)
    70.         {
    71.             if (percentageText != null)
    72.             {
    73.                 int percentageComplete = (currentItemIndex * 100) / totalAmount;
    74.  
    75.                 percentageText.text = $"Saving bake: {percentageComplete}%";
    76.             }
    77.         }
    78.  
    79.         /// <summary>
    80.         /// Update the UI text with custom string.
    81.         /// </summary>
    82.         /// <param name="text">The new text of the UI text.</param>
    83.         private void UpdatePercentageText(string text)
    84.         {
    85.             if (percentageText != null)
    86.                 percentageText.text = text;
    87.         }
    I created a class called ReferenceClass because you cannot use the ref parameter in coroutines:

    Code (CSharp):
    1. public class ReferenceClass<T> : MonoBehaviour
    2. {
    3.     private T backing;
    4.     public T Value { get { return backing; } set { backing = value; } }
    5.     public ReferenceClass(T reference)
    6.     {
    7.         backing = reference;
    8.     }
    9. }
    This seems to work like a charm, it's a good compromise for me. Also if you have a UI text you can also see the progress while saving.

    Thanks
    Matt
     
    Last edited: Apr 26, 2021
  19. PixelFireXY

    PixelFireXY

    Joined:
    Nov 2, 2011
    Posts:
    36
    One more thing, if I want to record the animation with the mocap using the real-time baker and have a continuous animation but split into smaller parts (for example every one second add what you just recorded to a list and when the record is stopped save all the small clips => 10 min of animation = 10 smaller clips) what part of the code should I edit/look for?
    Thanks again
     
    Last edited: Apr 26, 2021
  20. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    178
    Just purchased this asset and have a few questions:

    Is there a tutorial on setting up VRIK for t-pose character model?
    Seems most characters come in t-pose. Would be awesome to have the example in t-pose to make things easier :)

    Is there a tutorial on setting up the t-pose character model hands to work with Oculus Avatar hands?
    I know this isn't necessarily part of this asset, but am hoping someone here will point me in the right direction. I would like to use custom hand animations from the t-pose character model instead of detached Oculus Avatar hands

    Amazing asset! Thanks!
     
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    Thanks for sharing a solution, I'll check it out.. :)

    To make small clips, can't you just stop and restart the baker? Change the "Save Name" every time so it would not overwrite.

    Hey, thanks for the purchase!

    For perfectly T-posed character, just rotate all limbs 1 degree in their natural bending direction.
    Can do this from script in Start too, set elbow/knee bone localRotations to (0, 0, 1). Which axis you give the 1 degree depends on bone orientations of course.

    I'm sorry I don't have a tool for setting up Oculus Avatar hands.

    Best,
    Pärtel
     
    Proto-G likes this.
  22. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    178
    No worries, thanks for the reply.

    So I got it working well, but I have a few questions...

    1) When I look down (rotate camera) it raises my avatar body into air. I'm using a short avatar, so how would I fix this?
    2) The hands don't keep the position of the avatar hands. For instance, when fully reached out, they might align perfectly with the avatar hands position, but when reaching in towards torso they are more aligned at the position of the wrist or vice versa. I would like to keep them aligned 1/1 with the avatar hands and just have the wrist/arms adjust accordingly.

    Thanks!
     
  23. Fariborzzn

    Fariborzzn

    Joined:
    Apr 17, 2019
    Posts:
    5
    Hey Pärtel,
    First let me explain my game to you.
    My Game has top down view and I'm trying to make player aim at specific point base on ray casting.
    I'm using Aim Controller script and Aim Ik component to do the job . the aim controller script has 1 method called SetTarget that will get a transform for aiming . my problem is that from ray casting to plane I have point (vector3) not transform . so I came up to solution but I don't like it and I think its just a hack around it because the aim controller script will have no effect in final result. I will give aim controller a static target then just set this target position base on desire point(position base on ray casting). is there any way to implement my own SetTarget method in aim controller script to solve the aim base on vector3?
    thanks for your amazing asset and all the hard work.
     
  24. Michal_Stangel

    Michal_Stangel

    Joined:
    Apr 17, 2017
    Posts:
    92
    Hello Pärtel,

    Is there a way to set Grounder IK to prevent legs try to ground to the roof if roof is quite close (as you can see on screenshot)? And during moving animation it grounds both legs to the roof for a brief moment.

    All geometry around character is on Default layer, which is set in Solver. But I'am wondering if there is some other way instead of changing layers on large amount of objects.
     

    Attached Files:

  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    1) Reducing Neck Stiffness and Body Rot Stiffness in Spine settings helps a bit with that. Also if you can, move the head IK target a bit closer to the camera, that would lift it less when you rotate down,

    2) I'm sorry I dont think I understand... VRIK solves the hands with 100% accuracy when the IK targets are within reach, can't think of anything that could cause them to align differently in different positions. Sure your hand position and rotation weights are 1?

    Hey,
    Just replied to your support ticket.

    Hey,
    Grounder raycasts from foot position + Vector3.up * maxStep to foot.position + Vector3.down * maxStep. So you probably have a very high value for "Max Step".

    Best,
    Pärtel
     
  26. Michal_Stangel

    Michal_Stangel

    Joined:
    Apr 17, 2017
    Posts:
    92
    You are right, for some unknown reason, I had step = 3 :)
    Thanks.
     
  27. TyI3orG

    TyI3orG

    Joined:
    Mar 22, 2021
    Posts:
    6
    Hi I am having issues using VRIK on my character when I am trying to set finger bends. I believe VRIK is overriding the finger rotations after I have set them in other code. Is there a way to turn off VRIK's effect on the bones under the hands (the fingers)?
     
  28. NoPanDa

    NoPanDa

    Joined:
    Jan 18, 2020
    Posts:
    2
    You are making a great tool here, and I love your plans for expanding it. One of the most important features for me would be the "FinalDirector" to Timeline. How is it coming along? From what I have seen it would be a game changer, and it's the main reason for why I bought this product (I did not know it was not fully released yet) ;)

    What I would need most with the FinalDirector is really just added support for LookAtIK and maybe so that the green nodes for the targets shift color depending on how far into the clip they are, or something along those lines. If that was added, I feel like I would be able to make any cutscene I want =)
     
    Last edited: May 15, 2021
  29. NoPanDa

    NoPanDa

    Joined:
    Jan 18, 2020
    Posts:
    2
    Ok, it took quite some time, but I fixed it! :D Used your base and made a LookAtIK implementation for Timeline =) Can animate the weights, the target position and get a nice looking curve to indicate the position over time.

    I really love what you put together here! =)
     
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    VRIK doesn't do anything with the fingers, it doesn't even have access to the finger bones (not included in VRIK's *References*). The problem is probably with the update order of things. Make sure your finger calculations are done after VRIK has solved for the frame. Use LateUpdate of a script with a higher Script Execution Order value than VRIK has or use the ik.solver.OnPostUpdate delegate.

    Hey,
    Thanks, but I've been too busy with other parts of FIK and PM lately to advance Final Director, sorry, but glad you already figured out your own implementation.

    Cheers,
    Pärtel
     
  31. seanybaby2

    seanybaby2

    Joined:
    May 17, 2013
    Posts:
    120
    Any plans to add ECS (Multi-Threading optimizations) I've noticed VRIK gets pretty heavy when you have several users. Even 1 user can hog up around .5MS - 1MS on a mid range PC with high settings.
     
  32. wtetotew

    wtetotew

    Joined:
    Apr 12, 2020
    Posts:
    46
    Hi!
    Just tried Final IK and find it very cool.

    Is it possible to use the transform tool to move body joint?
    I want to be able to move and rotate at the same time, avoiding to change tool in between each action.

    it looks like it works sometimes but only with the body.

    Is there an easy way to move and rotate all those body parts and record poses?
     
    Last edited: May 18, 2021
  33. VR_Junkie

    VR_Junkie

    Joined:
    Nov 26, 2016
    Posts:
    38
    Hello is there any way to control a body from far away using VRIK? By that I mean I want my xr rig to be normal size but the body to be huge and about 100meters away. I want to be able to reach out and have the body do the exact same (like its copying you). I would like for the body to only do what my hands do so if I turn around the giant body doesn't turn around but if I move my hands behind my back the giant body moves his hands behind his back as well (despite us having different forward directions).
     
    Last edited: May 19, 2021
  34. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    178
    I'm using VRIK and VRTK. Is there a good solution for applying gravity to the VRIK avatar so you're able to drop from heights to different floor levels, teleport to different heights and such? Thanks.
     
  35. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    I think you might have profiled with Deep Profile enabled, which shows largely inflated numbers due to profiling cost.
    Normally VRIK should take around 0.1 ms.

    About multi-threading, animation and especially IK are terrible candidates for multi-threading by nature because they need to work on hierarchical data structures and be solved in specific linear order. I have made multiple test cases (AimIKJ and CCDIKJ solvers based on Animation Jobs, also the same using Animation Rigging framework), but they are all much slower than their old single-threaded counterparts, even if used on 100 or more characters.

    Btw, VRIK has the ik.solver.LOD parameter, so make sure to use that. Set LOD to 1 for the ones far from the player and 2 for the culled ones.

    Hey,
    Did you mean you needed to create those poses in editor (scene view) or in game (game view)?
    If in game view, this package has an example to get you started with.
    In scene view, you probably know this, but W and E are the hotkeys to quickly switch between move and rotate tools in Unity.
    Not sure how one could move and rotate at the same time, would have to write a custom tool handle for that in editor code.

    Hey,
    Yeah, you would have to create a hierarchy of gameobjects identical to your camera rig. Then add this code to each gameobject:

    Code (CSharp):
    1. public Transform target;
    2. void LateUpdate() {
    3.     transform.localPosition = target.localPosition;
    4.     transform.localRotation = target.localRotation;
    5. }
    Target is each gameobject's counterpart in the real camera rig hierarchy.
    Parent the IK targets to that new hierarchy too.
    Then you will be able to change position, rotation and scale of the root of that new hierarchy.

    Hey,
    Yes, you'll need a character controller or a rigidbody/capsule collider for that. Can set it up like in the "VRIK (Grounder)" demo.

    Best,
    Pärtel
     
    Proto-G and VR_Junkie like this.
  36. giraffe1

    giraffe1

    Joined:
    Nov 1, 2014
    Posts:
    232
    Hi,

    I am using the AimIK Component on my NPC to aim a rifle. Is there is any built in functionality to find out how much aimik has offset the spine/rifle in the z and y axis?

    Or do I just compare the angle between the forward vector of rifle (aim transform) to the forward vector of the character and find it out that way?

    I have some animations like throw grenade, etc that look best when the spine is not twisted/modified too much by aimik so that is the reason I want to find a way to check how much the rifle is offset (w/ aimik) compared to the idle stance before using those animations.

    Thanks,

    *** EDIT ***

    My solution in the meantime is to subscribe to the pre-update and post-update events. Record forward vector in the pre-update and compare it to the forward vector in the post update. Seems to work. Does this look alright to you?
    Code (CSharp):
    1. void BeforeAimIK()
    2.     {
    3.         // Record forward Vector before Aim IK changes it
    4.         forwardBeforeIK = agent.gun.aim.forward;
    5.     }
    6.  
    7.     void AfterAimIK()
    8.     {
    9.         // Forward vector after Aim IK changes it
    10.         Vector3 forwardAfterIK = agent.gun.aim.forward;
    11.  
    12.         Vector3 projectionA = Vector3.ProjectOnPlane(forwardBeforeIK, Vector3.up);
    13.         Vector3 projectionB = Vector3.ProjectOnPlane(forwardAfterIK, Vector3.up);
    14.         float horizontalAngle = Vector3.SignedAngle(projectionA, projectionB, Vector3.up);
    15.  
    16.         projectionA = Vector3.ProjectOnPlane(forwardBeforeIK, Vector3.left);
    17.         projectionB = Vector3.ProjectOnPlane(forwardAfterIK, Vector3.left);
    18.         float verticleAngle = Vector3.SignedAngle(projectionA, projectionB, Vector3.left);
    19.     }
     
    Last edited: May 23, 2021
  37. Proto-G

    Proto-G

    Joined:
    Nov 22, 2014
    Posts:
    178
    I ended up finding your VRTK Interaction System demo scene in a forum thread. I finally got everything working with VRTK, VRIK and VRIK Grounder. With the Grounder, I finally figured out that the MaxStep needs to be set higher in order for VRIK Grounder to function above a certain height. But I have a few issues and curious if you can assist.

    1) I'd still like to be able to use the VRIKAvatarScaleCalibrationOculus for player avatar scaling according to their height. I've experimented, but am not able to figure out a good solution for this, as the VR Anchors can't be children of the avatar root (head, left hand, right hand) or the OculusRig (centereye, lefthand, righthand anchor) or it breaks. Do you know a solution to this?

    2) When I'm using the original Pilot character that comes with the demo scene, the Pilot mesh stay visible 100% of the time. But when replacing the Pilot with my custom character, the character mesh becomes invisible at times. It's based on the camera direction, because I can look down and see my character and and slowly look up and it disappears, as if there's some sort of thresh hold...

    Thanks.
     
    Last edited: May 24, 2021
  38. wtetotew

    wtetotew

    Joined:
    Apr 12, 2020
    Posts:
    46
    Hi.
    Using fullBody biped IK component, I've set a gameobject as target for the for the Right hand to create a animation toward that target.

    But it seems I can't record the WEIGHT parameter from the inspector to the animation windows?
    How to record the animation ?
     
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    Looks legit :)

    Hey,

    1. To calibrate to player height, just have to divide avatar height by player height and multiply avatar localScale by the result. Normally it's done like this:

    Code (CSharp):
    1. float sizeF = (ik.solver.spine.headTarget.position.y - ik.references.root.position.y) / (ik.references.head.position.y - ik.references.root.position.y);
    2. ik.references.root.localScale *= sizeF;
    2. Will have to enable "Update When Offscreen" for the SkinnedMeshRenderer, because IK can pull the avatar out of it's renderer's bounds and sadly Unity won't allow those to be updated after IK.

    Unity can't animate properties in aggregated classes like that. You'll need to write a little wrapper for it:

    Code (CSharp):
    1. public class FBBIKAnimation: MonoBehaviour {
    2.  
    3. public FullBodyBipedIK ik;
    4. [Range(0f, 1f)] public float rightHandPositionWeight;
    5. [Range(0f, 1f)] public float rightHandRotationWeight;
    6.  
    7. void LateUpdate() {
    8.     ik.solver.rightHandEffector.positionWeight = rightHandPositionWeight;
    9.     ik.solver.rightHandEffector.rotationWeight = rightHandRotationWeight;
    10. }
    11.  
    12. }
    Then you'll be able to animate rightHandPositionWeight and rightHandRotationWeight.

    Best,
    Pärtel
     
  40. UniversalGesture

    UniversalGesture

    Joined:
    May 29, 2017
    Posts:
    125
    My vr character's feet don't always match the ground height. How can I set a target for the ground height? The target would preferably be an empty object at the bottom of my vr rig's capsule collider.

    Thanks!
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    Please check out the "VRIK (Grounder)" demo scene about that.

    Best,
    Pärtel
     
  42. takuyacebok

    takuyacebok

    Joined:
    Jun 12, 2021
    Posts:
    3
    Hi, I have built a thumbstick locomotion for my character and am trying to integrate it with VRIK. The issue is exactly the same here:


    I made a script that sets the locomotion weight to 0 when any thumbstick input is received, and sets the weight back to 0 when there is no more input. However, it seems like whenever the weight is reactivated, it takes the position data when it was last active, and proceeds to re-animate between the two positions.
     
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    Make sure to call ik.solver.Reset() whenever you change locomotion weight from 0 to 1.

    Best,
    Pärtel
     
    takuyacebok likes this.
  44. Crossway

    Crossway

    Joined:
    May 24, 2016
    Posts:
    450
    Hey man, I still have that root motion issue when I use final ik character controller script. The problem is I can't play any animation with root motion on my character anymore! Like climbing a rock, Is that possible to disable root motion which controlled by character controller and enable it again? (Because I see a "Handled by Script" massage on my animator controller)

    I disabled "character third person script" and "Character Animator Third Person Ik script" but it didn't help.
     
    Last edited: Jun 23, 2021
  45. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,152
    Hi Partel,

    Would it be possible to ask for your advice regarding the following.
    I am using your spidermech demo, I had to scale it down a little, now sometimes the legs go quite straight, they do not bend correctly when waking, see screenshot:

    upload_2021-6-24_22-38-32.png

    If I scale the prefab, do I need to scale other values? If yes, which ones?
     
  46. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    85
    Hi Partel,

    How can I turn off VRIK locomotion temporarely when the player is running so I can play running animations instead for the legs and turn it back on when player is not running anymore?

    If I set locomotion weight to 0, then the players feet get stuck on the floor.

    Many thanks,
    Gabriel.
     
  47. ml785

    ml785

    Joined:
    Dec 20, 2018
    Posts:
    45
    Hi,
    Are there any examples/demos available of a Climbing system that utilizes Final IK?
    Thanks!
     
  48. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    85
    If possible, one for locomotion animation using VRIK as well =)
     
  49. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,304
    Hey,
    Please get this update. Added CharacterThirdPerson.fullRootMotion, enable that while playing animations with vertical root motion such as climbing.

    Hey,
    MechSpider.cs has the "Scale" variable. So if you scale down the spider by 50%, set scale to 0.5;

    Hey,
    There's this example package for VRIK animated locomotion. If you set locomotion.weight to 0 and the feet are stuck on ground, that means there's no locomotion animation playing probably also make sure foot position/rotation weights are 0. Another thing, before you reset locomotion.weight to 1, call ik.solver.Reset(); to make the procedural footsteps catch up with the animated positions of the feet.

    No, sorry, so many different ways one could make a climbing system, can't really make a generic example suitable for all level designs and animations and stuff.

    Best,
    Pärtel
     
    takuyacebok, Crossway and khos like this.
  50. Octarina

    Octarina

    Joined:
    Oct 4, 2019
    Posts:
    8
    Hi,

    I'm working with the LeapMotion. I've seen on this topic that the LeapMotion SDK is no longer supported in a template scene. And i also found that the version 1.6 of Final IK contained a template scene with a exemple of Leapmotion integration.
    Thus, I would like to know where i can download a previous version of Final IK to try this integration (even if it works with an old SDK version).


    Best regards.
     
    Last edited: Jul 2, 2021
unityunity