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

    LacunaCorp

    Joined:
    Feb 15, 2015
    Posts:
    147
    You could check out HandPoser.cs, either with or without the use of the InteractionSystem. It will allow you to blend the entire hand in and out of the orientations you need.
     
  2. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    Or you could maybe use the FingerRig.cs
     
  3. zhouzhongcheng_sz

    zhouzhongcheng_sz

    Joined:
    Mar 9, 2015
    Posts:
    6
    I had some characters which imported from 3dmax in the fbx format.They work well in mecanim animations.So I think the rigs is ok.But when I use the character in the final ik's interaction system.I find that they can not work well.I test the character in the demo scene:Interaction.The character will catch the ball,push the button etc.
    1,the arm will rotate ridiculously when the character catch the ball on the ground.The arm has serious distortion.
    2,the hand can not put just well on the ball.Even if I add HandPoser component to the hand of the character.

    And my question is how to solve the two problems.
     
  4. wirelessdreamer

    wirelessdreamer

    Joined:
    Apr 13, 2016
    Posts:
    134
    I just got the updates from Partel with hip rotation an weight implemented. It works perfectly. Thank you for the level of support you provide for your software, its some of the best I've ever seen.
     
    Partel-Lang likes this.
  5. kt5881

    kt5881

    Joined:
    Jul 26, 2014
    Posts:
    21
    I have a character holding a sword with two hands.. I am trying to work on him tightly hold the sword with the Interaction Pick Up 2-Handed character demo scene as reference. However! When I apply the same script from the demo scene to my project... The avatar's whole body seems to be being attached to the sword when I only need his hands... Please help me trying to get both hands to the object using Final IK
     
  6. LacunaCorp

    LacunaCorp

    Joined:
    Feb 15, 2015
    Posts:
    147
    Depends on whether only the finger should move, or if the hand should be repositioned slightly for added realism, so you aren't dealing with multiple component blending. If it's just for the single finger that would be preferable.
     
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Solving fingers with IK is really a big waste of CPU in most cases. If you don't have animation for the fingers, remember you can create it in Unity using the Animation Window. You can add another Animator to the hand or get a package of humanoid finger animations and add them on a new layer in Mecanim with a mask only for the hands.

    Hey,
    Different characters have different bone orientations. The targets set up in the interaction demo were set up using the hand bone orientations of the Dummy. You'll have to replace the Dummy's hands in the targets with your character's hands.

    Hey,
    It might be easier to do it not with the InteractionSystem, but just parenting hand targets to the sword.
    Just like in the "Carry Box" demo.

    Best,
    Pärtel
     
  8. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    Hi Partel, I'm having trouble trouble with a jitter on my character's left arm when I'm aiming. I've adapted your second hand on gun code and your 3rd person ik controller into the script below. The jitter is worse when I'm aiming around but it seems like if my characters left arm is stretching a bit far to position the hand on the gun. This happens when the gun is on the right side of the body. If I could remove the jitter or get the gun to position closer when the arm had to stretch too far that would be great.

    Here's a video of the issue.


    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using RootMotion.FinalIK;
    5. using Goon;
    6. using RootMotion;
    7.  
    8. public class SecondHandOnGun : MonoBehaviour
    9. {
    10.     public AimIK aim = null;
    11.     public FullBodyBipedIK ik;
    12.     public LookAtIK look;
    13.     [SerializeField]
    14.     private Transform lookTarget;
    15.     private Transform staticLookTarget;
    16.     public Recoil recoil;
    17.     private Quaternion rightHandRotation;
    18.     public Vector3 gunHoldOffset;
    19.     public Vector3 leftHandOffset;
    20.  
    21.     [SerializeField]
    22.     private Transform pistolTransform;
    23.  
    24.     private IKEffector leftHand { get { return ik.solver.leftHandEffector; } }
    25.     private IKEffector rightHand { get { return ik.solver.rightHandEffector; } }
    26.  
    27.     private Vector3 leftHandPosRelToRightHand;
    28.     private Quaternion leftHandRotRelToRightHand;
    29.  
    30.     // Use this for initialization
    31.     void Start ()
    32.     {
    33.         aim.enabled = false;
    34.         look.enabled = false;
    35.  
    36.         //this is to prevent elbow from turning inside out when shooting
    37.         ik.solver.SetLimbOrientations(BipedLimbOrientations.UMA);
    38.  
    39.         staticLookTarget = ObjectReferences.player.GetComponentInChildren<StaticLookTarget>().transform;
    40.     }
    41.  
    42.     void OnEnable()
    43.     {
    44.         look.solver.target = lookTarget;
    45.         look.enabled = false;
    46.         aim.enabled = true;
    47.  
    48.         if (aim != null && aim.solver != null)
    49.         {
    50.             aim.solver.transform = pistolTransform;
    51.         }
    52.  
    53.         if (ik != null) ik.solver.OnPreRead += OnPreRead;
    54.     }
    55.  
    56.     void OnDisable()
    57.     {
    58.         look.solver.target = staticLookTarget;
    59.         look.enabled = true;
    60.         aim.enabled = false;        
    61.  
    62.         leftHand.positionWeight = 0f;
    63.         rightHand.positionWeight = 0f;
    64.         aim.solver.transform = null;
    65.         if (ik != null) ik.solver.OnPreRead -= OnPreRead;
    66.     }
    67.  
    68.     // Update is called once per frame
    69.     void LateUpdate ()
    70.     {
    71.         // Find out how the left hand is positioned relative to the right hand rotation
    72.         Read();
    73.  
    74.         aim.solver.IKPosition = look.solver.IKPosition;
    75.         aim.solver.Update();
    76.  
    77.         rightHandRotation = ik.references.rightHand.rotation;
    78.  
    79.         Vector3 rightHandOffset = ik.references.rightHand.rotation * gunHoldOffset;
    80.         ik.solver.rightHandEffector.positionOffset += rightHandOffset;
    81.  
    82.         if (recoil != null) recoil.SetHandRotations(rightHandRotation * leftHandRotRelToRightHand, rightHandRotation);
    83.  
    84.         ik.solver.Update();
    85.  
    86.         // Rotating the hand bones after IK has finished
    87.         if (recoil != null)
    88.         {
    89.             ik.references.rightHand.rotation = recoil.rotationOffset * rightHandRotation;
    90.             ik.references.leftHand.rotation = recoil.rotationOffset * rightHandRotation * leftHandRotRelToRightHand;
    91.         }
    92.         else
    93.         {
    94.             ik.references.rightHand.rotation = rightHandRotation;
    95.             ik.references.leftHand.rotation = rightHandRotation * leftHandRotRelToRightHand;
    96.         }
    97.  
    98.         // Rotate the head
    99.         look.solver.Update();
    100.     }
    101.  
    102.     private void Read()
    103.     {
    104.         // Remember the position and rotation of the left hand relative to the right hand
    105.         leftHandPosRelToRightHand = ik.references.rightHand.InverseTransformPoint(ik.references.leftHand.position);
    106.         leftHandRotRelToRightHand = Quaternion.Inverse(ik.references.rightHand.rotation) * ik.references.leftHand.rotation;
    107.     }
    108.  
    109.     // Final calculations before FBBIK solves. Recoil has already solved by, so we can use it's calculated offsets.
    110.     // Here we set the left hand position relative to the position and rotation of the right hand.
    111.     private void OnPreRead()
    112.     {
    113.         Quaternion r = recoil != null ? recoil.rotationOffset * rightHandRotation : rightHandRotation;
    114.         Vector3 leftHandTarget = ik.references.rightHand.position + ik.solver.rightHandEffector.positionOffset + r * leftHandPosRelToRightHand;
    115.         ik.solver.leftHandEffector.positionOffset += leftHandTarget - ik.references.leftHand.position - ik.solver.leftHandEffector.positionOffset + r * leftHandOffset;
    116.     }
    117.  
    118.     // Cleaning up the delegates
    119.     void OnDestroy()
    120.     {
    121.         if (ik != null) ik.solver.OnPreRead -= OnPreRead;
    122.     }
    123. }
    124.  
     
  9. Ruchir

    Ruchir

    Joined:
    May 26, 2015
    Posts:
    934
    This might sound a bit silly but can you tell me the difference between AimIK and LookAtIK?:confused:
     
  10. kt5881

    kt5881

    Joined:
    Jul 26, 2014
    Posts:
    21
    Yes I've tried that the first time. However, then whenever my avatar does some animation the hands and the sword is fixed to it's original position... can you elaborate on the usage of pivots and hold points in your "interaction Pick Up 2-Handed" demo scene?
     
  11. jhnissin

    jhnissin

    Joined:
    Sep 7, 2015
    Posts:
    27
    Hey,

    We are trying to use the Leap Motion hands with a humanoid avatar in Unity 5.5.1f1. We are trying to use Final IK (VRIK) to solve the rest of the arm rotations when giving the Leap Motion hand world positions and rotations as targets. However, we are facing some problems with the area between the wrist and the elbow stretching in order to match the hands (see: attached picture). The hands (palms + fingers) are working pretty much as expected though as they are tracked with the Leap Motion.



    Does anyone have any idea what we should do in order to use Final IK to solve for the rest of the arm? To be honest, at the moment it looks like the hand position doesn't have any effect on the rest of the arm.
     
  12. chelnok

    chelnok

    Joined:
    Jul 2, 2012
    Posts:
    680
    I think i can answer for this.
    AimIK = aim with weapon (move your hands, head, upper body..)
    LookAtIK = look at something (turn your head, upper body..)
     
    Partel-Lang likes this.
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    What is the update mode of your Animator?

    Not silly at all.
    LookAtIK is very similar to Unity's built-in IK's look at function. It is just an easy way to handle looking at stuff for biped characters and you can define just how much the spine or the head will bend. It can also be used for the eyes.

    AimIK is a modification of the CCD algorithm, it just bends a hierarchy of bones so that a child of it (Aim Transform) becomes aligned with a certain direction.

    I suggest you try both and see which works best for your specific use case.

    In that 2-handed demo the objects have hand targets parented to them. They are just duplicates of the hand hierarchies that have been posed to the object (duplicate the character, pose it's hand bones to the object, parent the hand bones to the object and delete the rest of the character). The character has HandPoser.cs on it's hands, the InteractionSystem will use them to lerp the localRotations of the fingers to match the hierarchies of the hand targets.

    The pivots are used for just rotating the hand targets if the object is approached from a different angle.

    Best,
    Pärtel
     
  14. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    You were just moving the hand bones to the leap hands and then using VRIK on top of that? VRIK would solve using a broken rig with the hands pulled away from the forearms.

    Try instead to assign the leap hands (actually empty gameobjects parented to them so you could rotate the targets to compensate for different bone orientations) as VRIK hand targets.
     
  15. jhnissin

    jhnissin

    Joined:
    Sep 7, 2015
    Posts:
    27
    Hey we came to the same conclusion and we solved for the time being.

    We used the Leap Motion Rigged Hands as Inverse Kinematics targets and rigged the avatar hands using the auto rigging script. We modified the RiggedHand script so that the avatar's hands do not use the position of the hand and palm, but still uses the rotations and positions of the fingers. This way we get the finger tracking and the valid inverse kinematics targets that we wanted.
     
  16. fup

    fup

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

    When I attempt to adjust the PuppetMaster's hand collider positions to better match the character it breaks the puppetmaster and he just collapses.

    How do i go about adjusting the local position of a puppetmaster collider? Is it possible?
     
  17. nostro66

    nostro66

    Joined:
    Aug 19, 2014
    Posts:
    5
    Hi,
    I'm using Limb IK together with Grounder IK for correct foot placement on a ground. I'm fighting with incorrect bending of legs. Depending of character pose while initializing IK, legs are correctly bent in Idle or Walk animation only.
    Bend Modifier: Animation
    Bend Modifier Weight: 1
    Also I have a warning in console: "first bone position is the same as second bone position". But they are not in the same position.
     

    Attached Files:

  18. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
     
  19. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I also have an issue where if I don't start my character's parent at 0,0,0 then the hands are messed up.
     
  20. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    I had a bad experience with this asset.
    I purchased it and tested with two of my legacy animated character models.
    "Casually" it didn't work as expected, in any of them. The animation was corrupted when applied Final IK and the models pose was changed make them unusable.
    I tried to contact the developer for support but he never answered my emails. I had to request a refund.
    The author finally told me he was very busy because he had so many customers.
    I don't recommend this asset.
     
    Last edited: Feb 28, 2017
  21. imaewyn

    imaewyn

    Joined:
    Apr 23, 2016
    Posts:
    211
    Hello. Have some problems with mixamo models.


    I need to turn out interaction target for correct work. Don't see any troubles in avatar mapping but picture shows that something wrong))
    Default model with FBBIK coincides fully
     
    Last edited: Feb 28, 2017
    ROBYER1 likes this.
  22. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Do not move the ragdoll gameobjects, use RagdollEditor to move the colliders or move Collider.center manually. The positions of the muscles must match the positions of their targets. If you have accidentally moved the ragdoll gameobjects, right click on PuppetMaster's header and select "Fix Muscle Positions" from the context menu.

    Hey,
    LimbIK samples the pose of the character at Start to know which way to bend them, are you adding LimbIK by code somewhere in the middle of the game?

    Would it be possible for you to make some kind of a repro for me to take a look at? Otherwise it's just a lot of guesswork.

    I'm sorry, which email did you send your unanswered support requests from and to which email, because I don't remember any recent case about FIK not working with Legacy. I am quite sure I have not left any emails unanswered. Sometimes my answers are delayed for a couple of days when there are many requests or for personal reasons, but I have certainly never refused providing support "because I have so many customers", that is just not true. If anyone has doubts whether I provide support or not, just track my activity in this thread over the last 3 years. But please, point me to whatever it was that made you unhappy, I really am confused here.

    Hey,

    Had targets are not universal, in that demo, the interaction targets were set up for the dummy, meaning I duplicated the dummy, posed it's hands to the box and parented the hand bones to the interaction targets, deleting the rest of the dummy. If you use another character that has different bone orientations, you'll have to redo that. If hand and finger bone orientations match (for example if you have many Mixamo characters) then you can use the same targets for all of them.

    Characters originating from the same software (3ds Max, Maya, Fuse..) usually have the same bone orientations. So there is no need to define the targets for each individual character, but for characters from different origins.

    If you have some characters from Max and some from Fuse you'll have to parent both posed hand hierarchies to the InteractionTarget. Then you can tag them. InteractionSystem has a "Target Tag" slot, if that is filled in, the InteractionSystem will only use the hand targets that have the same tag.

    Cheers,
    Pärtel
     
  23. nostro66

    nostro66

    Joined:
    Aug 19, 2014
    Posts:
    5
    Hi, I figured the Bend Modifier by Animations depends heavily to Roll orientation of UpLeg. Even if a Knee is in the same space location, but UpLeg Roll is different from initial pose, then the result is incorrect bending of leg.
     
    Last edited: Feb 28, 2017
  24. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Yes, it uses the orientation of the up leg to define the bending direction. If it didn't, youd' see many other problems with the bending direction violently changing.

    Have you tried other bend modifiers?
     
  25. nostro66

    nostro66

    Joined:
    Aug 19, 2014
    Posts:
    5
    Yes, I have tried all the bend modifiers. Best result gives by Animation. Is there a way to do not count with roll orientation of up leg?
     
  26. MathiasNorregaard

    MathiasNorregaard

    Joined:
    Mar 1, 2017
    Posts:
    5
    Hey guys.
    I'm trying to figure out having a player avatar with physics. The IK trackers are Oculus Rift for spine, Leap Motion for hands and Oculus Touch controllers for feet. Having the VRIK script and colliders at the same time doesn't work very well. I noticed that if I disable the VRIK script, collisions work as expected, but with it on, the colliders just very rarely work. It's like they're being overruled by the IK.

    When looking in the editor, the colliders move along fine with the avatar, but as mentioned, not working. Any idea at all what the right structure for working with IK avatars and colliders is? I checked the Layer matrix, everything is in order. Something must be wrong.
     
  27. imaewyn

    imaewyn

    Joined:
    Apr 23, 2016
    Posts:
    211
    Thank you for answer. I've tried to set character hands in correct pose and duplicate they instead old dummy hands.
    Thats how it looked in editor (if you give advice how choose two hands gizmos at the same time it will be great)


    But in runtime I still have problems


    Maybe I forgot change some weight for fingers? Don't know where this settings.
    If problem in unnatural bone position relative to each other then fingers from default T-Pose should works correctly, but even in this case I see this after interaction with box (box is hidden)


    This is character in T-Pose and finger positions in stand animation (I use animator controller from dummy)



    Also I would like to know if any way to check bone position of character in editor. If I prepared some idle for hands but shoulders were unnaturally splayed...Is it means that hands can't take the desired position because shoulders prevent it?
     
    Last edited: Mar 2, 2017
  28. MathiasNorregaard

    MathiasNorregaard

    Joined:
    Mar 1, 2017
    Posts:
    5
    By the way, we have, for every Collider in the body, a Rigidbody on that gameobject. It seems, even though the rigidbody is kinematic, it 'twitches' and moves the position of the transform, so it looks like the rigidbody is fighting with something.
     
  29. LacunaCorp

    LacunaCorp

    Joined:
    Feb 15, 2015
    Posts:
    147
    Hey Pärtel,

    I'm working through a couple of issues with update order and have a fix but unfortunately it brings it's own issues because I'm using the InteractionSystem, would appreciate some pointers as far as the best route goes.

    So, the overview is that I'm pinning (or trying to, rather) the left hand to a weapon. Because of the solver update order, when I set the effector positions, the right arm solves first and then the left arm receives the wrong position somehow. I checked this by forcing a full FBBIK update after setting only the left hand effector, then I set the right and forced another update, and it got the right position (it didn't fully work, though, it wasn't following properly). The gun is a child of the right hand- if I nullify the gun's parent, then the left hand reaches the correct position (this is not feasible for a few reasons, however).

    So, for whatever reason (pretty sure it's down to the right arm updating before the left, though), FBBIK is basically not taking the positions given to it. For reference:



    Positions log out as equal; one on the left is where the effector actually is, on on the right is where the effector target position is. The effector position is directly set to the target position.

    I'm using the interaction system for other stuff and it would seem that I can't disable FBBIK and only update manually given my current setup. Any idea as to why this is happening, in case it's something else? I'd like to be able to fix this without having to change the hierarchy, since it would mean additional references to cache and work with.

    Cheers,
    -Josh
     
    Last edited: Mar 2, 2017
  30. khos

    khos

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

    I would like to ask if you know of a digging animation being available for final IK, or how much it would take to implement? I suppose I can use a spade as parent for effectors, then animate the spade? Any advice would be much appreciated.
     
  31. ColtonKadlecik_VitruviusVR

    ColtonKadlecik_VitruviusVR

    Joined:
    Nov 27, 2015
    Posts:
    197
    Hey @Partel-Lang,

    Any word on when the next update will be released? And is there any updates/improvements to the VRIK system in the next update?

    Cheers,
    Colton
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    No, but the next version of FIK will have LegIK, a solver specifically for 4-segmented legs, it might be more suitable for your use case. FIK 1.6 is already submitted for review, PM your invoice number if you need that right away.

    Hey,
    Didn't quite understand, is it just a ragdoll with joints attached to the controllers and you also want to use IK on it?

    Hey,
    Do you have HandPoser components on the hands of the character? (not the duplicate hands)
    If you rotate the target hand pose fingers, will it change anything with the character's fingers?

    Could you send me a repro or a video or something, I'd need to take a closer look to understand this.

    Hey,

    The left hand ends up in the wrong place because the right hand moves away in the solving process. FBBIK can not update left hand target if the right hand moves.

    You'll have to set left hand target position/rotation relative to right hand target position/rotation, not right hand bone position/rotation.

    Hey,
    I don't have a digging animation, but it would probably be easier to animate it in a 3D app than make it procedurally from scratch.

    Hey,

    FIK 1.6 was sent to the store for review a couple of days ago and it is all mostly about fixes/improvements to VRIK. Here are the release notes:

    Version 1.6

    Improvements

    1. Added footstep events to VRIK locomotion.
    2. Added VRIK support to the Leap Motion integration package.
    3. Added a scene with VRIK set up for Oculus Rift (Assets/Plugins/RootMotion/FinalIK/_Integration/Oculus.unitypackage).
    4. Added a scene with VRIK set up for Steam VR (Assets/Plugins/RootMotion/FinalIK/_Integration/Steam VR.unitypackage).
    5. Added the “VRIK (Moving Platform)” demo scene to help with VR characters set up on moving objects.
    6. Added the “VRIK (Twist Relaxers)” demo scene to help with updating twist bones after VRIK has solved.
    7. Added “Min Head Height” to VRIK spine settings. The head of the avatar will not be lowered past that even if the player is lying down on the ground.
    8. VRIK can now work with any root rotation, meaning you can use it on walls, ceilings or while floating in space.
    9. VRIK will update footstep rotation while the foot is stepping.
    10. Added relaxLegTwistMinAngle and relaxLegTwistSpeed to VRIK locomotion. That rotates the footstep while the leg is not stepping to relax the twist rotation of the leg.
    11. Added the “VRIK (Grounder)” demo scene.
    12. VRIK will work with characters that have no chest bone.
    13. Added “Pelvis Rotation Weight” to VRIK.
    14. Added a new component, LegIK, an analytic solver for a 4-segment leg.
    15. Added the “Leg IK” demo scene.
    16. Removed “Parent”, “Child”, “Twist Axis” and “Axis” from TwistRelaxer, they will be calculated automatically for easier setup.
    Fixes

    1. Fix to VRIK arm solver, blends out all changes to arm bone rotations with arm position weight.
    2. Updated the Leap Motion integration package.
    3. Moved CameraControllerInspector to “Shared Demo Scripts” so FIK could be imported without demo assets.
    4. InteractionSystem will not use trigger colliders unless they have an InteractionTrigger component.
    5. Fixed InteractionTrigger scene view GUI box for Retina screens and Unity 5.4.
    6. Fixed a bug with VRIK locomotion when setting Time.timeScale to 0.
    7. IKExecutionOrder will not ignore Fix Transforms and will work with Animate Physics update mode.
    8. RotationLimit will not set default orientation in Awake if SetDefaultLocalRotation() has been called.
    9. Fixed a NullReferenceException when adding FBBIKHeadEffector in runtime.
    10. Fixed a bug with VRIK that did not blend shoulderRotationWeight properly if arm position weight was less than 1.
    11. Fixed a bug with FBBIK limb mapping accuracy.
    12. No more Array out of range error when calling VRIK.solver.Reset before the solver has initiated.
    13. Fixed a VRIK spine twitch when working with super-human sized characters.
    14. Fixed a bug with TwistRelaxer moving the hand away from it’s position when the twist bone was not aligned orthogonally to the arm.

    Changes

    1. Removed obsolete virtual reality demos and assets. Use this link if you still need them for reference.
    2. Added relaxLegTwistMinAngle and relaxLegTwistSpeed to VRIK locomotion. Set relaxLegTwistSpeed to 0 to maintain FIK 1.5 behaviour.
    3. Renamed “VRIK (Beta)” demo scene to “VRIK (Basic)”.
    4. Updated minimum supported Unity version to 5.3.6f1.
    5. Moved Plugins/Editor/RootMotion to Plugins/RootMotion/Editor.
     
  33. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Sorry to ask Partel, but I cannot seem to get it right, how do I change a bipedIK (Full Body Biped IK) master weight via C# or JS? I cannot see any property in the API for this? Is it bipedIK.SetSpineWeight ?
     
  34. Desoro

    Desoro

    Joined:
    Apr 30, 2016
    Posts:
    9
    Hello, I would appreciate some quick advice.

    What I am trying to accomplish:

    Use the FBBIK's Right Arm Effector to hold a weapon in the Player's hand and maintain this when animations change the bone rotations (strafing/walking horizontal) without actually rotating the character.

    My current setup is:

    Currently, I have the target setup and FBBIK script setup exactly how I want it and everything looks natural and smooth. The target is parented to the Player so it keeps its position/rotation relative to the Player.

    The issue is:

    When strafing or walking diagonal, the target doesn't move with the bones so it's basically stuck in place while the animation moves the Player making it unnaturally held to the left or right. Do you have any advice on how to keep the target relative to the bones it is effecting? I have struggled to find a solution as it can't be relative to them, because IT is moving them. I am sure there is an easy solution, I just can't think of it.

    Thanks!
     
  35. fup

    fup

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

    I'm attempting to calibrate a puppermaster VRIK character. I have the overall scale working okay but struggling with the shoulders and arms. To calibrate the shoulder width I'm following your earlier advice and adjusting the positions of the shoulder transforms. First of all I set PuppetMaster::mode to disabled, then I move the positions of the shoulders (the rig and the PM rig) , then set PuppetMaster::mode to Active. However, as soon as PM goes active the system pulls all the transforms back into their starting positions. (Note, this is with no animator component. If I have an animator it also restores the positions, but that's a problem I'll solve later!)

    What do I have to adjust to ensure that the PM system operates ok with the new positions and does not restore them?

    Thanks
     
  36. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Ah , I think I found it, nevermind :)
     
  37. Ninekorn

    Ninekorn

    Joined:
    Aug 12, 2016
    Posts:
    66
    Hello guys here is a video I made that uses hand poses from Final IK. Turn down the volume I didn't knew bandicam would record the volume. The video is about having complete control over a sword in a third person game. I am trying to developp the concept but I need help.

    Final Ik is awesome. I just wanted to share the thing with everyone.

    Anyway here it is


    If you wanna help come here:
    https://forum.unity3d.com/threads/need-help-on-sword-attack-concept.455461/
     
    Last edited: Mar 6, 2017
  38. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    You could make a script that lerps the position/rotation of the weapon to a pos/rot relative to one of the bones of the character:

    Code (CSharp):
    1. public Transform parent;
    2.     public float interpolationSpeed = 5;
    3.  
    4.     private Vector3 defaultRelativePos;
    5.     private Quaternion defaultRelativeRot = Quaternion.identity;
    6.  
    7.     void Start() {
    8.         defaultRelativePos = parent.InverseTransformPoint (transform.position);
    9.         defaultRelativeRot = Quaternion.Inverse (parent.rotation) * transform.rotation;
    10.     }
    11.  
    12.     void LateUpdate() {
    13.         transform.position = Vector3.Lerp(transform.position, parent.TransformPoint(defaultRelativePos), Time.deltaTime * interpolationSpeed);
    14.         transform.rotation = Quaternion.Lerp (transform.rotation, parent.rotation * defaultRelativeRot, Time.deltaTime * interpolationSpeed);
    15.     }
    Add that script to the box in the "Carry Box" demo and set Parent to spine or hips to see what I mean.
    You can add character root's delta pos/rot to transform.position/rotation before the interpolation code to make it move in sync with the character controller and not fall behind.

    Hey,
    Make sure you have "Update Joint Anchors" and "Support Translation Animation" enabled in PuppetMaster. No need to disable PuppetMaster.

    Hey,
    Use
    Code (CSharp):
    1. transform.rotation = Quaternion.FromToRotation(targetPosition - transform.position, transform.rotation * axis) * transform.rotation;
    to rotate an axis of an object towards a target.

    Cheers,
    Pärtel
     
  39. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    I have those enabled. They make no difference. I've now edited my code so that the PM is always enabled as you suggest. The problem persists.

    In my code, I attempt to move the position of the shoulders (in the rig). Like this:

    heroLeftUpperArm.position = midPoint + toLeftShoulder * averageShoulderToMidlineDistance;

    This does not work. In the editor I can see the limb quickly flash as adjusted then it immediately reverts back to the original.

    If PM is set to 'kinematic' the code *does* move the limb but when i then change the mode to 'Active' the new position is lost and the puppet reverts back to the original.

    I have tried making the script execute *after* the IK stuff. Doesn't make a difference. I've tried LateUpdate. Makes no difference.

    There are no other scripts or components running that could interfere with this. It appears to me that something inside the PM code is responsible but I don't know where to look. Everything works as expected if the PM component is disabled.

    <EDIT> I've since discovered that I can get it to work by applying the positional changes *every* LateUpdate instead of once. Is this how I have to do it?
     
    Last edited: Mar 6, 2017
  40. wmpunk

    wmpunk

    Joined:
    Sep 5, 2015
    Posts:
    71
    Loving FinalIK so far! I just have a few questions I was wondering if you could help me with.

    Is there a attribute somewhere or a wrapper class or something that allows me to make a bone list the way they are in the components? I can't seem to find any inspector code for it. If not it would be awesome if you included a attribute next release :)

    Is there a proper way to get transform positions and rotations of IK positions? I noticed that when you try to get transform data from a bone that has IK applied its not correct. To solve this I made a method retrieves that data I need and add it the the OnPreUpdate delegate of the solver which gives me the IK transform data.Then after the solver is updated manually I save the current transform data which has reverted back to pre IK and set the current data to the OnPreUpdate data. I then reset the transform data back before the next solver update.
    It goes something like this.

    Code (CSharp):
    1.  
    2. Vector3 IKPosition;
    3. Vector3 LastPosition;
    4. IKSolver solver;
    5.  
    6. void Start()
    7. {
    8.    solver += GetIKPosition;
    9.    LastPosition = transform.position;
    10. }
    11.  
    12. void GetIKPosition()
    13. {
    14.     IKPosition = this.transform.position;
    15. }
    16.  
    17. void LateUpdate()
    18. {
    19.    this.transform.position = LastPosition;
    20.    solver.Update();
    21.    LastPosition = transform.position;
    22.    this.transform.position = IKPosition;
    23. }
    24.  
    It seems to work but seems like a rather odd process. Is there something simpler I am missing?

    Side note: This code might not work, It only works a exact specific way so I might have ordered it wrong, and trying to use the OnPostUpdate delegate for setting the transforms doesn't seem to work the same as putting the code after solver update. It is the same with setting the transform to last position, it has to be before the solver update, not the OnPreUpdate delegate.
     
    Last edited: Mar 6, 2017
  41. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Yes, you have to apply the changes in every LateUpdate if there is anything reverting the localPosition of the bones. It could be Mecanim or it cound be the "Fix Target Transforms" toggle of PuppetMaster or the "Fix Transforms" toggle of any IK component you might be using there.

    Hey,

    The custom editors for IK components were made before Unity introduced custom property drawers. I don't think the bone list editors could be easily taken out of FIK and used elsewhere. I am planning to revisit the editors at some point though, try to convert to property drawers and attributes.

    You can read the bone positions as animated in LateUpdate:

    Code (CSharp):
    1. void LateUpdate() {
    2. Vector3 animatedPos = bone.position;
    3. }
    Or by using solver.OnPreUpdate, which is safer to use if you are using Animate Physics as animator update mode:
    Code (CSharp):
    1. void Start() {
    2. ik.solver.OnPreUpdate += BeforeIK;
    3. }
    4.  
    5. void BeforeIK() {
    6. Vector3 animatedPos= bone.position;
    7. }
    Then you can use ik.solver.OnPostUpdate delegate to read the position of the bone after IK has applied:

    Code (CSharp):
    1. void Start() {
    2. ik.solver.OnPostUpdate += AfterIK;
    3. }
    4.  
    5. void AfterIK() {
    6. Vector3 ikPos = bone.position;
    7. }
    No need to update the solver manually for that.

    Cheers,
    Pärtel
     
  42. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    How do I rotate the collider of a PM character? I have this to fix:

    upload_2017-3-7_10-2-7.png

    If I rotate it to the correct position in the editor (with or without the ragdoll editor)the puppet just falls through the floor as soon as i run the scene.

    Thanks!
     
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Rotating the collider should not break it. You probably also moved the gameobject, which will break it, since muscle positions must match with their targets. (Right-click on PM header, select "Fix Muscle Positions" if you accidentally moved them.) So rotate the foot, but instead of moving the foot, move the collider using RagdollEditor or do it manually by adjusting Collider.center.

    Another way to fix it would be to add a new gameobject to the foot muscle and move the collider from the foot to the new gameobject, it will work as a compound collider and you can rotate it.
     
  44. fup

    fup

    Joined:
    Jan 18, 2016
    Posts:
    76
    Did this get resolved? I'm having a similar problem when an animator is enabled.
     
  45. JamesK24

    JamesK24

    Joined:
    Feb 28, 2017
    Posts:
    20
    Hello guys I am having major difficulties applying FBBIK to UMA the Unity Multiplayer Avatar. With couple of scripting via Playmaker I have successfully applied BIPED FBBIK to my UMA. However with the Grounder FBBIK... Do I have to make another script inserting the Biped IK values to the grounder FBBIK once the UMA character is created just like I have made the script to insert the reference data to the FBBIK once UMA is created?
     
  46. zeb33

    zeb33

    Joined:
    Nov 17, 2014
    Posts:
    95
    Hi, are there any tutorials on using VRIK with steamVR(controllers disabled) & leapmotion? Can get orion and steamvr demos working separately but unable to get both together. Should the hand controller be moving with camera rig? Thanks
     
  47. tapawafo

    tapawafo

    Joined:
    Jul 25, 2016
    Posts:
    170
    Just got the new update, just wanted to say - amazing work! The staggering is so awesome, it really adds sooo much to the puppets. It's seriously impressive.

    Thank you for the update! :)
     
  48. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Yes, turned out to be a Generic animation clip used on a Humanoid character. Disable VRIK and see if your animation looks OK without any IK.

    Hey,
    Here's the code for you:
    Code (CSharp):
    1. FullBodyBipedIK ik = gameObject.AddComponent<FullBodyBipedIK>();
    2.         BipedReferences references = new BipedReferences();
    3.         BipedReferences.AutoDetectReferences(ref references, transform, BipedReferences.AutoDetectParams.Default);
    4.         ik.SetReferences(references, null);
    5.  
    6.         GrounderFBBIK grounder = gameObject.AddComponent<GrounderFBBIK>();
    7.         grounder.ik = ik;
    8.         grounder.solver.layers = LayerMaskExtensions.Create("Default");
    Hey,
    Use the Orion demo to start with, then just duplicate the head bone, parent it to the HMD controller and move it to the right place, then assign it as the head target in VRIK.

    Thanks for dropping by just to say that, glad you like it! :)

    Cheers,
    Pärtel
     
  49. zeb33

    zeb33

    Joined:
    Nov 17, 2014
    Posts:
    95
    Thanks Pärtel, I just have to work out now why hands are upside down - though think this is leapmotion issue rather than anything FBIK related
     
  50. Griffo

    Griffo

    Joined:
    Jul 5, 2011
    Posts:
    700
    @Partel-Lang Hi, did I read somewhere that you can now share 1 puppet between similar models?

    If so can you or someone please point me to any information on how to do it, thanks.