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. Esmond0

    Esmond0

    Joined:
    Nov 22, 2017
    Posts:
    8
    So, I'm sorry that you've answered this a couple of different times, but I still can't seem to get the left hand to react to the procedural recoil when the effector weight is set to 1.
    Code (CSharp):
    1. using UnityEngine;
    2. using RootMotion.FinalIK;
    3.  
    4. public class LeftHandOnGun : MonoBehaviour
    5. {
    6.     public FullBodyBipedIK ik;
    7.  
    8.     public Transform leftHandTarget;
    9.    
    10.     private void Start()
    11.     {
    12.         ik.solver.OnPreRead += OnPreRead;
    13.     }
    14.  
    15.     private void OnPreRead()
    16.     {
    17.         ik.solver.leftHandEffector.position = leftHandTarget.position;
    18.  
    19.         ik.solver.leftHandEffector.position += ik.solver.leftHandEffector.positionOffset;
    20.     }
    21. }
    and the leftHandTarget is a child of the gun so the hand is supposed to stay on the gun. As seen in the picture here: Capture.PNG

    What am I doing wrong here?

    Thank you for your help!
     
  2. unity_3drapidsolutions

    unity_3drapidsolutions

    Joined:
    Nov 18, 2017
    Posts:
    21
    Hi Partel,

    I have a few questions regarding the package you have provided in this forum, the VRIK-VRTK Interaction System. I have not downloaded your package yet since I want to ask a few preliminary questions first:

    (1) In my project, I have been moving away from the VRTK framework due to the combination of the depracated v3 and the beta v4 and are instead custom-rolling my own solutions. Is it possible that your interaction system can work without VRTK? If it requires VRTK, will it only work with the latest v3 or v4?

    (2) I really want to implement the incredible hand posing features of your existing Interaction System but in VR. Specifically, I am hoping that when my hand is in the proximity of my grip point, squeezing the grip will auto-bend the finger rig into the desired position and parent the interactable object to the hand. This will undoubtedly simplify all interactions in VR, as I can design finger positions for each interactable object (just as in the original interaction system). Am I describing this plugin properly? Is this possible with the current version of the interaction system, or is that only for non-VR applications?

    (3) One of the reasons I was so excited for this plugin is because SteamVR just released a similar finger posing functionality, but it is only useful when publishing to the Steam store and cannot be used in Oculus store builds. Am I correct that it works similarly as this functionality?

    (4) The most recent version of the interaction system you released here was a v2 beta with a few fixes. Do you consider this ready for use for development? Will updating to FinalIK 1.9 eventually require me to redo all the work due to changes in its fundamental workings? I know this is probably a question you cannot answer at this point, but when do you think you will be releasing this interaction system in the next version (so I know whether to wait and work on other tasks until then)?

    Thank you for all of your excellent support!
     
  3. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey, no you will not have to disable VRIK, you can use VRIK on top of your locomotion animation if you set locomotion weight to 0 in VRIK locomotion settings, so you will be able to move your head and hands at all times.

    Hey,
    You can't parent IK targets to the character's own bones. When FBBIK solves, it first reads the pose of the character and all the target positions etc, but they will not be updated during the solving process. If the right hand is moved by IK, the bones get actually rotated only in the mapping process and that is after the solver has already finished so your left hand will end up where the target was as animated.

    But the code above should work. Maybe you have the leftHandTarget assigned in the FFBIK editor as left hand Target? In that case, changing ik.solver.leftHandEffector.position does nothing, so if that is the case, leave the left hand Target slot empty in FBBIK editor.

    Other than that, it is difficult to guess. If you could package me a repro, I'd take a closer look.

    Hey,
    1) I'm not a big fan of VRTK either, I mean it can be a great general solution, but I'd rather roll my own solution too. It will be more work at first, but you can keep it lightweight, develop exactly what you need to, fully understand it all and not worry about 3rd party updates breaking everything.
    That's why I have made VRIK interaction system independent of it. There is VRIKInteractionSystem.cs that does all the heavy lifting and then there is VRIK_VRTK_InteractionSystem.cs that just extends the former to listen to VRTK's events when things are grabbed and dropped and pass that information on to the base class.

    2, 3) I don't have any solution yet for grip squeezing and stuff like you mentioned. Currently it is done similar to FBBIK interaction system, where you pose a copy of the hand hierarchy to the object. I'll be looking into developing a better, more generic finger solution in the future.

    4) In its current state, it is ready to be used for picking stuff up, but as I said, lacks finger posing for when you are not holding anything, just squeezing buttons. Updating Final IK will not require you to redo anything, I try to be very careful not to break anything. :)

    Cheers,
    Pärtel
     
    ROBYER1 likes this.
  4. Esmond0

    Esmond0

    Joined:
    Nov 22, 2017
    Posts:
    8
    It was that easy. I just left the slot empty in FBBIK and it works great. Thank you! :)
     
  5. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    41
    Hi,
    Thank you, that solved my movement issue.
    However, my elbows are always bent awkwardly at an angle, Can you tell me why?
     

    Attached Files:

  6. hm2337

    hm2337

    Joined:
    Jun 9, 2019
    Posts:
    9
    I have a Mixamo-rigged biped humanoid character with Full Body Biped IK and Grounder FBBIK.

    For the Grounder FBBIK, I see that you can adjust the weight of Foot Rotation. which is awesome!
    But do you have advice for making the knees bend less? My model has unusual proportions on their legs so that bending their knees a 'normal' amount looks actually abnormal on them.
    Thx for creating this great tool!
     
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Perhaps you copied VRIK component over from another character? In that case the "Thumb To Palm Axis" and "Wrist To Palm" axis may be wrong in the VRIK arm settings. Please try right-clicking on VRIK header and choosing "Guess Hand Orientations" from the context menu.

    Hey,
    I can't think of a way around bending the knees if the feet need to go higher, sorry. Can't lift the pelvis instead, that would make the other foot lose ground contact.

    Best,
    Pärtel
     
  8. Hukha

    Hukha

    Joined:
    Aug 12, 2013
    Posts:
    61
    Hi @Partel-Lang ,
    I have a quadruped with some animations, i need to have a interaction System and grab with the head (Or Mouth) some objects. I only see Effectors like Hands, body, etc... Any way to have Interaction System with effectors of type Head or Mouth?
    Thank you!
     
  9. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    95
    Hi Partel,

    I am struggling to give correct ground level to my avatar with VRIK and VRTK.
    It works great when the avatar is walking the surface of y = 0 but when it is on any object, the legs sink into the object.
    This should be corrected easily but unfortunately I have never able to find it how.
    I thought GrounderVRIK component is for solving this issue but it did not seem so when I tested it indeed.
    Could you advice me which settings I should work or component I should add, please? 2019-06-12 (1).png
     
  10. ljarasunas2021

    ljarasunas2021

    Joined:
    Mar 13, 2019
    Posts:
    4
    Beginner to Final IK. How would I go about balancing a 2d stickman? I have physics animations on the stickman just need for it to balance itself appropriately. The stickman currently slides around and has a very bad balance mechanic. Wondering how i could implement balancing. Thx for your responses in advance.
     
  11. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    @Partel-Lang Is it possible to use VRIK and if the left or right hand VR controller comes near to a wall (e.g. on collision via collider) to switch the hand/arm to normal IK with the hit.normal as rotation to touch with the hand on the surface?
    Or something like hold a lever if the controller is in the near of it?
     
  12. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    I do not have a proper dog IK solver, but I did made a hack once. Here's the package if you wanna try. It would not be very easy to make it work with your own model, would basically just need to replace the model and all the bone references in all the components. Import to a project with FIK inside, play the scene and then you can move the "Bite Target" object and see how it reacts.

    Hey,
    Could be that the avatar root height is higher or lower from the ground surface than the value of "Max Step" in the Grounder. Try moving the avatar root to the ground level in the scene view when you see that happening. If that fixes it, you'll need your root to have a capsule collider or raycasting or something that keeps it at ground surface level, because VRIK nor the grounder actually move the root vertically.

    Hey,
    Final IK is a package about inverse kinematics, so it can't help you with balancing stickmen physically. I do have a physics package too called PuppetMaster, but it only uses 3D physics components.

    Hey,
    Yes, your IK targets are parented to the VR controllers, so you'll need a script that stores their default localPositions/Rotations at Start and continuously lerps them to those default values in Update. Then you can have another script override the IK target positions in LateUpdate, move them to hold a lever or whatever. If you release the lever, just stop overriding the IK targets and they will be smoothly interpolated to their default positions by that first script.
    That's how I'd do it at least.

    Cheers,
    Pärtel
     
  13. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    95
    @Partel
    >> VRIK nor the grounder actually move the root vertically.
    I see. Now I got it working pretty well. Thanks for the advice!
     
  14. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    Thanks, this is what I nearly done so far. But it's not really working.
    Code (CSharp):
    1. public void Start()
    2. {
    3.     this.focusInitialPosition = this.triggerFocus.localPosition;
    4.     this.focusInitialRotation = this.triggerFocus.localRotation;
    5. }
    6.  
    7. public void OnCollisionStay(Collision collision)
    8. {
    9.     // Set target position to contact point...
    10.     this.targetPosition = collision.GetContact(0).point;
    11.  
    12.     // Set target rotation to contact normal and rotate to initial focus rotation to correct the rotation of the hand...
    13.     this.targetRotation = Quaternion.FromToRotation(this.triggerFocus.transform.up, collision.GetContact(0).normal);
    14.     this.targetRotation *= this.focusInitialRotation;
    15.  
    16.     // if interaction focus was not active reset focus timer and set focus active...
    17.     if (this.interactionFocused == false) {
    18.         this.interactionFocused = true;
    19.         this.focusTimer = 0f;
    20.     }
    21. }
    22.  
    23. public void OnCollisionExit(Collision collision)
    24. {
    25.     // if interaction focus was active reset focus timer and set focus inactive...
    26.     if (this.interactionFocused == true) {
    27.         this.interactionFocused = false;
    28.         this.focusTimer = 0f;
    29.     }
    30. }
    31.  
    32. public void LateUpdate()
    33. {
    34.     this.focusTimer = Mathf.Min(this.focusTimer + 0.01f, 1f);
    35.     if (this.interactionFocused == true) {
    36.         this.triggerFocus.position = Vector3.Slerp(this.triggerFocus.position, this.targetPosition, this.focusTimer);
    37.         this.triggerFocus.localRotation = Quaternion.Slerp(this.triggerFocus.localRotation, this.targetRotation, this.focusTimer);
    38.     } else {
    39.         this.triggerFocus.localPosition = Vector3.Slerp(this.triggerFocus.localPosition, this.focusInitialPosition, this.focusTimer);
    40.         this.triggerFocus.localRotation = Quaternion.Slerp(this.triggerFocus.localRotation, this.focusInitialRotation, this.focusTimer);
    41.     }
    42. }
    "triggerFocus" is the GameObject with the VR controller as parent.
    The hand is sometimes just spinning around and doesn't align to the normal of the surface.
    I have visualized the normal via line renderer and the collision.GetContact(0).normal is correct and smooth, not like the spinning hand.

    I think the problem is something in this lines:
    Code (CSharp):
    1.     // Set target rotation to contact normal and rotate to initial focus rotation to correct the rotation of the hand...
    2.     this.targetRotation = Quaternion.FromToRotation(this.triggerFocus.transform.up, collision.GetContact(0).normal);
    3.     this.targetRotation *= this.focusInitialRotation;
    EDIT: I use UMA for the player character and the Z axis is the "up" direction of the hand (the back of the hand).
     
    Last edited: Jun 15, 2019
  15. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Not sure where the problem is with that code exactly, difficult to debug from here, but this is how I'd write it:
    Code (CSharp):
    1. public Transform triggerFocus;
    2.  
    3.     private Vector3 focusInitialPosition;
    4.     private Quaternion focusInitialRotation = Quaternion.identity;
    5.  
    6.     private float interactionWeight, interactionWeightV;
    7.     private float lastCollisionTime;
    8.     private Vector3 targetPosition;
    9.     private Quaternion targetRotation = Quaternion.identity;
    10.  
    11.     void Start () {
    12.         focusInitialPosition = triggerFocus.localPosition;
    13.         focusInitialRotation = triggerFocus.localRotation;
    14.     }
    15.  
    16.     private void OnCollisionStay(Collision collision)
    17.     {
    18.         // Target position and rotation are in world space
    19.         targetPosition = collision.GetContact(0).point;
    20.         targetRotation = Quaternion.FromToRotation(triggerFocus.parent.transform.up, collision.GetContact(0).normal) * triggerFocus.parent.rotation;
    21.  
    22.         lastCollisionTime = Time.time;
    23.     }
    24.  
    25.     void LateUpdate () {
    26.         // If time passed from last collision is less than fixed time step, we are still colliding with the object.
    27.         float interactionWeightTarget = Time.time < lastCollisionTime + Time.fixedDeltaTime ? 1f : 0f;
    28.         interactionWeight = Mathf.SmoothDamp(interactionWeight, interactionWeightTarget, ref interactionWeightV, 0.2f);
    29.  
    30.         // Restore to initial local state
    31.         triggerFocus.localPosition = focusInitialPosition;
    32.         triggerFocus.localRotation = focusInitialRotation;
    33.  
    34.         if (interactionWeight <= 0f) return;
    35.  
    36.         // Interpolate to target state (in world space!)
    37.         triggerFocus.position = Vector3.Lerp(triggerFocus.position, targetPosition, interactionWeight);
    38.         triggerFocus.rotation = Quaternion.Slerp(triggerFocus.rotation, targetRotation, interactionWeight);
    39.     }
     
  16. NikkiC5

    NikkiC5

    Joined:
    Jun 11, 2016
    Posts:
    11
    Pärtel, thanks for the reply. Disabling the IK component does appear to reset the pose of the rigged character to that of the T stance. However, re-enabling the IK component sets the pose back to its last pose state before it was disabled. I may need to dig into the VRIK code to understand what's going on.

    Ok, after some digging, it seems that every IKPosition and IKRotation needs to be set back to its default value otherwise the pose immediately moves to the last one set by the solver targets once VRIK is re-enabled, regardless of whether the solver targets have been set to null. Does that make sense? Is that easily possible without code changes to FinalIK?
     
    Last edited: Jun 16, 2019
  17. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    Thanks, this helped me a lot.
    The correct way was using the parent transform instead of the focusTrigger transform to calculate the rotation.
    But this way I must adding two more GameObjects between parent (VR controller) and focusTrigger to keep the correct rotation of the hands.

    Now it's working, but has some jittering / spinning if the hands are to far rotated in a direction through the normal of the surface that is not possible for a human.
    Is there a way in VRIK to clamp the hand rotation axes?

    I don't know if clamping the rotations would be the best way or if it is better to check for the rotation axes and let change the Hand rotation back to focusInitialRotation but with another hand gesture like making a fist.
    Clamping the rotations of the hand would cause the hand to be visually stuck in the surface.
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    If you disable VRIK, it just stops, so if you have animation playing it will continue with that. If you don't have any animation playing, it will remain in the pose it is in at the moment of disabling. If you have "Fix Transforms" enabled, then VRIK resets the pose to default in each update, so if you disabled VRIK in LateUpdate (your script runs before VRIK), it will end up in the default pose, which is probably the T-pose you were seeing. If you disabled it in Update, it would end up in the solved pose of the last frame.
    VRIK doesn't change the IKPosition/IKRotations, so yes, without targets assigned they will remain the same forever.

    Hey,
    It is possible to clamp the rotations on top of VRIK, you'll need to add RotationLimit components to the hand bones, then disable them in Start and call rotationLimit.Apply() after VRIK has solved. You can use the ik.solver.OnPostUpdate delegate to get a call from VRIK each frame after it has solved, then call Apply() from there.

    Cheers,
    Pärtel
     
  19. LazyOnion

    LazyOnion

    Joined:
    Mar 6, 2018
    Posts:
    22
    Hey Partel,
    Is there any way to implement Hand IK for hands only ? I did something like this by scraping the handposer from the vrtk_vrik package but the ik seemed a bit off without the hand actually moving and blending back to its position. Is there some script I should look for such a feature?
     
  20. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    Ok, thanks. I checked RotationLimitAngle out and I think there is something wrong with the twistLimit.
    If the hand rotates around the twist angle it stops rotating at the end of the limit and if I rotate the controller even more it jumps to the opposite limit end or something like this. It's difficult to find out what it exactly do.
    This behaviour is without touching of the surface, just if the hands are in air.
    I can't figure out if the setup of the twistLimit was correct.
    My values are:
    Code (CSharp):
    1. rotationLimitAngle.axis = -Vector3.right;
    2. rotationLimitAngle.limit = 80f;
    3. rotationLimitAngle.twistLimit = 90f;
    4.  
    It seems there are no visualization of the rotationLimitAngle.twistLimit in the scene view?
    I can only see the rotationLimitAngle.limit as a cone visualization.

    Another problem is on some rotation angles of the hand the triggerFocus.parent.transform.forward is jittering.
    The triggerFocus.parent has a TrackedPoseDriver to get the controller position and rotation with update type UpdateAndBeforeRender.
    And this cause jittering on the rotation calculation for the hand while touching the surface.
    Code (CSharp):
    1. targetRotation = Quaternion.FromToRotation(triggerFocus.parent.transform.forward, collision.GetContact(0).normal) * triggerFocus.parent.rotation;
    I know this has nothing to do with FinalIK, but is the behavior already known to you and is there a way to suppress the jittering?
    I think it's because I use a rigid body with isKinematic = false and a sphere collider with isTrigger = false on the controller game objects. This is to get collision event OnCollisionStay on static colliders.
    I would use isTrigger = true and OnTriggerStay event, but there is no collision info and hit normal.
     
    Last edited: Jun 20, 2019
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    There is FingerRig for solving the fingers, other than that, I don't have anything else, sorry. But in the VRTK interaction package, doesn't the hand already blend smoothly?

    Hey,
    It is not a bug actually, just a limitation of the rotation limit. It is not continuous, so at 180 degrees there is a singularity point and if you rotate past that, the other way around is shorter, so it snaps. I can't think of a way around that, sorry.
    I have tried creating continuous limits, but with VR controllers sometimes losing tracking and then snapping to a new state, they become corrupt very easily.

    About the jitter, I think your code for calculating targetRotation runs before TrackerPoseDriver, so if it is set to UpdateAndBeforeRender it will lag a frame behind. You probably ought to use OnPreRender to run that code and to also update VRIK (disable the component in Start, call ik.solver.Update() to update it's solver manually).

    Best,
    Pärtel
     
  22. LazyOnion

    LazyOnion

    Joined:
    Mar 6, 2018
    Posts:
    22
    @Partel-Lang Ye I ll try to work with that, I changed it a bit since I don't really need vrik and just hand rigs, so the poser works like a blending between idle hand animation and grabbing animation, however it doesn't move the palm/root of hand so it lacks tension. I ll try to immitate what you did on the final ik solution with the curves etc.

    Just I wanted to ask if you think using animation for this purpose and just using final ik to blend to those animation or tweak them a bit is less expensive and/or easier to do than doing it all on the poser (I will be having only one set of hands so each pose is done only once)
     
  23. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    This does not work. If I execute ik.solver.Update() in OnPreRender() of a MonoBehaviour script on the main camera and set the VRIK script to enabled = false, the avatar does not reacting anymore correctly to the headset and the controllers. Only the X and Z position updates to the headset position, but the avatar does not move the hands or go up or down with the headset Y position.
     
    Last edited: Jun 22, 2019
  24. Censureret

    Censureret

    Joined:
    Jan 3, 2017
    Posts:
    363
    Hey Guys. i have kind of a huge problem with AimIK that i hope that you can help me with

    First take a look at this picture:

    upload_2019-6-23_13-56-48.png

    The above pictures archer has an IK component with the following values:

    upload_2019-6-23_13-57-37.png

    The Aim point is set on the weapon as such:

    upload_2019-6-23_13-59-11.png

    Can anyone tell me what ive done wrong here?
     
  25. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Hey Partel (or anyone, really):

    I've been having a great time with your tool. Been through all the youtube tutorials on Final IK. I'm having a little trouble integrating it with UMA. I would like the FBBIK to be added to my UMA when the scene starts, as opposed to having to add it in Editor like in the tutorial. I've attempted to adapt what I code I've been able to find, but I suspect I'm missing something. As is, nothing seems to happen, but when I put AddingFBBIK() into the update by itself, it brings my performance to a grinding halt. I'd love some insight on this, my programming skills are still being developed.

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using RootMotion; // Need to include the RootMotion namespace as well because of the BipedReferences
    5. using RootMotion.FinalIK;
    6.  
    7. public class AddFBBIK : MonoBehaviour
    8. {
    9.     public BipedReferences references;
    10.     private FullBodyBipedIK ik;
    11.  
    12.     // Update is called once per frame
    13.     void Update()
    14.     {
    15.        
    16.         while (references == null)
    17.         {
    18.             AddingFBBIK(gameObject, references);
    19.         }
    20.     }
    21.  
    22.     // Call this method whenever you need in runtime.
    23.     // Please note that FBBIK will sample the pose of the character at initiation so at the time of calling this method,
    24.     // the limbs of the character should be bent in their natural directions.
    25.  
    26.     void AddingFBBIK(GameObject go, BipedReferences references = null)
    27.     {
    28.         if (references == null)
    29.         {
    30.             BipedReferences.AutoDetectReferences(ref references, go.transform, BipedReferences.AutoDetectParams.Default);
    31.         }
    32.        
    33.         // setting the references
    34.         ik = go.AddComponent<FullBodyBipedIK>(); // Adding the component
    35.         // Set the FBBIK to the references. You can leave the second parameter (root node) to null if you trust FBBIK to automatically set it to one of the bones in the spine.
    36.         ik.SetReferences(references, null);
    37.         // Using pre-defined limb orientations to safeguard from possible pose sampling problems (since 0.22)
    38.         ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA); // The limb orientations definition for UMA skeletons
    39.            
    40.     }
    41. }
     
  26. Mr-Berni

    Mr-Berni

    Joined:
    Aug 29, 2017
    Posts:
    9
    Hey yall, hoping if you could help me out with a quick issue I am having.

    I am running with the VRTK 4.0 beta right now and have a dynamic uma character loading all good. I have the head and hands linked up the VRIK script all nice and dandy. BUT for some reason the head is turned to the left side, and both hands are also twisted. Anything I am missing here? the transforms for the objects (hands/head) don't have any funky rotations and either do the parents...

    Any ideas on whats going on here?

    PS: send help, this guy is starting to freak me out hellothere.jpg
     
  27. Deleted User

    Deleted User

    Guest

    Hi,
    How Final IK's performance compares to Unity IK's performance?
     
  28. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Not sure if I understood, but if you just need to blend the hands between idle and grabbing, the most efficient way would be use just animation. If you don't have animations for the hands, you can create them with Unity's Animation Window. Add a new Animator to the hand bone, open the Animation window, click on Create and you can then pose the finger bones in unity, save it as an animation clip and have Mecanim blend between the poses for you.

    Hey,
    Just tried to run the Pilot in the "VRIK (Basic)" scene with this script:
    Code (CSharp):
    1. public VRIK ik;
    2.  
    3.     private void Start()
    4.     {
    5.         ik.enabled = false;
    6.     }
    7.  
    8.     private void OnPreRender()
    9.     {
    10.         ik.solver.FixTransforms();
    11.         ik.solver.Update();
    12.     }
    Everything seemed to work fine... Can you let me know how exactly to reproduce the issue you were seeing?

    Hey,
    Looks like "Axis" of AimIK is wrong because the little purple cone is supposed to point forward relative to the bow.
    I think the axis should be either (1, 0, 0) or (-1, 0, 0) based on your last screenshot (unless the screenshot was taken in Global mode instead of Local).

    Hey,
    Please try this script:

    Code (CSharp):
    1. private Animator animator;
    2.     public FullBodyBipedIK ik { get; private set; }
    3.  
    4.     void Update()
    5.     {
    6.         if (ik != null) return;
    7.  
    8.         // Add FBBIK as soon as an animator is present
    9.         animator = GetComponent<Animator>();
    10.         if (animator != null && animator.avatar != null)
    11.         {
    12.             AddingFBBIK(gameObject);
    13.         }
    14.     }
    15.  
    16.     // Call this method whenever you need in runtime.
    17.     // Please note that FBBIK will sample the pose of the character at initiation so at the time of calling this method,
    18.     // the limbs of the character should be bent in their natural directions.
    19.  
    20.     void AddingFBBIK(GameObject go)
    21.     {
    22.         var references = new BipedReferences();
    23.         BipedReferences.AutoDetectReferences(ref references, go.transform, BipedReferences.AutoDetectParams.Default);
    24.        
    25.         // setting the references
    26.         ik = go.AddComponent<FullBodyBipedIK>(); // Adding the component
    27.         // Set the FBBIK to the references. You can leave the second parameter (root node) to null if you trust FBBIK to automatically set it to one of the bones in the spine.
    28.         ik.SetReferences(references, null);
    29.         // Using pre-defined limb orientations to safeguard from possible pose sampling problems (since 0.22)
    30.         ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA); // The limb orientations definition for UMA skeletons
    31.  
    32.     }
    Hey,

    Did you assign the camera and the hand controllers directly as IK targets? The IK targets should be empty gameobjects parented to the camera and the hand controllers instead. That way you can adjust the localPosition and localRotation of those targets to match the bone orientations of the avatar.

    Hey,
    The performance of solvers up to the point of Unity IK's capabilities, meaning simple 3-point IK for the arms and legs, is roughly the same. Full body solvers like FullBodyBipedIK and VRIK are much more powerful so they also perform considerably slower.

    Best,
    Pärtel
     
  29. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Worked perfectly, thank you Partel, your work on this tool is just so exemplary.
     
    Partel-Lang likes this.
  30. HP

    HP

    Joined:
    Nov 20, 2012
    Posts:
    80
    Hmm, my player is a UMA avatar and the VRIK script is attached at runtime:
    Code (CSharp):
    1. public class Player : MonoBehaviour
    2. {
    3.     public VRIK vrIk;
    4.  
    5.     // UMA avatar created event...
    6.     public void OnAvatarCreated(UMAData umaData)
    7.     {
    8.         AttachVRIK();
    9.     }
    10.  
    11.     public void AttachVRIK()
    12.     {
    13.         VRIK vrIk = this.gameObject.GetComponent<VRIK>();
    14.         if (vrIk == null) {
    15.             vrIk = this.gameObject.AddComponent<VRIK>();
    16.         }
    17.         // ...
    18.         vrIk.enabled = false;
    19.         this.vrIk = vrIk;
    20.     }
    21. }
    22.  
    23. public class CameraView : MonoBehaviour
    24. {
    25.     public Player player;
    26.  
    27.     public void OnPreRender()
    28.     {
    29.         // ...
    30.         player.vrIk.solver.FixTransforms();
    31.         player.vrIk.solver.Update();
    32.     }
    33. }
    I don't know what is wrong but in SceneView it looks like this if I press the pause button of the Unity 3D editor:

    Without pressed pause button the ragdoll stands like the avatar and does not kneel.

    [EDIT] But it's working in your VRIK (Basic) demo scene if I attach a script to the camera and a TrackedPoseDriver.
     
    Last edited: Jun 25, 2019
  31. Mr-Berni

    Mr-Berni

    Joined:
    Aug 29, 2017
    Posts:
    9
    Ah, yeah they are directly pulling from the camera rig objects. I figured this would be a fix for this, just wanted to make sure I wasn't missing something super obvious!

    So I'm going to have them reference hands and a head that I can manipulate the rotation so the model matches
     
  32. GambitMonkey

    GambitMonkey

    Joined:
    Apr 5, 2016
    Posts:
    65
    Hey man saw your post and wondered if you had stumbled on my code sample I posted over on the PuppetMaster thread. It maybe what you are looking for. Let me know if this does not work for you. https://forum.unity.com/threads/puppetmaster-advanced-character-physics-tool-released.358445/page-31
     
  33. GambitMonkey

    GambitMonkey

    Joined:
    Apr 5, 2016
    Posts:
    65
    Partel,
    Ran into a snag and can't quite figure it out.

    I have my UMA character setup and everything seems to be working fine except he is floating about a meter off the ground. If I disable the feet and lower leg colliders the grounder solver seems to work correctly.

    Is there a root transform or something I need to set if I am using colliders on the individual parts instead of a normal sphere collider for the entire character? I cant seem to find a setting to change the behavoir.

    Floating.PNG

    FBBIK and Grounder Settings
    FBBIK Settings.PNG

    Colliders Disabled on Feet and Lower Legs
    CollidersDisabled.PNG

    Thanks in advance!
     
    Last edited: Jun 25, 2019
  34. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Looks good, but my system isn't recognizing the SpineEffector[] as a type. Do you have some custom namespace that makes that work? Commenting that and the spinesetting out, it left my UMA characters half underground. Does that make sense?

    Also since you're another UMA Final IKer, have you run into any trouble with the interaction system? I pretty much took the Interaction C2C setup wholesale, but when I try to get an UMA in there, their hand just doesn't join in. Duplicating an whole UMA like in the tutorial made UMA go nuts, but I was able to duplicate a hand and parent it to the handshake, when I put one of my UMAs in the script the Dummy hand goes towards my UMA, but the UMA just won't shake hands. Have you run into anything like that?
     
  35. GambitMonkey

    GambitMonkey

    Joined:
    Apr 5, 2016
    Posts:
    65
    Hypester hey sorry I always group Grounder and FBBIK together so the SpineEffector is part of the Grounder FinalIK namespace. I have not ventured into the UMA hand placement stuff just yet. Primarily getting Character Controller finalized which is where the grounder stuff comes into play. Next up though is the Inventory and equip/unequip stuff so I will let you know what I find out here shortly.

    Sorry couldn't be of more help on that end.
     

    Attached Files:

    Last edited: Jun 26, 2019
  36. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Thanks doc, I'll see if I can make sure everything is in the proper context. Oddly enough, when I started Unity up today, it was working, so wowsers, I guess I'm a real developer now, I have no idea why what I did is working now, lol.
     
  37. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    It's probably just that the grounder raycasts hit the leg colliders. Go to the grounder solver and exclude the ragdoll layer from the "Layers"

    Best,
    Pärtel
     
  38. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    41
    Hi,
    is there a guide to the VR setup for v 1.3? The setup ReadMe is not fixing my issues and cannot find any user manual for VR
     
  39. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Hey Partel,

    Okay, still working on this handshake bit. I'm using the same assets from the Interaction C2C. I have a duplicate of the UMA Right Hand as a child of the Pivot, itself a child of the Handshake Object. I add the FBBIK and Interaction System script to both UMAs. They are Character 1 and Character 2 in the Interaction C2C Demo script in the editor. I have the hand poser on the right hands of both of the UMAs, and the Pose Root is that Right Hand object childed under Pivot/Handshake. It has the Interaction Target script on it, with the Effector type of Right Hand and Pivot of the Pivot object its under. What am I missing? Why won't it follow the pose effector? If I choose the dummy hands under Handshake as pose effectors, at least the hands gnarl up in a weird way, but getting these hand poses under control is eluding me. Any ideas?
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    What exactly were the issues you were seeing?
    Here's a tutorial for setting up VRIK with Steam.

    Hey,
    The pose that you have parented to the hand shake, did you copy the hand hierarchy of the model you are using?
    The hierarchy must be an identical match, it won't work with a hand of another model as I don't have a universal hand posing system yet.

    Best,
    Pärtel
     
  41. Hypester

    Hypester

    Joined:
    Jan 23, 2018
    Posts:
    17
    Awesome, I have that now, but it seems now that they both are going to the same target, even if I have different pose roots in the Pose Root for the Hand Poser. What determines which effector they go to?

    EDIT: In other words, if there are two identical hand heirarchies, how does the system determine which to go to
     
    Last edited: Jul 1, 2019
  42. WojciechWlodyka

    WojciechWlodyka

    Joined:
    Jun 12, 2019
    Posts:
    4
    Hello Everyone,
    So, w are making VR app with SteamVR and VRIK. As for now, we want to use SteamVR hand animations with our sceleton that is using VIRK plugin. We successfuly connected steamvr hand to work with our model but we have problem with rotation of our hand. Hand on the right side is rotates relatively to center of the hand. Left hand is only connected thru method Partel showed in his tutorial (This one:
    ).

    What we want to do is change rotation point of our hand to wrist for natural curve.


    Is there a reasonable way to do it?

    Thanks for answers in advance.
     
    Last edited: Jul 1, 2019
  43. nsxdavid

    nsxdavid

    Joined:
    Apr 6, 2009
    Posts:
    476
    @Partel-Lang I love me some Final IK. But it wasn't Final enough, because I super duper really wanted a prismatic joint. And Final IK only has love for rotational joints. Boo hoo. :(

    Well today I went ahead and just added prismatic joints (to the 3D CCD solver anyway). Was super easy, barely an inconvenience. Makes me think... ya know... maybe you should just go ahead and add this since it's no big whoop.

    Essentially I created a new abstract PrismaticLimit that worked with positions (mirrored RotationLimit's structure, just working with Vector3s instead of Quaternions) and a concrete implementation I called PrismaticLimitBox. This one just keeps track of a minimum and maximum for x,y,z (so two Vector3s). Apply just clamps each axis float between the min and max value.... easy sneazy.

    Next up, I made it so the Bone class could keep track of a reference to a PrisimaticLimit in the same way it keeps track of a RotationLimit. So this part is a big squirlly.... I use the presence of a PrismaticLimit as the indication that the joint is prismatic rather than rotational. This is a bit ugly and, I'm sure, you could do a better job integrating it in a nice clean way. But it works well enough.

    Last bit: In the IKSolverCCD class, I just have it check of the bone has a prismatic limit. If so, it does the prismatic logic instead of the rotational logic. What is this logic you ask? I set the bone's world space position to the target's world space position. Ka-pow! It's really just that easy.

    At the end, if there is a prismaticLImit, I apply it to clamp the positional shift to the specified limits.

    And, of course, you have to have your joints in the right coordinate space for this to make sense. In other words, the parent of the joint has to have it's X/Y/Z (if they have freedom in the limits) pointing in the right direction... the orientation of the joint itself pointing in the right direction. I guess this could be made better with some specification of an vector for orientation, but seems super simple to just get your joint rotations like you want them. You have to do that anyway pretty much for everything else.

    Whole thing works like a charm. More work would be needed to polish this... such as applying it to other solvers, a visualizer on the limits, and what not. But if you want me to bundle this code back to you, let me know.
     
  44. Michael_R

    Michael_R

    Joined:
    Sep 6, 2018
    Posts:
    29
    Hello,

    does anyone know how to set the (trigometric) ik target from a LimbIK object.
    I dont want that
    Code (CSharp):
    1.             ikLeftHand.solver.IKPosition = leftGrip.transform.position;
    2.  

    I want to set that (via script):

    upload_2019-7-1_23-39-52.png
     
  45. bzalexDev

    bzalexDev

    Joined:
    Jul 2, 2019
    Posts:
    4
    Hi @Partel-Lang ,

    Been learning Final-Ik for a few days now. This might be a noob's problem but I just can't seem to figure out why the tips of my character's feet go through the ground. Am I missing something here? I'd appreciate some help on this one.

    1.PNG 2.PNG

    Edit: Nevermind. Got it working!
     
    Last edited: Jul 3, 2019
  46. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    41
    Hi, I am trying to add a sitting animation to the VRIK dummy.
    How do I disable the solver for legs?
    I tried set the reference of the legs to none, it was still solving the legs position.
     
  47. bzalexDev

    bzalexDev

    Joined:
    Jul 2, 2019
    Posts:
    4
    For anyone having the same problem, I compared my settings with the grounder demo scene and found that checking the Foot IK checkbox on the state settings is needed.
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    With the InteractionSystem, it is done by using Tags. So create a tag for each character type, in the InteractionSystem component type in the "Target Tag" field and set the tag of each InteractionTarget gameobject to define which character it belongs to.

    Hey,
    I'm not sure if I understood... Can't you just parent the IK target to that SteamVR hand and adjust it's localPosition/Rotation until it looks right?

    Hey,
    Thank you for this, sounds like a great idea! It would probably work with FABRIK too. I'll add it to my todo list.

    Hey,
    Code (CSharp):
    1. ikLeftHand.solver.target = transform;
    Hey,
    If you removed references to the legs, it will not solve the legs position as it doesn't even know which bones to operate on, but the legs will still move because moving the head also moves the pelvis and the legs are parented to that. Did you already see the seated VRIK example in the "VRIK (Basic)" demo?

    Cheers,
    Pärtel
     
  49. yaffa

    yaffa

    Joined:
    Nov 21, 2016
    Posts:
    41
    Hi,
    I saw the sitting demo but it keeps sitting in air everytime. So was trying to do a sitting animation.
    Can you help with transitioning from a standing to sitting?
    I'm currently increrasing the weight for left and right leg to 1 via script when it needs to sit.
     
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    You'll just have to add a Pelvis Target in the Spine settings and set Pelvis Position Weight to 1 to plant the hips to the seat.