1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Are you an artist or level designer going to Unite Europe? Join our roundtables there to discuss artist features.
    Dismiss Notice
  6. Unity 5.6 is now released.
    Dismiss Notice
  7. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

FINAL IK - Full Body IK, Aim, Look At, FABRIK, CCD IK... [1.0 RELEASED]

Discussion in 'Assets and Asset Store' started by Partel-Lang, Jan 15, 2014.

  1. JamesK24

    JamesK24

    Joined:
    Feb 28, 2017
    Posts:
    15
    Hey partel, First of all I am using FBBIK and Grounder IK for my UMA.

    I have a golf swing animation for the avatar and the IK is mainly used for the UMA to tightly grip the golf club.

    In the animation, the pelvis below part of the body, the lower part of the body is very stable even when the upper body is conducting a full swing.

    Now when I put IK into the UMA the lower part of the body goes up and down... and seems like he's sitting up and down while he is swinging.

    Is there a function in FBBIK or Grounder IK that I can use to turn off anykind of IK influence below pelvis?
     
  2. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hi, sorry for the delay!

    just call behaviourPuppet.SetState(BehaviourPuppet.State.Unpinned), then foreach through all of the puppetMaster.muscles and use AddExplosionForce on muscle.rigidbody.

    Hey,
    If you write
    Code (CSharp):
    1. ik.solver.IKPosition = ik.solver.bone3.transform.position
    in each LateUpdate, the IK will keep the foot where it is animated.

    Hey,
    FIK is not a tool for animation authoring (at lease yet), it is mostly used to modify existing baked animation to better fit the dynamic game environment. Stuff like foot placement correction, procedural interactions, rigs for driving, riding, etc. The package contains over 50 demos so please see my YouTube channel to see what can be done. Some of those videos are about my other asset, PuppetMaster.

    Technically yes, using Vive trackers, although I haven't tested that field much yet.

    Hey,
    Try adding TwistRelaxer.cs to the forearm bone.

    Best,
    Pärtel
     
    Griffo likes this.
  3. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    998
    Thanks for that!
     
  4. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    4,347
    Hey Partel,

    I have a dependency issue I'm trying to work out. Using physics I have a tall pipe dangling from above which I want a biped to walk to, grab, make a physics joint to his hand and walk it over to a different position. The pipe moves up and down vertically and the physics joint allows it.

    This currently works okay and FinalIK isn't giving me any problems but the character just stabs his wrist into the pipe because that is the goal point and where the physics joint is attached to. I'm not really sure how to get around the problems of using a physics joint and an IK goal offset with this. The goal point has to be precise because some math figuring the goal out is aiming the pipe at some specific points that have to line up accurately. Do you have any tips on how to best approach this?

    Thanks
     
  5. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey, just make a new gameobject for the hand IK target and parent it to the object you want to hold, then you'll be able to adjust the target's localPosition/Rotation to make it look just right.

    Cheers,
    Pärtel
     
  6. ryancampfire

    ryancampfire

    Joined:
    Jan 4, 2017
    Posts:
    6
    So in the VRIK it has the Locomotion settings where it tries to decide where to put the feet, when to make a step, etc. are there similar things in other rigs? For example, if I wanted just legs with no arms, and controlled the position of the pelvis and it tries to position the feet based on that. Maybe I can go through the contents of VRIK.cs and separate out what I need, but if there's an existing approach I'm overlooking, let me know, thanks.
     
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey,
    Sorry, VRIK's locomotion doesn't work as an independent solver.
    But if you don't have any upper body, you can create a virtual invisible one. If you do, you could use a script like this to reset the upper body to how it was animated after VRIK is done:

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.FinalIK;
    4.  
    5. public class MaintainUpperBodyAnimation: MonoBehaviour {
    6.  
    7.     public VRIK ik;
    8.     public Transform firstSpineBone;
    9.  
    10.     private Transform[] upperBody = new Transform[0];
    11.     private Quaternion[] localRotations = new Quaternion[0];
    12.  
    13.     void Start() {
    14.         upperBody = firstSpineBone.GetComponentsInChildren<Transform>();
    15.         localRotations = new Quaternion[upperBody.Length];
    16.  
    17.         SampleUpperBodyAnimation();
    18.  
    19.         ik.solver.OnPostUpdate += AfterIK;
    20.     }
    21.  
    22.     void LateUpdate() {
    23.         SampleUpperBodyAnimation();
    24.     }
    25.  
    26.     void AfterIK() {
    27.         for (int i = 0; i < upperBody.Length; i++) {
    28.             upperBody[i].localRotation = localRotations[i];
    29.         }
    30.     }
    31.  
    32.     private void SampleUpperBodyAnimation() {
    33.         for (int i = 0; i < upperBody.Length; i++) {
    34.             localRotations[i] = upperBody[i].localRotation;
    35.         }
    36.     }
    37. }
    Best,
    Pärtel
     
  8. ryancampfire

    ryancampfire

    Joined:
    Jan 4, 2017
    Posts:
    6
    If I apply it all to an invisible rig, would it even matter if it's moving around?

    EDIT: Hah I just tried it and the whole upper body keeps spinning around and the feet do a dance in a circle. So that may answer my question. :) I'll try with the code to steady the upper body.
     
    Last edited: May 25, 2017
  9. makeshiftwings

    makeshiftwings

    Joined:
    May 28, 2011
    Posts:
    3,056
    Hi, I just started using FinalIK, and I'm trying to have a third-person player's gun aim at the point the camera is aiming at, based on the Third Person Shooter demo you've included. I'm having an issue with timing. Currently I'm getting the camera LookAt point early in Update(), but I'm also using ootii's MotionController and CameraController which move the camera in LateUpdate(), and then (I think?) FinalIK's AimIK happens in FixedUpdate. So the actual camera LookAt point is not consistent throughout the frame or between Update and FixedUpdate, resulting in a lot of jitter in the weapon when spinning around. I'm trying to sort out the order here and could use any advice. :) I'm going to follow ootii's advice to get the Camera LookAt position immediately after it happens in LateUpdate, but how can I get the AimIK to happen after that but before the next frame, so as to avoid the jitter?
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey,
    Try enabling "Fix Transforms" first though.

    Hey,
    FIK components normally update in LateUpdate, but after your own LateUpdates as they have added theirselves to a very high value in the Script Execution Order. Anyway, you can disable any FIK component at Start and call
    Code (CSharp):
    1. ik.solver.Update();
    any time you please.

    Cheers,
    Pärtel
     
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hi all,
    I'll be in Germany from 27th to 5th for a brief vacation, so support might be slower than usual for the next week, sorry.


    Best,
    Pärtel
     
  12. cygnusprojects

    cygnusprojects

    Joined:
    Mar 13, 2011
    Posts:
    409
    Enjoy your well deserved vacation!
     
    Partel-Lang likes this.
  13. FlyHigh

    FlyHigh

    Joined:
    Dec 30, 2014
    Posts:
    78
    Those would be really nice to have. Tweaking animations to get new (baked) animations and making animations (like mocap) completely from scratch with Vive trackers or other hardware. Really hoping that this will come soon.
     
  14. FlyHigh

    FlyHigh

    Joined:
    Dec 30, 2014
    Posts:
    78
    This is also something I hope gets implemented soon, hopefully.
     
    matteumayo likes this.
  15. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    42
    Partel: How would you suggest network syncing VR-IK Avatars? I'm currently using photon for multiplayer, and starting to try and get avatars in sync.
     
  16. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    87
    I was wondering if you could please help me. I've written a code that allows me to walk while holding an item with two hands. Now I want to be able to use the script with separate items while just replacing the interaction object and pivot in the inspector and also added interaction trigger too.

    However when I duplicate the item and change the values in the inspector, the character stll grabs both items instead of the one that the interaction trigger is on.

    This is the code.
    Code (CSharp):
    1. {
    2.  
    3.         protected abstract void RotatePivot();
    4.  
    5.         public InteractionSystem interactionSystem; // The InteractionSystem of the character
    6.         public InteractionObject obj; // The object to pick up
    7.         public Transform pivot; // The pivot point of the hand targets
    8.         public Transform holdPoint; // The point where the object will lerp to when picked up
    9.         public float pickUpTime = 0.3f; // Maximum lerp speed of the object. Decrease this value to give the object more weight
    10.  
    11.         public FullBodyBipedIK ik;
    12.  
    13.         private float holdWeight, holdWeightVel;
    14.         private Vector3 pickUpPosition;
    15.         private Quaternion pickUpRotation;
    16.  
    17.  
    18.         void Start()
    19.         {
    20.             // Listen to interaction events
    21.             ik.solver.OnPreUpdate += BeforeIK;
    22.  
    23.             interactionSystem.OnInteractionStart += OnStart;
    24.             interactionSystem.OnInteractionPause += OnPause;
    25.             interactionSystem.OnInteractionResume += OnDrop;
    26.         }
    27.  
    28.  
    29.         // Called by the InteractionSystem when an interaction is paused (on trigger)
    30.         private void OnPause(FullBodyBipedEffector effectorType, InteractionObject interactionObject)
    31.         {
    32.             if (effectorType != FullBodyBipedEffector.LeftHand) return;
    33.             if (interactionObject != obj) return;
    34.  
    35.             // Make the object inherit the character's movement
    36.             obj.transform.parent = interactionSystem.transform;
    37.  
    38.             // Make the object kinematic
    39.             var r = obj.GetComponent<Rigidbody>();
    40.             if (r != null) r.isKinematic = true;
    41.  
    42.             // Set object pick up position and rotation to current
    43.             pickUpPosition = obj.transform.position;
    44.             pickUpRotation = obj.transform.rotation;
    45.             holdWeight = 0f;
    46.             holdWeightVel = 0f;
    47.         }
    48.  
    49.         // Called by the InteractionSystem when an interaction starts
    50.         private void OnStart(FullBodyBipedEffector effectorType, InteractionObject interactionObject)
    51.         {
    52.             if (effectorType != FullBodyBipedEffector.RightHand) return;
    53.             if (interactionObject != obj) return;
    54.  
    55.             // Rotate the pivot of the hand targets
    56.             RotatePivot();
    57.  
    58.             // Rotate the hold point so it matches the current rotation of the object
    59.             holdPoint.rotation = obj.transform.rotation;
    60.         }
    61.  
    62.         // Called by the InteractionSystem when an interaction is resumed from being paused
    63.         private void OnDrop(FullBodyBipedEffector effectorType, InteractionObject interactionObject)
    64.         {
    65.             if (effectorType != FullBodyBipedEffector.LeftHand) return;
    66.             if (interactionObject != obj) return;
    67.  
    68.             // Make the object independent of the character
    69.             obj.transform.parent = null;
    70.  
    71.             // Turn on physics for the object
    72.             if (obj.GetComponent<Rigidbody>() != null) obj.GetComponent<Rigidbody>().isKinematic = false;
    73.         }
    74.  
    75.         void BeforeIK()
    76.         {
    77.             if (holding)
    78.             {
    79.                 // Smoothing in the hold weight
    80.                 holdWeight = Mathf.SmoothDamp(holdWeight, 1f, ref holdWeightVel, pickUpTime);
    81.  
    82.                 // Interpolation
    83.                 obj.transform.position = Vector3.Lerp(pickUpPosition, holdPoint.position, holdWeight);
    84.                 obj.transform.rotation = Quaternion.Lerp(pickUpRotation, holdPoint.rotation, holdWeight);
    85.             }
    86.         }
    87.  
    88.         // Are we currently holding the object?
    89.         private bool holding
    90.         {
    91.             get {
    92.                 return interactionSystem.IsPaused(FullBodyBipedEffector.LeftHand);
    93.             }
    94.         }
    95.  
    96.         // Clean up delegates
    97.         void OnDestroy()
    98.         {
    99.             if (interactionSystem == null) return;
    100.  
    101.             interactionSystem.OnInteractionStart -= OnStart;
    102.             interactionSystem.OnInteractionPause -= OnPause;
    103.             interactionSystem.OnInteractionResume -= OnDrop;
    104.         }
    105.  
    106.         void Update ()
    107.         {
    108.  
    109.         }
    110.  
    111.         void OnGUI()
    112.         {
    113.         // If not paused, find the closest InteractionTrigger that the character is in contact with
    114.         int closestTriggerIndex = interactionSystem.GetClosestTriggerIndex ();
    115.  
    116.         // ...if none found, do nothing
    117.         if (closestTriggerIndex == -1)
    118.             return;
    119.  
    120.         // ...if the effectors associated with the trigger are in interaction, do nothing
    121.         if (!interactionSystem.TriggerEffectorsReady (closestTriggerIndex))
    122.             return;
    123.                     // Its OK now to start the trigger
    124.             GUILayout.Label ("Press B to start interaction");
    125.  
    126.  
    127.             if (Input.GetKey (KeyCode.B))
    128.             {
    129.                 interactionSystem.TriggerInteraction (closestTriggerIndex, false);
    130.                 theRealPickUp ();
    131.             }
    132.         }
    133.  
    134.  
    135.     void theRealPickUp()
    136.     {
    137.         if (Input.GetKeyDown (KeyCode.B) && !holding)
    138.         {      
    139.             interactionSystem.StartInteraction (FullBodyBipedEffector.LeftHand, obj, false);
    140.             interactionSystem.StartInteraction (FullBodyBipedEffector.RightHand, obj, false);
    141.         }
    142.  
    143.         else if (Input.GetKeyDown (KeyCode.B) && holding)
    144.         {
    145.  
    146.             interactionSystem.ResumeAll();
    147.  
    148.         }
    149.  
    150.  
    151.     }
    152.  
    153.      
    154. }
     
    Last edited: May 31, 2017
  17. GloriaVictis

    GloriaVictis

    Joined:
    Sep 1, 2016
    Posts:
    31
    Hello!

    I am new into Final IK solutionand I cannot pass the issue attached on that gif:
    https://i.gyazo.com/cef22afb90a2b9a7e12ff2197e86cce1.gif

    When I am using Grounder there's something really strange going with character spine, seems like entire body is being "sqeezed" instead of just leg going down the bench. Anyone could tip me what I am doing wrong?
     
  18. SeaScout

    SeaScout

    Joined:
    Mar 23, 2016
    Posts:
    6
    Hi,

    I understand this is not specifically your problem, but would appreciate any clues or insight into what may be going on here.

    I'm am trying to get Final IK to work together with the Obi Cloth asset from Virtual Method, and am running into some issues. I am unable to get both assets to function correctly together when applied to the same character. I can get either the cloth or the IK to work, but not both at the same time.

    In this example I'm trying to get IK foot placement to work with Obi cloth, e.g a character walking over uneven ground (spheres) while wearing simulated clothing.

    If I take a character rigged with Obi cloth (for example the Obi CharacterCloth demo scene), add some uneven terrain to collide with, then set up Final IK "GrounderFullBodyBipedIK" to collide with the ground as described here: http://www.root-motion.com/finalikdox/html/page11.html and press play, The Character mesh is locked in a T-pose while the Obi cloth animates. If I turn off "Fix Transformations" on the Full Body IK Script, the character is animated and foot placement IK works as expected, but the cloth exhibits high frequency flickering, rapidly displacing up and down.

    In the Final IK docs here http://www.root-motion.com/finalikdox/html/page13.html (see "combining IK components - Animate physics") it mentions that if the character animator is using Animate Physics (Obi Solver uses Animate Physics), you need to check if FixedUpdate() has been called before the IK solver is updated in LateUpdate(), otherwise the IK solver will be updated multiple times before the Animator overwrites the pose, causing the character to flicker. If I do this, (using the Final IK "IKExecutionOrder" script) there is no noticeable difference, the IK works but the cloth is still flickering.

    Looking at the script execution order I can see the Obi solver is executing before all of the final IK components. If I change the execution order so that Obi solver is executing after Final IK, the IK solver works and the cloth does not flicker. However, the Obi cloth then does not seem to take into account the position of the skinned mesh vertices after they have been transformed by Final Ik, i.e the cloth is simulated, but it looks like its using the skinned mesh vertex positions before they have been displaced by Final IK.

    At this point I'm not sure how to proceed and would appreciate any insight. It seems like it is a problem with the order and or frequency in which the Final IK solver and Obi solver are executed.

    Cheers!
     
  19. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    245
    This looks like a great plugin, but I have a question before purchase. Looking at the examples, this requires animation clips to function? I thought I could save some time from writing my own IK Aim, but mine doesn't require animation clips as it's all done from code by lerping AvatarIKGoal targets and that's my primary goal to do away with time consuming animating. Am I incorrect in this assumption?
     
  20. dmitryshm

    dmitryshm

    Joined:
    Feb 17, 2014
    Posts:
    1
    Please answer me why CCD IK "Mech spider.unity" scene shows me the buggy behavior on Unity 5.4.0f3?
     
  21. ChrisCF

    ChrisCF

    Joined:
    Dec 23, 2014
    Posts:
    2
    I'm having some trouble with child chains using FABRIK with the FABRIK Root. Child chains suffer from a slow gradual stretch, with the joints becoming further apart when the child chain uses rotation limits. This problem is worse for grandchildren, but still happens for a single child chain. It is also worse for the joints near the end of the child chain. It can be reproduced in the FABRIK root demo scene by making an empty gameobject to use as a target. Then using it as the target for "chain 0_1". Move the target in and out of the distance the end of the chain can reach a couple of times then move it out of reach and zoom in on the end of the chain. Watch as the head of the chain slowly separates. (you may need to do the in and out of range thing a couple of times before it breaks. Then it will move very slowly, the longer you leave it the worse the chain gets). This image is after several minutes.

    upload_2017-6-6_14-42-22.png

    This is in Unity 5.6.0f3 using Final IK 1.6.1

    "Fix Transforms" works around this, or disabling the limits on the chain. Neither of which I want to do. The behaviour of the solver with Fix Transforms produces poor solutions as the target is moved around. And the rotation limits are needed for my setup.

    Any ideas on how to fix this properly?
     
  22. hitmanchoi

    hitmanchoi

    Joined:
    Apr 10, 2015
    Posts:
    15
    can Full Body Biped IK be used in editor mode? without actually pressing the play button?
    for example if i have body effector, hand effector, and leg effector targets (all with 1.0 full weight) and place them in the editor,
    is there a function that i can call in editor mode to have the humanoid positioned like it would in playmode?
     
  23. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hi all, I'm back from my vacation, thank you all for your patience! :)

    Hey,
    Just sync all the IK targets, have each client solve their own IK. Also, it's best to sync the target positions/rotations relative to the root of the character, not in world space, that's how you make sure the IK targets don't fall behind if the character is respawned via an RPC call or whatever and that happens to be out of sync with the updating of the targets.

    Hey,
    Not sure I understood you right, but check the "Interaction Object" in the InteractionTrigger component (under Interactions), make sure both triggers don't point to the same interaction object.

    Hey,
    The problem must be with the FullBodyBipedIK component, not the grounder. Looks like the pelvis bone in it's References might not the right bone, but a child of the real pelvis bone. Weigh in one of the hand or foot effectors and drag the character by it, see if it works right if you replace the pelvis. Can't tell if that is indeed the case or if it's something else without more info.

    Hey,
    Yes, it is about the update order of things. The update order you need is:
    - FixTransforms (only necessary if you don't have animation running on all the bones)
    - Animator update (normally between Update and LateUpdate, unless you are running in Animate Physics mode)
    - Final IK
    - Obi

    You can disable any FIK component at start and update it manually by calling ik.solver.Update() whenever you need.

    But the makers of Obi just wrote to me and said their next version will be fully compatible with both Final IK and PuppetMaster so if you have time, you can just wait for that or write to them and ask if they can send you their latest.

    Hi!

    FIK components basically work as layers on top of your animation. You don't need to have animation at all, if you enable "Fix Transforms", the pose of the character will be reset to what it was at Start before each solver update, you can create fully IK-controlled animation if you need to.

    Hey,
    I tried to reproduce it, enabled rotation limits, added a new gameobject as the target of chain 0_1, moved it in and out of reach many times, didn't see any displacement of joints though. Were there any other parameters you changed in that scene?

    Hey,
    Yes, use this script to update any FIK component in editor mode:
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. using RootMotion.FinalIK;
    4.  
    5. [ExecuteInEditMode]
    6. public class EditorIK : MonoBehaviour {
    7.  
    8.     private IK ik;
    9.  
    10.     void Start() {
    11.         ik = GetComponent<IK>();
    12.  
    13.         ik.GetIKSolver().Initiate(ik.transform);
    14.     }
    15.  
    16.     void Update() {
    17.         if (ik == null) return;
    18.  
    19.         if (ik.fixTransforms) ik.GetIKSolver().FixTransforms();
    20.  
    21.         // Apply animation here if you want
    22.  
    23.         ik.GetIKSolver().Update();
    24.     }
    25. }
    26.  
    27.  
    28.  
    Cheers,
    Pärtel
     
  24. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    87

    I just checked, they are not pointing to the same object. I'm sure of that. When I try to pick up the object, the character still picks up all objects that have the script on.
     
  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey,
    What are you using that theRealPickUp() method for? interactionSystem.TriggerInteraction should already trigger the interaction for you.
     
  26. ChrisCF

    ChrisCF

    Joined:
    Dec 23, 2014
    Posts:
    2
    Hi Partel-Lang,

    I've made a video that shows the issue . You can see the issue clearly starting at about 12 and 40 seconds (I placed the mouse cursor on the edge of the mesh to make the movement more visible). Note: the video is sped up x4. The drift can also be far worse than that while manipulating the target in and out of reach a lot, especially if the chain is a grandchild rather than just a child. It doesn't just effect the last joint in the chain either, but it is worst on that joint.

    The video was made using an empty project with just FinalIK imported and the FABRIK Root demo opened. You can see at the start, all I did was turn on use rotation limits and set the target.

    I suspect it's a slow accumulation of floating point math errors building up, but I'm not sure how best to fix it if that is the problem.

    Chris
     
  27. SeaScout

    SeaScout

    Joined:
    Mar 23, 2016
    Posts:
    6
    Thank you!
     
  28. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    87
    I'm using it to interact with the interaction trigger. I have it set up so that, when you enter the interaction trigger and press the button, the character picks up the box and and when you press the button again the character drops it.
     
  29. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey, I see it now, thanks!
    Please open IKSolverFABRIK.cs, scroll down to the bottom and replace the last method (MapToSolverPositionsLimited()) with this:
    Code (CSharp):
    1. private void MapToSolverPositionsLimited() {
    2.             bones[0].transform.position = bones[0].solverPosition;
    3.  
    4.             for (int i = 0; i < bones.Length; i++) {
    5.                 if (i < bones.Length - 1) bones[i].transform.rotation = bones[i].solverRotation;
    6.             }
    7.         }
    This change will be added to the next version, thank you for helping me improve the package!

    Hey,
    Any chance you could send me a repro project or something? Really difficult to guess without seeing the full setup.

    Best,
    Pärtel
     
  30. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    87
    I sent you a link to a dropbox file with the scene.
     
  31. jough

    jough

    Joined:
    Aug 18, 2013
    Posts:
    37
    Trying to enable and disable specific avatars that are all using VRIK systems (Allowing players to switch their in game models at runtime). However when enabling a new model / VRIK system, instead of snapping to the new position it walks (rather quickly) to the player position from where it was previously disabled at.
    I've tried setting the VRIK transforms position directly and calling the Reset() function in the solver after, but it still doesn't snap to a new position.

    TL;DR: Any insight on how I can achieve setting the VRIK system to snap to a specific position at a specific frame?
     
  32. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    220
    Did you get your answer?
    I think the IK/script cannot find the collider underneath?
     
  33. marvalshot

    marvalshot

    Joined:
    Dec 29, 2013
    Posts:
    105
    Before I dive into this I am looking for a proper workflow.
    If you have a player with 100 animations. Each with different pins, bones used, aim transforms. Some with attachments on the bones (for weapons maybe) etc. How to setup? I can't imagine setting up each with a new skeleton / IK scripts and such. But I also don't know about setting up 1 fbbik / Aim IK for the player and being able to make all the changes needed for each particular animation. Any advice? Thanks all.
     
  34. ftejada

    ftejada

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

    Have you advanced in the update to solve the problem of the "grounder in tessellation" with Megasplat?

    Regards!!
     
  35. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey,
    Please use ik.solver.AddPlatformMotion() to teleport a VRIK character that has locomotion enabled. There is a script example in VRIKPlatform.cs and the "VRIK (Moving Platforms)" demo.

    Hey,
    It's probably that the layer setup is different in the project that you imported Final IK into. Try that scene in a new project or check the "Raycast Layers" in the MechSpider component.

    Hey,
    Not sure I understood you right. The number of animation clips you have should not matter at all, I mean IK works pretty much the same with any animation. FIK components work like a layer on top of your normal animation, if you pin a hand to something, it will be pinned no matter what animation is playing.

    Hey,
    I was working on it with the MegaSplat guy, I got the IK part done, but there were some problems with getting the correct tessellation height from the texture, MegaSplatCollisionInfo did not return the correct height for a raycast hit point so the foot placement was still off. The last we spoke he said he was working on it and I was waiting on that until I forgot. Anyway, just asked him if there has been any progress on that.

    Cheers,
    Pärtel
     
  36. ftejada

    ftejada

    Joined:
    Jul 1, 2015
    Posts:
    259
    Okay. Thank you I will also ask jbooth
     
  37. marvalshot

    marvalshot

    Joined:
    Dec 29, 2013
    Posts:
    105
    Thanks.
    It's really not a FinalIK issue so any help is a plus. Just a unity programming workflow thing I guess.
    I'll try to simplify.
    1 player prefab. Playing 100 different animations. From what I gather in order to really optimize the animation you need to play with the "settings". Ideal Pin Placement. Selected bones. Aim Transforms. Effector. etc.
    So is the typical way to do this to create 100 "copies" of your player . Each with different Final IK settings and components to match the specific animation? Or is there a method (General programming method) to easily make changes to the IK settings from scripting.
    I'm just imagining a scenario where I create one prefab. with the necessary IK components, and then being able to just change the Final IK settings all from one script to matchup with all the different animations.
    Thanks again
     
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey,
    He said he'll take another look this week...

    Hey,
    I don't think you'll need to define settings for each animation state, but if you do, I think the best way would be to use the StateMachineBehaviours.

    Best,
    Pärtel
     
  39. PostmodernJ

    PostmodernJ

    Joined:
    Dec 5, 2016
    Posts:
    2
    Partel, A couple of questions i'm struggling with.

    firstly, what is the Csharp script code and required associations for changing the (master) weight in the FBBIK
    component in runtime from another script/object in unity?

    Secondly I'm instantiating a character in runtime from a prefab, and trying to pass the required variables to the attached component scripts on instantiating, One of the scripts is derived from your script (see below), and requires the interactionObject in the inspector ,ie the gameobject that has the interaction object component (drag object on) to be set before runtime.

    How do I pass this variable to the newly instantiated version of this script that starts in runtime and has this information missing? I cant workout how to get/set the <Getcomponent> variables through the InteractionSystem and InteractionObject associations from other scripts/objects or even how to set the interactionObject with a gameobject in this script at runtime.

    many thanks for consideration.



    using UnityEngine;
    using System.Collections;

    using RootMotion.FinalIK;



    [RequireComponent(typeof(InteractionSystem))]
    public class DerivedfromfinalIK : MonoBehaviour {
    public GameObject ball;
    private Ball Ball;



    [Tooltip("The object to interact to")]
    [SerializeField] InteractionObject interactionObject;
    [Tooltip("The effectors to interact with")]
    [SerializeField] FullBodyBipedEffector[] effectors;

    private InteractionSystem interactionSystem;

    void Start ()
    {Ball = ball.GetComponent<Ball>();}
    void Awake() {interactionSystem = GetComponent<InteractionSystem>();}
     
  40. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey,
    To set master weight of FBBIK:
    Code (CSharp):
    1. ik.solver.IKPositionWeight = something;
    Not sure I understood the other question. If the interaction object is on the ball, can you just use
    Code (CSharp):
    1. interactionObject = ball.GetComponent<InteractionObject>();
    in Awake?
     
  41. PostmodernJ

    PostmodernJ

    Joined:
    Dec 5, 2016
    Posts:
    2
    I swear I tried that and failed, but both working now so thank you very much.
     
  42. namdo

    namdo

    Joined:
    Feb 23, 2015
    Posts:
    87
    Thanks for your help with the issue I had, Its working now. I have another question about IK and animations. I want to have a character pull out an object with 2 hands. I know IK and animations are supposed to work hand in hand.

    The question is how would I go about doing that. I have an animation pulling out the object. So do I just use IK to attach the hands to the object?
     
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    1,388
    Hey,
    Yes, just parent new gameobjects to the object and use them as hand IK targets.

    Best,
    Pärtel
     
  44. Ctttdaddy

    Ctttdaddy

    Joined:
    Mar 17, 2015
    Posts:
    8
    Hello,

    I am using VRIK and using it with Vive

    My hands are lined up but my problem is with the wrist. Is there a way to twist the forearm instead of the actual wrist after a certain amount? It looks like when I face my palms to my face the wrist twists unnaturally. Is it a setting that I can modify to get the desired result? Everything looks fine as long as I do not look at my palms. Great asset. This is the only problem I have noticed. I am not sure it this is a problem with my model's bones or the IK implementation. My model has a single forearm bone and I have noticed your Pilot model has a few extra.
    Thanks


    Thanks!
     
  45. Jerrith

    Jerrith

    Joined:
    Sep 8, 2015
    Posts:
    6
    I had this exact problem. Here's the answer Partel-Lang gave me (and it works well!):

     
    Ctttdaddy likes this.
  46. DrakoRex11

    DrakoRex11

    Joined:
    Aug 9, 2015
    Posts:
    3
    im trying to create custom ccd chains with rotational limits, but i also need them to align with the targets rotation. ive used several solvers before, most of them allowing this, but not having rotationjal limits, until i broke down and got what is obviously the best ik solver for unity currently, but this cannot accomplish what i need either it seems?
    joint/trig IK WOULD solve this if there was an unlimited number of joints, but they are also overcomplicated compared to the normal ccd chain for my needs. am i missing something or is this unimplemented?

    note: here are my reasons for use, if it helps,
    i am creating a custom VR rig that will support both digitigrade legs, and plantigrade legs, as well as wings and tails, so my intention is to use generic CCD chains, with the targets being the hand controllers, head with headset coords, and a simple foot placement script with an animation layer, and so on. so i need positional AND rotational retargeting, as well as rotational limits, with 4~5 bones. the generic ccd lacks rotational retargetting, while the other scripts either too short bone chains or are not meant for abstract armatures. sorry if im hassling, just been saving up for a while and im annoyed and so on.
     
    Last edited: Jun 23, 2017 at 3:56 AM