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,
    Yeah, for Animation Rigging to be applied on top of FIK, there is nothing I can do.
    But FIK also has itäs own twist correction, just add a TwistRelaxer component on the twist bone to make it work.
    If you need another type of constraint just let me know, I probably already have something or can make it for you quick.

    Hey,
    I tried to do that in the VRIK Basic demo, added a FBBIK and IKExecutionOrder, set VRIK locomotion weight to 0. VRIK was not cancelling out FBBIK, for example I was able to move the FBBIK foot effectors and the foot followed. Could you maybe record a video of what you are dealing with so I could understand it better?

    Hey,
    Basically just add 2 LimbIK (3 joints) or LegIK (+ toes) components and assign all the bone references as well as Targets. That's all there is to it as far as IK setup goes.
    Then if you wish to animate those targets, add a new GameObject as child of the character root Transform. Parent the IK targets to that. Add an Animator and then you will be able to animate those IK targets using the Animation Window.

    Hey,
    I see that model does not have a bone hierarchy, just independent objects. Did you assemble them hierarchically?
    Also, when I look at the bone orientations, they are not aligned to each other: Mech.JPG In order for RotationLimitHinge to work properly with (0, 0, 1) set as Axis, the Z axis should be orthogonal to the limb, otherwise you'll get a tilted rotation plane.

    If you could send me a unitypackage of a scene with that robot set up with the limits and IK (also include the fbx again and the prefab if it is a prefab, disable "Include Dependencies)), I'd be able to tell you more exactly where the issue is.

    Hey,
    Do you have PuppetMaster on that character? Or is it just VRIK?
    If it's PuppetMaster, do you have "Fix Target Transforms" enabled and "Fix Transforms" enabled in VRIK?

    Best,
    Pärtel
     
  2. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    561
    Hi Pärtel,

    I do not have PuppetMaster. Should I get that?
     
  3. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Many thanks for your hints, has anyone ever tried that or have a tutorial? I have used timeline to animate effectors but it is not ideal (but works!), It would be cool if I can get it coded in C# and only drive the effectors step movement (simulate walking) via script, no matter what direction the player moves in, sideways/backwards/forwards walking.
     
  4. chilton

    chilton

    Joined:
    May 6, 2008
    Posts:
    561
    Is there any way to zero out whatever could be causing this orientation issue?
     
  5. fullerfusion

    fullerfusion

    Joined:
    Dec 2, 2018
    Posts:
    22
    Hi Pärtel, thank you so much for your quick response. I realized I was using the wrong axis for the RotationLimitHinge. It was supposed to be the X axis. I'm sending you the Unity package. One package contains the FBX model (the Prefab included). The other unity package contains the scene (With no dependencies).

    I don't know if you wanted the IK scripts along with the models so, I've attached another unitypackage called: APEX_IK that contains all the scripts from RootMotion
     

    Attached Files:

    Last edited: Sep 5, 2020
  6. Arlatan

    Arlatan

    Joined:
    Jun 23, 2020
    Posts:
    4
    Hello!

    I am trying to implement the Final IK Hit Reaction system to instead of respond to screen to raycast, respond to a box collider being swung, like a bat.

    I'm trying to figure out, however, how to get the add force in the appropriate direction? I've tried something like


    Code (CSharp):
    1. void OnCollisionEnter(Collision collision)
    2. {
    3. collision.gameObject.GetComponent<RigidBody>().AddForce(0, hitForce, 0);
    4. }
    but it just isn't executing properly. Any help would be appreciated. Thank you!

    EDIT:
    Spent about 12 hours working on it. I think I'm getting closer. I'm registering when there is a rigidbody, but I still can't seem to get the force to apply. I've attached the below code to a sphere in a copy of the demo scene. I reference the HitReaction script in the inspector. I hit play, then try to drag the sphere into the dummy hopping to see a reaction, but cannot.

    I've turned off the HitReactionTrigger on the dummy, as a side note.

    I'm still too inexperienced to understand what I don't know. I can't sleep. All I can think about is why it isn't working. Need to walk away for a bit, get some exercise, then I'll read some more documentation and see if I can't figure anything else out.

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.FinalIK;
    4.  
    5. namespace RootMotion.Demos
    6. {
    7.  
    8.  
    9.     /// <summary>
    10.     /// Triggering Hit Reactions on mouse button.
    11.     /// </summary>
    12.  
    13.     public class HitTrigger : MonoBehaviour {
    14.     public HitReaction hitReaction;
    15.     public float hitForce = 1f;
    16.  
    17.     private void FixedUpdate()
    18.    
    19.     {
    20.     RaycastHit hit = new RaycastHit();
    21.     Vector3 fwd = transform.TransformDirection(Vector3.forward);
    22.             if (Physics.Raycast(transform.position, fwd, 5))
    23.                
    24.                     {
    25.                         Debug.Log("This object has a rigidbody.");
    26.                         hitReaction.Hit(hit.collider, fwd * hitForce, hit.point);
    27.                     }
    28.                
    29.                 Debug.DrawRay(transform.position, transform.TransformDirection(Vector3.forward), Color.white);
    30.             }
    31.         }
    32.     }
    33.    
    34.  
    35.  
     
    Last edited: Sep 6, 2020
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    If you already have animation playing or "Fix Transforms" enabled in VRIK, that should reset the pose each frame.
    Maybe it is just the rotation of the root Transform that is different and needs to be reset?

    Hey,
    I checked the robot, the rotation limits seem to be working fine now. Was there anything else you wanted me to help you with?

    Hey,
    You can't AddForce to a kinematic Rigidbody, it does nothing. HitReaction just fakes a physical hit with IK, it doesn't solve it with physics. So use hitReaction.Hit instead of AddForce. If you want to make it work with collision, you'll have to use void OnCollisionEnter(Collision collision) and call hitReaction.Hit() from inside of that. I think you should be able to use collision.relativeVelocity as direction of force.

    Best,
    Pärtel
     
  8. Skinzart

    Skinzart

    Joined:
    Sep 11, 2020
    Posts:
    14
    I am currently developing a multiplayer mobile vr application, the target platform is oculus quest, I am using VRIK, for about 50 players it works fine, but for 100 players in the same room, the frame rate drops, do you have any optimization tips?

    by the way i use lod 1
     
  9. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi Partel,
    How do you deal with the gun recoil if it is present in the animation itself?
    Because the recoil of the weapon makes the aim transform move which in turn move the body. Should I use an aim transform outside the weapon?
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    100 is a lot, especially for mobile VR. Have you tried switching to LOD 2 for the ones that are out of view? Can use renderer.isVisible to toggle that.

    Hey,
    You can make AimIK work in additive mode, that lets you maintain all your reloading, recoil, equipping etc animations without AimIK forcing the gun to be pointing at the target at all times. The easiest to do that would be to add AimController (helper tool for AimIK, takes care of smooth target switching, interpolation, root rotation and other stuff like that, check out the "Aim Controller" demo) and enable "Use Animated Aim Direction" in it. Note that if your aiming/shooting animation is not aiming perfectly forward, you will have to tweak the value of "Animated Aim Direction" to fix the inaccuracy.
    If you don't want to use AimController, this code is what does the "additive mode" thing:

    Code (CSharp):
    1. public AimIK ik;
    2.         [Tooltip("The direction of the animated weapon aim in character space. Tweak this value to adjust the aiming.")] public Vector3 animatedAimDirection = Vector3.forward;
    3.  
    4.         void LateUpdate () {
    5.             ik.solver.axis = ik.solver.transform.InverseTransformVector(ik.transform.rotation * animatedAimDirection);
    6.         }
    Best,
    Pärtel
     
    00christian00 likes this.
  11. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Can I use VRIK with the Baker? It is really not clear in the documentation or example assets that Baker can work with VRIK. Could you please update either to make this clear to users?
     
    Last edited: Sep 16, 2020
  12. yuri_midnite

    yuri_midnite

    Joined:
    Sep 17, 2020
    Posts:
    8
    Hello, I'd like to smash a ball with a bat (baseball like mechanic), what are the tools and procedures you recommend? Thank you!
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Yes, Baker can record anything, all IK components, ragdoll physics, etc.
    For example if you need to record yourself playing in VR with a VRIK avatar, just add HumanoidBaker, switch it to Realtime mode, call baker.StartBaking() to begin and StopBaking() to stop.

    Hey,
    If you have animation of swinging the baseball bat, could use AnimationWarping to match it to the arbitrary position of the ball. Check out the "Soccer Kick" demo. The same technique could be used for the hand. It gives you some degree of flexibility, but you still need a few swinging animation clips like left/right, high, low to increase the range.

    Best,
    Pärtel
     
  14. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    **Edit: added support ticket for this on RootMotion support:
    #113 humanoidBaker.StopBaking() crash in play mode when called in a script in scene and not using the inspector 'Stop baking' button


    Hi Pärtel

    While in VR I am calling humanoidBaker.StartBaking() with a simple button which works fine to start recording but when I call humanoidBaker StopBaking() to stop the bake and save the recorded animation, everything rendering in VR freezes and in the Editor a dialogue shows saying Assets importing.

    It seems to cause a memory leak as a 1 minute or less recording doesn't save within 10+ minutes and the memory of the editor keeps going up in task manager.

    However, calling humanoidBaker.StartBaking() while in VR then going to the editor and using the mouse to click the 'Stop Baking' button on the Humanoid Baker script works just fine to stop the recording.

    AssetDatabase.ImportAssets is what it hangs up on while in play mode

    Edit:
    In fact, after further testing, the StopBaking() function from my button works in VR only if I have stopped the Baking once during play mode using the Stop Baking button on the Humanoid Baker in the Inspector view in the Editor itself. After that one time, new Start/Stop Baking function calls from within the play mode in VR using the collider button in my scene.

    Using 2020.1.3f1

    I traced this down to Line 455 of Baker.cs -
    Code (CSharp):
    1. AssetDatabase.SaveAssets();
    Here is how I can start/stop recording without the crash:


    And here is how I start/stop recording while in VR which induces the crash immediately:


    I have a reproducible project for this I can send you if you are able to help with this?

    -Rob
     
    Last edited: Sep 18, 2020
  15. Futwerk

    Futwerk

    Joined:
    Jun 21, 2020
    Posts:
    6
    Hi Partel,

    I'm using VRIK and trying to use lower body walk animations. I set locomotion weight in VRIK to 0, but I'm still getting procedural leg animations. How do I disable locomotion? Btw, I am using it with the VRIK Calibrator if that makes a difference.

    Thanks
     
  16. gliealonso

    gliealonso

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

    I'm having issues with the multiplayer VRIK knees of one character.

    So in the masterclient, the knees of the character bends the correct way, however for the client side, the knees bend at the wrong way.

    I researched about this in the forum and I tried bending the knee bones slightly, but it still has the issue for the client side. And I also set the default animations for the animator Foot IK to true.

    The only thing I saw that was different for the 2 instances was that the leg bones rotation are really off, like you can see in the image below:

    (the image up top is the master client, the one below it is the client side) Untitled-2.png


    Any idea on how I can fix this?

    Many thanks,
    Gabriel.
     
  17. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    It is most likely a Unity bug. I tried to reproduce it here, but didn't see it happening. Can you please let me know where does the StopBaking() call originate from? I mean are you using a raycast for the button and if so are you calling it from Update or FixedUpdate or LateUpdate? Since the manual button works, I think the crash has got to do with the timing of calling StopBaking().

    Hey,
    If you have locomotion weight set to 0, that really should disable procedural locomotion. Are you maybe using foot trackers? Make sure leg position and rotation weights are 0 then too.

    Hey,
    Are you by chance starting with VRIK disabled and enabling it at some random time?
    If so, animation will be already playing on the character when VRIK initiates and the character will be in some random animated pose and your adjustments to knee angles will have no effect.
    If so, then instead of having VRIK disabled on the prefab, leave it enabled and call ik.enabled = false in Start().
    That way VRIK will initiate properly in the same pose every time.

    Best,
    Pärtel
     
  18. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Hey Pärtel

    The 'R1 Tools Gizmos' gameobject in the scene has a script called Button Manager.

    The Stop button in the scene has a collider with a Button-like script attached to it that calls the function to Stop baking once on Collider enter.

    It is interesting you couldn't reproduce it from the files I sent. What Unity version did you use?
    The reproducible project in the support ticket is using 2020.1.3f1

    Also reproducible on 2020.1.6f1
     
    Last edited: Sep 21, 2020
  19. PGiza

    PGiza

    Joined:
    Jul 22, 2019
    Posts:
    4
    First of all, great work final ik is awesome.
    I am using VRIK to drive my vr body and im looking for solution of head bobing. At this moment im using vrik procedural locomotion and when legs make big step head and torso go down quite a bit and detaching from headset target.
    I have found FBBIKHeadEffector class that shoud help (?) but although there are mentions of vr in code commentary in this class it take as parameter FBBIK not VRIK. Is there any way that head effector can be used with vrik or is there any other component that can have desired effect?
     
  20. michealcaj

    michealcaj

    Joined:
    Aug 18, 2017
    Posts:
    191
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Oh, sorry, I hadn't checked the ticket with the project link yet.. Yeah, I'm able to reproduce now, thanks..
    It is indeed a Unity bug. The StopBaking() call originates from OnTriggerEnter(), which is executed from within Unity's physics simulation step. Apparently AssetDataBase.SaveAssets() has a problem with being called at that time. I was able to dodge the crash by delaying the call with a coroutine (ColliderButton.cs):

    Code (CSharp):
    1. void OnTriggerEnter(Collider other)
    2.     {
    3.         StartCoroutine(Invoke());
    4.     }
    5.  
    6.     private IEnumerator Invoke()
    7.     {
    8.         yield return null;
    9.         StartCoroutine(Fade());
    10.         buttonEvent.Invoke();
    11.     }
    Please try having the Animator disable by default, only enable it when ik.solver.initiated returns true. I have a hunch that if you have some kind of animation syncing, that might sync the pose right when the client instance is created, before VRIK has a chance to initiate.

    Best,
    Pärtel
     
    ROBYER1 and michealcaj like this.
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey and thanks!
    I have fixed this issue for the next version, I will PM you...
     
    ROBYER1 and michealcaj like this.
  23. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    Hi Pärtel, you are the best for fixing that! Thankyou so much!
    Rob
     
  24. xjqy635

    xjqy635

    Joined:
    Nov 20, 2019
    Posts:
    2
    Hi Pärtel,
    I ran into a problem with Grounder. When Root Rotation Weight > 0, if the character is up into the air (rigidbody is set to kinematic), the character starts to rotate by itself. If Root Rotation Weight is set to 0, it won't happen. Also, when the character is in the air , GrounderIK.solver.isGrounded is true.
    upload_2020-9-23_11-20-10.png
    I need to rotate the character's up to the ground normal, but I don’t want it to rotate in the air, can I use Grounder to solve it?

    Reproduce:
    For the Bot model in the Grounder demo scene, set the rigidbody to kinematic, disable the CharacterThirdPerson script, and place the model in the air.
    upload_2020-9-23_11-21-59.png

    Thanks
     
  25. Kawalyn

    Kawalyn

    Joined:
    Apr 8, 2015
    Posts:
    14
    Hey,

    i'm currently in the process of setting up an IK character in VR - so far i wrote a script to dynamically keep track of the connected Vive trackers and assign them to left/right foot and hip at runtime. Now i'm at the point of calibrating the player size / arm length and am a bit puzzled of how to approach that.

    I know you can set the position/rotation offsets of the tracking targets by positioning/rotating the child of the tracked object - but wouldn't these have to be different every time depending on the initial tracker orientation? As in if i take off the trackers and put them back on they might be rotated differently so the forward axis would be different as well?

    I did get it to work perfectly with a single avatar i set up a few days ago but now that i am working on a "pick your avatar" system i realized that rotations after calibration were all over the place again.

    Sorry if this is a noob question, still figuring out IK and VR :)
    Thanks for your help in advance and thanks for the great FinalIK tool in general as well!

    Kawalyn
     
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    I can't believe nobody encountered this bug all these years. :) Indeed solver.isGrounded always returns true. Please import this patch to fix. Added a condition to GrounderIK to prevent rotating if not grounded. Might have to reduce solver.maxStep when it still rotates when close to ground.

    Hey,
    Have you seen the "VRIK (Calibration)" demo? It uses VRIKCalibrator to calibrate the character to trackers and all the player needs to do basically is stand straight at the time of calibration. In the demo the Pilot represents the player waring the HMD and trackers (green) and the dummy is run by just VRIK after you calibrate it. VRIKCalibrationController still requires for you to define tracker forward and up axes, can't think of a good way around that. Maybe would need to ask player to stand in T pose, then see which axis of the tracker points left/right and up.

    Best,
    Pärtel
     
    ROBYER1 likes this.
  27. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Probably another bug of Asset DB V2, that thing is still in beta stage in my opinion and it's the reason I haven't switched to 2020 yet, since I can't use V1 anymore.
    I doubt it will be fixed soon even if you report it, since saving assets at runtime is kind of a edge case scenario.
     
    ROBYER1 likes this.
  28. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,450
    I will report it soon anyway, just seems I'm the first person to find that bug. Lucky the workaround was easy.
     
  29. shotoutgames

    shotoutgames

    Joined:
    Dec 29, 2013
    Posts:
    290
    Any way to get Interactionobject to work with ECS Hybrid.
    Using PhysicsShape Raycast I find the entity but I can't figure out how to get the interactionObject associated to the entity so I can then call something like this from MB or system without Burst
    Code (CSharp):
    1.  private void Update()
    2.     {
    3.         if ((interactKeyPressed || inputRequired == false) && interactionSystem.inInteraction == false)
    4.         {
    5.             //var weaponItem = manager.GetComponentData<WeaponItemComponent>(e);
    6.             //if (weaponItem.pickedUp == false)
    7.             //{
    8.                 var io = interactionObject;
    9.                 interactionSystem.StartInteraction(FullBodyBipedEffector.RightHand, io, true);
    10.                 interactionSystem.ik.enabled = true;
    11.             //}
    12.  
    13.         }
    14.  
    15.     }
    More of a how to use ECS question so I understand if you don't have anything for me :)
     
  30. unity_3drapidsolutions

    unity_3drapidsolutions

    Joined:
    Nov 18, 2017
    Posts:
    21
    Hi Pärtel,

    Thank you again for such an incredible asset.

    I have a quick question. I am simulating a multi-jointed robotic arm to move realistically so that the tool-tip on the end properly reaches a desired position. I have experimented with the CCD and FABRIK methods with rotation limits for chaining all of the joints together hierarchically and in general the algorithms works exceptionally and the final product looks realistic.

    Here is my question:

    The problem I am running into is that I want the arm to approach the target from a particular approach direction (i.e. a specific vector would be best but a cone would work too) but the IK solution approaches from a different direction. This is important because the robotic arm needs to interact from a specific approach angle. I know that this solution is 'possible' for the IK solver, but I understand why it is not prioritized. Is there a way to add this constraint? I created the attached image to quickly demonstrate the issue. I do not want to modify the rotation limits to force this approach because I want the system to dynamically adjust as the target moves. Essentially, I just want to have control over not only the position it targets, but also the rotation (to some degree, I understand it is likely not possible to solve both simultaneously)
     

    Attached Files:

    Last edited: Sep 27, 2020
  31. Musonica

    Musonica

    Joined:
    Jul 25, 2017
    Posts:
    8
    Hey Pärtel, loving what Final IK can do!

    I've been working on a hybrid guitar player animation rig, and am coming up with some issues:


    At the moment I'm using the FBBIK, with the guitar model linked to the Hip bone,
    the right picking hand uses hand poser targets (children of the guitar),
    the left hand uses a hand poser target with a Finger Rig, so I can say set the left index finger to target the 6th string 3rd fret etc.

    Now I'm kind of hacking things together, and don't have the knowledge to do everything procedurally yet... so I am using a standard avatar animation clip to create basic movement, and overriding the upper body with slight blending to that animation.
    This isnt that robust however and is requiring a lot of fine position and parameter tuning that doesnt carry over well when the pose is changed.

    The issue in the video is by moving the BodyEffector, which is not keeping the hands tracked to the targets on the guitar... maybe its an issue of relative weights or something I dont understand yet... maybe I have to reorder the IK solver processing process... or because its trying to adapt to positions that is linked inside the model instead of external global coordinates and hasnt updated correctly?

    Any help most welcome!
     
  32. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Hey, I just wanted to ask if there are any future version planed as of right now, Is there a roadmap or something,
    And will final Ik support Burst and job system and maybe ECS in the future?
     
  33. Kawalyn

    Kawalyn

    Joined:
    Apr 8, 2015
    Posts:
    14
    Hey Pärtel, thanks for the swift reply, been a bit swamped with other stuff sadly.

    I did test the calibration scene but that just maps the player dummy to the animated soldier with perfectly set up trackers if i see correctly?
    What i ment is if i set my character up with certain tracker rotations and positions and now someone else puts the trackers on, these trackers will be rotated and positioned slightly differently on that person than on me - so by my logic the character would end up slightly twisted because the initial rotating and such has been done with my tracker setup?
     
  34. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Sorry, I have not played around with ECS hybrid enough to give you a solid answer here.

    Hey,
    Yeah, I just recently figured out a way to do that with CCD. Please import this package. It is a CCDBendGoal script. Attach it to a gameobject that you need it to bend towards.

    Hey,
    If you set "Maintain Relative Pos" to 1 in FBBIK arm settings, that would make the hands move along as you move the body effector.

    Hey,
    Yeah, actually I am planning to push another version up next week. Considering the way and frequency in which Unity is updated these days and the number of versions available to us, multiplied by the number of Package Manager tools, preview stuff that either work or not with each Unity version, multiplied by all the 3rd party Asset Store tools you might be using... I want Final IK to be something that you can rely on working with pretty much everything and would not have to think about updating too often and worry about breaking stuff each time. So I will try to do bigger and less frequent releases, about once a year or so.

    About Jobs, DOTS and ECS and all that...
    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. DOTS animation is going to be faster, but most likely not nearly as much as you've seen in some of the DOTS tech demos that are about moving tens of thousands of independent objects.

    It is still possible to use Final IK on top of your Animation Jobs and Animation Rigging, but pure ECS and DOTS versions of Final IK solvers will be developed in the future when those systems have matured and become production ready tools.

    Hey,
    The only way that could be solved would be to ask the player to stand in T-pose prior to calibration.
    Then you can analyze the rotation of the trackers to figure out which way they are worn. FIK package contains a helpful class for it: AxisTools.cs.
    It can be used to find the orthogonal axis of a gameobject that is closest to pointing towards a direction.

    For example if you want to figure out which axis of a foot tracker is pointing towards world space forward while standing in T-pose:

    Code (CSharp):
    1. Vector3 forward = RootMotion.AxisTools.GetAxisVectorToDirection(leftFootTracker, Vector3.forward);
    Then you can feed that to VRIKCalibrationController before calling Calibrate():

    Code (CSharp):
    1. calibrationController.settings.footTrackerForward = forward;
    The same for up axis:

    Code (CSharp):
    1. Vector3 up = RootMotion.AxisTools.GetAxisVectorToDirection(leftFootTracker, Vector3.up);
    2. calibrationController.settings.footTrackerUp = up;
    So when you call Calibrate(), it doesn't really matter any more which way the user has decided to wear the tracker.

    Cheers,
    Pärtel
     
    Ruchir likes this.
  35. Musonica

    Musonica

    Joined:
    Jul 25, 2017
    Posts:
    8
    Re: Guitar avatar
    Hey thanks for the response, I've been exploring solutions, including playing with the relative weight settings as suggested and found it only works as expected if the guitar is external and not a child of the avatar.

    I believe since I was using the hips as a parent for the guitar it doesn't propagate the updated position data correctly in the way I'm approaching it... I'm using basic code to track things:
    ik.solver.leftHandEffector.position = LHTarget.position; ...rotation, positionwieght etc.
    perhaps I need to translate it to updated global coordinates or something. I'm also using elbow guides positioned on the guitar.

    Perhaps it would work correctly if I parent the guitar to a hand? (although I was hoping to avoid this as it isn't the ideal approach currently). It looks like I will have to have some code to dynamically re-parent the guitar in multiple ways and link them to different animations to get everything working for the overall project I'm aiming for.


    Hey,
    If you set "Maintain Relative Pos" to 1 in FBBIK arm settings, that would make the hands move along as you move the body effector.​
     
    Last edited: Sep 30, 2020
  36. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Yeah, can't parent IK targets to bones or set effector positions relative to bones. That is because the solver reads all target positions before it starts solving and the hip and other bones are actually moved by the solver only in the writing step, that is after the solving process in already done. Basically it works like this:

    1. Read - effector positions and other data is fed into the solver
    2. Solve - IK algorithms do their thing based on that data
    3. Write - results are applied to the bones. If the pelvis is moved as a result, it is too late for that to be applied to the hand effectors.

    So it would be best to have the guitar external. You can make a script to make the guitar follow the pelvis in LateUpdate and also add offset to it if you wanna move it left/right. Then make the body effector follow the guitar too.

    Best,
    Pärtel
     
    Musonica likes this.
  37. Emiliana_vt

    Emiliana_vt

    Joined:
    Apr 7, 2018
    Posts:
    13
    Hi,

    first, many thanks for creating these super useful assets!

    Today though, I encountered an odd issue with VRIK twisting the upper arms of models even though no targets are set. It might be related to the types of model I'm using, so first a bit of background. I'm working on a software that lets users import avatars in a model format called VRM and puppeteer them using head and optional hand tracking. VRM models are "normalized" in a way, so that they are in a T pose at import time and that all bones have a local rotation of zero in this pose.

    A video that illustrates this issue can be found here:
    https://www.vseeface.icu/VRIKArms.mp4

    Looking at the bones, the left upper arm is set to a rotation of (-39.938, -2.381, 1.215) and the lower arm is set to a rotation of (39.951, 2.089, 0.41), with both of them being initially at (0, 0, 0).

    Is there any way to avoid this?

    Another thing I was wondering about is whether it is possible to fully lock the pelvis bone in place. I disabled locomotion and have played around with the "maintain pelvis position" value, but if the head target moves too far, the rest of the body will still follow rather than just stopping. This would be quite useful, because the avatars are often supposed to be sitting, and having them hover in their seat can look a bit odd. Any advice about this would be very welcome as well!
     
    Last edited: Oct 3, 2020
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Answered you in a PM with a fix.
     
  39. Emiliana_vt

    Emiliana_vt

    Joined:
    Apr 7, 2018
    Posts:
    13
    Thank you so much for fixing this so quickly! It works perfectly!:)
     
  40. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117

    No, the VRIK starts as enabled, I tried starting it as disabled and then enabling it afterwards, but still didn't work.

    Anything else I can do?

    Many thanks,
    Gabriel.
     
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Did you try my other recommendation, having the Animator disabled on the prefab and enabling it only after ik.solver.initiated returns true?

    Best,
    Pärtel
     
  42. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Hi @Partel-Lang, I think there is a bug in the AimController.
    Even if turnToTarget is false or the controller weight is zero, it still modify the root transform rotation, since there is no check at all on the assignment on line 232.
     
  43. EvanBottango

    EvanBottango

    Joined:
    Aug 19, 2018
    Posts:
    15
    Hi @Partel-Lang. Thanks for Final IK, it's great! I need to have some amount of translation in my ik chain (IE, some bones move in xyz instead of rotate in xyz). I tried looking through this forum to see if that's come up anywhere, but haven't seen it. Do you have any recommendations on how I might achieve that? I'm using a FABRIK solver, and not afraid to get my hands dirty in making needed modifications... just looking for some tips / pointers on the best way to achieve that. Thanks!

    EDIT: One more question. The way my project works, It's essential that I build the hierarchy of my bones such that there's an individual game-object per axis of rotation. So for example, instead of having a single game object representing a u-joint, I have 2 game objects in the same position, one the child of the other, and 2 hinge joints. However, there is the limitation in Final-IK of not allowing 0 length bones. My best thought on how to work around this is to create the correct limits that final IK needs, and then per update translate those back to my needed hierarchy. Is this the best approach, or is there another way you'd recommend?
     
    Last edited: Oct 7, 2020
  44. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Please get this update to AimController, there have been some fixes. Should not rotate when weight is 0.
    But disabling "Turn To Target" won't stop it from rotating the root. That aligns root forward to target direction after "Max Root Angle" has been exceeded. Without it it will still rotate, but only to keep within the limits. So you should set "Max Root Angle" to 180 instead.

    Hey,
    FABRIK algorithm does not know how to solve prismatic joints. It is just the nature of the algorithm, not much I can do about that. But it does allow you to change localPosition of the bones within the chain, it will adapt to that. So what could be done is adding only the hinge and socket joints to FABRIK and driving the prismatic (transational) ones by script.
    For example if the target is far, extend the joint (scale it's localPosition). That stuff should be done in LateUpdate.

    Best,
    Pärtel
     
    00christian00 likes this.
  45. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    Thanks. I am missing GetYaw and GetPitch method however. Could you send me the updated V3Tools class?
    By the way, I still haven't understand the difference between the root rotation after exceeding the max angle and before the max angle.
     
  46. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Oh, sorry, here you go.
    About root rotation, to explain what "Turn To Target" does, consider this scenario:

    Character is standing with the target right in front of it at 0 angles. Max Root Angle is set to 45...
    The target moves to the side and is now at 50 degrees from character forward.

    Turn To Target disabled:
    Root is turned just 5 degrees to respect the 45 degree limit.

    Turn To Target enabled:
    Root is turned 50 degrees smoothly over time (Turn To Target Time) to make the character face the target.
    That smooth turn is triggered every time the limit is exceeded.

    Best,
    Pärtel
     
    00christian00 likes this.
  47. 00christian00

    00christian00

    Joined:
    Jul 22, 2012
    Posts:
    1,035
    I have tried everything but I cannot understand how to use AimController properly with a recoil animation.
    I have an animation with the body that is oriented around 45 degree from the forward vector and without AimController I can set axis to 0,0,1 and it would point in the correct direction.
    If I use AimController in additive mode however the direction of the gun is wrong.
    Setting a static AnimatedAimDirection doesn't seem to work, since the correct value is different for each target.
    How do I calculate it?
     
  48. xjqy635

    xjqy635

    Joined:
    Nov 20, 2019
    Posts:
    2
    Thank you so much for your reply. Sorry to see it so late.
     
    Last edited: Oct 16, 2020
  49. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    195
    Hi Pärtel, I'm trying to integrate MxM Motion Matching with Puppet Muster, but the character doesn't move when the ragdoll is active. What could be the reason for this?
     
  50. XMaymo

    XMaymo

    Joined:
    Mar 2, 2017
    Posts:
    5
    Dear @Partel-Lang, first of all thank you for your amazing job! We're all really greatful for it!

    I have a question regarding the VRIK component, I am trying to simulate a "real death fall", like you do on your game Dead and Buried, second 0:30.
    deadvr.jpg

    What I did was instantiate a new prefab "skin" of the player, copying the components and assigning the same VRIK parameters of the original one.
    So far, so good, the new "skin" appears exactly at the same position and with the same pose than the original one.
    But, after that, when I "break" the player by disabling the VRIK, the animator and the fix transforms of the Full Body Biped IK components, then the new player kind of resets to a standing up pose, and then it falls down.

    Is there any other way around it instead of disabling the VRIK and the other components to get the player to just instantiate on the same position and pose and then fall from there?

    Example:
    deadVR2.jpg

    Thank you so much in advance, any help is really apreciated,

    Xavi