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

    laurentAA

    Joined:
    Mar 7, 2019
    Posts:
    3
    Hi Partel, we use BipedIK on our projet and we have a bug when we open it on a Mac Silicon with M1 Chip using the same Unity version. In unity when we move the target for the hand of our character at runtime, the hand can't reach the target, it moves a little but it's like the elbow is locked and can't open enough, any idea? It works well on any other Mac we have. thanks
     
  2. DarKRealm

    DarKRealm

    Joined:
    Oct 12, 2017
    Posts:
    2
    Maybe a stupid question but where is this option? Gone?
     
  3. PiedraViviente

    PiedraViviente

    Joined:
    Sep 26, 2021
    Posts:
    9
    Partel,


    I just purchased FinalIK and Puppetmaster last night and I am looking forward to exploring their functionality as I prototype my project.


    I am going through your FinalIK tutorials from the beginning, in sequence, and I ran into a problem with the InteractionSystem Part 1 tutorial and I was hoping to get some help. When I test the interaction by pressing the ‘start interaction with sphere’ button at (2:30 in the video tutorial), nothing happens. I’m hoping that I’m just overlooking something simple, but I can’t see what is going wrong.


    To clarify, I started a new 3D project and only imported FinalIK. I am using the shared assets Dummy character and idle animation controller is assigned. The FBBIK and interaction system components are assigned to the character with their default values, the interaction system test GUI script component is also assigned to the character with the sphere added as the interaction object and the left hand effector chosen from the drop down list. The sphere’s transform is appropriately placed. The sphere gameObject has the mesh collider removed, the interaction object component added with the position weight bell-curve assigned. As far as I can tell, everything is as per the tutorial. I am using Unity ver. 2020.3.20f1.

    Answer: Nevermind, it was a simple fix. I overlooked the link to the patch in the video description. If anyone else has this problem they can download the patch here:
    https://www.dropbox.com/s/gs1mgfsbbitww2w/InteractionEffectorNoTarget.unitypackage?dl=0
     
    Last edited: Nov 23, 2021
  4. Rispat-Momit

    Rispat-Momit

    Joined:
    Feb 14, 2013
    Posts:
    265
    Hi Partel!

    Thank you for your earlier assistance!!! Your IK mechanics work wonderfully with my game :)

    I have a question. Is there a simple script for changing the rotation of a bone? I need my character to just lean his back when carrying something.

    Thank you for your time!

    Best,

    Petros
     
  5. Khang_Pham

    Khang_Pham

    Joined:
    Feb 28, 2021
    Posts:
    13
    Hi Partel,

    I wanted to ask what the difference is between
    A) just a GrounderVRIK setup
    vs.
    B) 2 LimbIK components, GrounderIK + IK Execution Order (like in the demo scene)

    for foot placement correction with VRIK? Is there any performance or quality difference between these two setups?
     
  6. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey, about changing speed on resume>
    Code (CSharp):
    1.  private void Start()
    2.     {
    3.         interactionSystem.OnInteractionResume += OnInteractionResume;
    4.     }
    5.  
    6.     void OnInteractionResume(FullBodyBipedEffector e, InteractionObject obj)
    7.     {
    8.         interactionSystem.lookAt.weightSpeed = something;
    9.     }
    10.  
    About multiple targets, can call interactionSystem.lookAt.Look(Transform target, float time);

    Each InteractionTarget under the InteractionObject has the "Interaction Speed Mlp" parameter. So you can have different speeds for different characters and different effector types too.

    Hey,

    Looks like the feet are pinned to the foot trackers, do you have foot trackers? Can just remove them from the Calibrate() call if you don't.

    Hey,
    There's no platform-specific code in FIK, so no idea, maybe a bug in Unity. Do you see any errors or anything?

    Hey,
    I had to hide them because of Unity editor scripting limitations. Because I added 2 tabs to the locomotion module using [ShowIf] attribute and custom drawers, but can't do that with UnityEvents, it breaks their default drawer and they are an insanely complex thing to write a custom drawer for. They are still there though internally, can add footstep events via script now:

    Code (CSharp):
    1. private void Start()
    2.     {
    3.         ik.solver.locomotion.onLeftFootstep.AddListener(OnLeftFootstep);
    4.     }
    5.  
    6.     void OnLeftFootstep()
    7.     {
    8.         // Play SFX
    9.     }
    Hey,
    Sure is:
    Code (CSharp):
    1. public Vector3 spineOffset; // local space
    2. public Transform spine;
    3.  
    4. void LateUpdate() {
    5.     spine.localRotation *= Quaternion.Euler(spineOffset);
    6. }
    Hey,
    The difference is that GrounderVRIK doesn't work. It got into the previous version by accident, has been removed in the latest. Grounder can't use VRIK leg solver because it uses the toe bones.

    Best,
    Pärtel
     
    Rispat-Momit and Khang_Pham like this.
  7. gliealonso

    gliealonso

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

    I have a VRIK with puppetmaster setup, and the left hand prop muscle that I use for holding weapon doesn't stay in the correct rotation, it always points about 30 degrees down, and when I set the rotation to the correct one, it always goes back to the wrong rotation whenever I start the game. The right one is fine.

    My question is: Is there a way to set a rotation for the prop muscle that will stay correct?

    Many thanks,
    Gabriel.
     
  8. ExtraMedicated

    ExtraMedicated

    Joined:
    Jun 4, 2017
    Posts:
    1
    I was having a weird issue with the GrounderFBBIK not initiating unless I selected the character in the scene hierarchy.
    (I use a script to instantiate the character and add all the components according to a .json file when starting.)
    I eventually found that I never assigned the ik property of GrounderFBBIK, but apparently, it gets assigned automatically when inspecting it in the editor. I have it working now, but I just thought that was kinda weird.

    (This asset's awesome, BTW. My previous game would not have been feasible for me without this.)
     
  9. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Hello All!

    Was wondering what the workflow would look like for initializing an interaction object at the point where it's picked up?

    My use case is I have an animation clip for drop item. When the character drops an item from the inventory, an interaction object is initialized already in characters hands(like it is with the interaction system ball pickup tutorial but at the point where it's been reparented to the hand), then start playing the animation clip. at the point where the animation let's go of the object, I would add a rigibody and unparent the interaction object so it falls to the ground but can be picked up again via the normal interaction system.
     
  10. gliealonso

    gliealonso

    Joined:
    Oct 21, 2018
    Posts:
    117
    The issue I described above has also been happening with non VR Characters, the colliders is where the correct rotation should be:
    upload_2021-12-1_14-53-58.png
     
    Last edited: Dec 1, 2021
  11. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Is your BehaviourPuppet set to "Unmapped" normal mode? Could explain why the collider doesn't match with the mapping. If so, there could be an internal collision or joint limits preventing the prop from reaching the correct angle. Does it work if you disable "Internal Collisions" and "Angular Limits" in PM?

    Hey,
    Yeah, it's actually an editor script that assigns the IK property in editor mode so that's why it doesn't work if you add it via script in play mode.

    Hey,
    If you already have animation to drop the item, could use an animation event to call a method that adds the rigidbody and unparents the InteractionObject. I don't think there's anything else you'd need to do with that.

    Cheers,
    Pärtel
     
    jimmygladfelter likes this.
  12. reinfeldx

    reinfeldx

    Joined:
    Nov 23, 2013
    Posts:
    164
    Hey Pärtel, when I import Final IK a folder is created in Assets called _TerrainAutoUpgrade. Do you know the reason for this and if it's safe to move it or delete it? I'm on Unity 2021.1.17f1

    Looking closer, it looks like it is a duplicate of the same folder within RootMotion\Shared Demo Assets
     
  13. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83

    Im trying to make a method that will basically take an "interaction object" and parent it to an effector.
    Im using this to initialize a player holding an orb.
    Then I will play a drop item animation and then unparent the orb and add a rigibody for the drop effect after a certain time.


    Code (CSharp):
    1. public void ParentToLimb ( GameObject go, FullBodyBipedEffector effectorType ) {
    2.             IKEffector effector = this.fullBodyBipedIK != null ? this.fullBodyBipedIK.solver.GetEffector(effectorType) : null;
    3.             if ( go != null && effector != null ) {
    4.                 go.transform.SetParent(effector.bone);
    5.             }
    6.         }
    Im not sure what next steps I need to do to make the hand hold it in the same position like the interaction system does. For now Im just doing the above which literally just parents it to the bone at 0,0,0....which looks like the below image, but my goal is to instantiate an object in the hands of the character with him holding the orb. I know its possible Im just new to final IK. I successfully implemented picking up this same object with the interaction system.

    upload_2021-12-8_22-29-16.png

    Just looking for next steps to get him holding the orb. Thanks!
     
  14. CW3MH6

    CW3MH6

    Joined:
    Jul 4, 2013
    Posts:
    14
    We've been using FinalIK for a long time now, but we are having some issues with GrounderQuadruped where it causes a noticeable jitter on our animals. It seems to be a result of pelvis adjustments. Is there any way to reduce this jitter? The jitter is mainly noticeable in the upper torso/head
     
  15. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    You can nuke it if you don't mind the terrain in the Grounder demo breaking.

    Hey,
    Did you try adding an event to the InteractionObject with "Pick Up" enabled like the ball has in the "Interaction" demo?

    Hey,
    Would you mind sending me that animal prafab + fbx with the Grounder setup you have as a unitypackage?

    Cheers,
    Pärtel
     
    reinfeldx likes this.
  16. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83

    So Im trying to basically initialize an interaction object in my characters left hand using the interaction system. I have the grab position where I want it using an interaction target. I'm trying to test it using the built in test script and made a video of what I currently have using the interaction system and watching the final ik tutorials:


    Currently, to initialize it in my hand, I currently have to:
    1. Make interaction system speed to something crazy high like 10000
    2. Make interaction system fade in speed to 0.
    3. Make interaction object weight curve is a straight line from (0,1) to (0.001, 1)
    4. My NativePickupItemObject auto adds a pickup event at time 0 for the interaction.

    Is there a better way to initialize the object in my hand?

    It works, but there is a blurp where you can see its trying to animate and Im trying to prevent that (hard to see in the video but its there)...ideally, would like an alternative where it doesn't need to animate at all.

    Any ideas?
     
    Last edited: Dec 11, 2021
  17. DanielWiebe

    DanielWiebe

    Joined:
    Sep 8, 2021
    Posts:
    1
    Hi Pärtel,

    This is my first time asking a question here so I'm not sure if it's the correct venue for my query, but you seem pretty responsive on this site, so here goes... :)

    Context/Motivation:
    I'm using Unity and Oculus Quest 2, along with VR IK to track feet and arms, and it works really well, except that I only have one foot to track. I'm working on a project where I am assuming my users have a leg amputation, say, on the left leg, so I can't track both feet. So, in essence, I'd want to track the right foot, and the left leg's knee, instead of the left foot. My avatar has a full body, so I'm trying to simulate the rest of the amputated left leg in VR. I'm tracking the left knee joint by having a sensor strapped to the amputated leg, as well as the right foot on the full leg.

    My question: Is there another IK library that is more laterally modular, as in, it can take different bone counts from either leg, and can take, say, 1 bone (thigh) in the left leg to follow/point to a tracked target? I just to want to reassign one of the foot tracking targets to the knee bone, have the rest of that same leg and just have the other foot tracked normally? Thanks for your time!

    Cheers,
    Daniel
     
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,

    Code (CSharp):
    1.  
    2. using UnityEngine;
    3. using RootMotion.FinalIK;
    4. public class PickUpInteractionObject : MonoBehaviour
    5. {
    6.     public InteractionSystem interSys;
    7.     public InteractionObject iObj;
    8.     private void LateUpdate()
    9.     {
    10.         if (Input.GetKeyDown(KeyCode.P))
    11.         {
    12.             PickUp(iObj, FullBodyBipedEffector.RightHand);
    13.         }
    14.     }
    15.     private void PickUp(InteractionObject obj, FullBodyBipedEffector effector)
    16.     {
    17.         var target = iObj.GetTarget(effector, string.Empty);
    18.         var hand = interSys.ik.solver.GetEffector(effector).bone;
    19.         Quaternion deltaRot = RootMotion.QuaTools.FromToRotation(target.rotation, hand.rotation);
    20.         iObj.transform.rotation = deltaRot * iObj.transform.rotation;
    21.         Vector3 deltaPos = hand.position - target.position;
    22.         iObj.transform.position += deltaPos;
    23.         iObj.transform.parent = hand;
    24.         var handPoser = hand.GetComponent<HandPoser>();
    25.         handPoser.poseRoot = target;
    26.         handPoser.weight = 1f;
    27.     }
    28. }
    29. }
    Can use this script to pick up the ball in the "Interaction" demo for example.

    Hey,
    You could remove all leg bones from VRIK's References. Then add LegIK or LimbIK or CCDIK or FABRIK to any type of leg you have. You'll just have to make the leg solver update after VRIK using the IKExecutionOrder component.

    Cheers,
    Pärtel
     
    DanielWiebe likes this.
  19. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Perfect! Thanks that worked great!


    As a follow-up, I am unparenting the interaction object after a specific time and it is resulting in an odd position change.

    See this video to view the unparenting position glitchyness:


    In code, Im doing this to drop the item and to re-add a rigidbody witth gravity:
    Code (CSharp):
    1. public virtual void ResetObject () {
    2.             GameObject pickupsContainerGo = GameObject.FindGameObjectWithTag(Tags.PICKUPS);
    3.             if ( pickupsContainerGo != null ) {
    4.                 this.transform.SetParent(pickupsContainerGo.transform);
    5.             }
    6.             this.transform.rotation = this.originalRotation;
    7.             Rigidbody rigidbody = this.GetComponent<Rigidbody>();
    8.             if ( rigidbody == null && this.hasStoredRigidbody ) {
    9.                 rigidbody = this.gameObject.AddComponent<Rigidbody>();
    10.                 rigidbody.mass = this.lastMass;
    11.                 rigidbody.drag = this.lastDrag;
    12.                 rigidbody.angularDrag = this.lastAngularDrag;
    13.                 rigidbody.useGravity = this.lastUseGravity;
    14.                 rigidbody.isKinematic = this.lastIsKinematic;
    15.                 rigidbody.interpolation = this.lastInterpolation;
    16.                 rigidbody.collisionDetectionMode = this.lastCollisionDetectionMode;
    17.                 rigidbody.constraints = this.lastConstraints;
    18.             }
    19.         }
    Is there a way for me to seamlessly 'drop' the item at the position of the hand like how it looks in your demos? I didnt notice anything special in your scripts for unparenting an object so Im not sure what I am missing. Thank you very much for your time.

    Update: I even tried just reparenting to null and that's it...no rigidbody stuff or setting original rotation and the same thing happens.
     
    Last edited: Dec 21, 2021
  20. AtomicLugia

    AtomicLugia

    Joined:
    Aug 15, 2020
    Posts:
    54
    Heyho, I'm trying out Final IK and wanted to use it with a timeline. However, it seems that it doesn't work, the weight slider is unaffected by the timeline. Is there a workaround for this? I just need to set the Weight sliders with the timeline, to make a character for example look up while the character has a animation playing as well.
     
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    It's just that you were unparenting too early, before FBBIK has solved, so it drops from the animated or "fix transforms" position of the hand. FBBIK normally updates in LateUpdate (and has a high value in the Script Execution Order), so it updates after your scripts. Should use LateUpdate of a script with a higher value than FullBodyBipedIK has in the SEO to drop the item from. Or use ik.solver.OnPostUpdate delegate.

    Hey,
    IK parameters can't be binded to timeline because they belong to the IK solver class owned by the IK component, not the IK component itself. You'll need a little wrapper component that has for example public float leftHandPositionWeight (that can be binded to timeline);
    Then in LateUpdate do ik.solver.leftHandEffector.positionWeight = leftHandPositionWeight;

    Best,
    Pärtel
     
    jimmygladfelter likes this.
  22. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Thanks again, scheduling the unparenting to be in LateUpdate fixed it!
     
  23. hm2337

    hm2337

    Joined:
    Jun 9, 2019
    Posts:
    9
    Newb here. If I want to pet an animal and always make sure player's hand reaches animal's head, what would you suggest I use?
     
  24. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Hello!

    I am working on trying to open and close a chest using the interaction system. I have gotten it pretty close to where I want it; however, when I close the chest, the player really reaches and it looks a bit odd.

    Here is a video of it:


    Currently, I make the hands touch the chest and then pause the interaction system with an event at 0.5f normalized time, play an animation on the chest to open or close it, and then resume the interaction (hands back to default position) about halfway through the animation.

    I was wondering if there was a way to make it look better by not stretching the player so much when I close the chest? Maybe I have to add more effectors or is there a weight curve that might be better? Any ideas?

    Here is a screenshot of my interaction object settings:
    upload_2021-12-27_14-16-44.png
     

    Attached Files:

  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    FullBodyBipedIK. Set hand effector weight to 1 and move it to the pet's head. Can set "Pull" to 1 for that arm, to 0 for all the other limbs to make sure it always reaches.

    Hey,
    If the lid of the chest is that far away and you can't step closer, it'll just have to reach that far. You could maybe start the chest closing animation at the time when the interaction starts so it meets the hands half way there. Would not be as realistic, but at least the pose would look better. Or just have the chest auto-close when you move away from it and forget about the whole problem :)

    Best,
    Pärtel
     
    hm2337 and jimmygladfelter like this.
  26. jimmygladfelter

    jimmygladfelter

    Joined:
    May 3, 2020
    Posts:
    83
    Yea your right, I think having the chest close automatically is a good idea, Ill just do that instead.
     
  27. johnlumsdendeveloper

    johnlumsdendeveloper

    Joined:
    Jul 27, 2021
    Posts:
    15
    Hey,
    I have an object which is non symmetrical in shape which needs to be picked up and dropped. I have everything successfully working. The object has an Interaction Object, a hand placement with Interaction Target set to right hand, my character has an Interaction System. I am able to pick up the object with the right hand poser placement fine. But due to the non-symmetrical and non-cylindrical nature of the object i cannot rotate the target hand placement to cater for approaching the object at different angles. I tried adding more than one Interaction Target on the object, this time with the hand placement on the other side of it, i was hoping the system would recognise the more suitable hand target and go with it but this doesn't happen. What approach do you recommend to resolve this issue? Thanks! - UPDATE Issue is fixed. I added multiple hand placement child objects and set them all to inactive. When the object is about to be picked up i iterate through the child objects to determine the closest hand placement, and set that child to active. StartInteration function can take both InterationObject AND InterationTarget (found on the child).
     
    Last edited: Jan 10, 2022
  28. dshillady

    dshillady

    Joined:
    Mar 28, 2014
    Posts:
    24
    Hello. I'm trying to make a biped humanoid-rig character reach from idle (his hands at his sides) with his hand over his shoulder to pick up something out of his backpack (on his back).

    I've implemented some code to use the interaction system, and I can get his arm to indeed bend and touch his pack, but the arm rotates under his shoulder (a smaller rotation) and contorts his arm in a very unnatural way.

    Is there a way to cause the IK to rotate the arm the "long way" around, meaning to reach over his shoulder and not under?

    I've unsuccessfully tried to use code with RotationLimits and RotationConstraints. Without any explanations or examples given therein, the online documentation is near-zero help. I'm just guessing in the dark, so to speak.

    Are there any other resources available, other than the online documentation ( http://www.root-motion.com/finalikdox/html/index.html ) and the instructional videos on YouTube, that explain how this can be done?

    Or, maybe is it simple enough to explain it to me right here?

    As I said, I can only just guess at what to do, considering the lack of documentation.

    (I'm very sorry if this has already been discussed in this forum, but with 99 pages in this Final IK thread it's very impractical to search through.)

    Many thanks.
     
  29. ChefoMR

    ChefoMR

    Joined:
    Apr 25, 2019
    Posts:
    7
    Hey, thank you for the amazing work! I'm currently using CCDIK to control a robot using hand gestures with a HoloLens 2. I'd like to be able to adjust the weight of the bones from another script at runtime but I'm not sure how to do it. Thank you very much in advance for the assistance!
     
  30. RealWyldhunt

    RealWyldhunt

    Joined:
    Dec 5, 2017
    Posts:
    32
    I'm trying to get Final IK working with the Ultimate Character Controller, and I'm having an issue.
    I brought it up at the Opsive forums, and Justin (Opsive), said I might need your input.
    Here is a link to my forum discussion there.
    I'm trying to follow the Interaction System tutorial, but with UCC.
    Once I installed the patch, everything works fine with pure Final IK, but the UCC/Final IK bridge doesn't want to work anymore with the interactions. Everything else still seems to work with the bridge.
    Just the interact from the tutorial fails.
    Justin at Opsive says that the code he's calling is:
    Code (CSharp):
    1.  m_InteractionSystem.StartInteraction(IKGoalToEffector(ikGoal), interactionObject, false);
    For some reason it still fails, with the patch installed.
     
  31. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    65
    Is there already a method included to know if a target pos for eg. hand is too far to reach?
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    If you grab this patch, then you can call interactionSystem.StartInteractionWithClosestTarget() and it will automatically find the target that's rotation is closest to the current rotation of the hand.

    Hey,
    RotationLimits don't work with FBBIK, that solver uses its own set of internal constraints. RotationLimits are supported by CCDIK, FABRIK and AimIK only.
    You could do this:
    1. Use "Rotate Bone Weight" instead of "Rotation Weight" curve type in the interaction, so it rotates just the hand, not the entire arm.
    2. If it still doesn't look right, add a new curve or multiplier of type "Bend Goal Weight". Create a new gameobject and assign it as "Bend Goal" for the arm in FBBIK settings. Parent that bend goal to the root of the character. FBBIK will bend the arms towards that bend goal when the interaction starts, so place it accordingly.

    ik.solver.bones[index].weight = something;

    Hey,
    Does it work with the latest patch? If still not, can you please add a Debug.Log to InteractionEffector.cs line 153 and see if it gets called at all?

    No it's not possible to tell before the solver has finished, but you could compare distance from shoulder to target pos with the length of the arm.

    Best,
    Pärtel
     
    johnlumsdendeveloper likes this.
  33. DoctorSauce

    DoctorSauce

    Joined:
    Nov 4, 2012
    Posts:
    4
    I know this is old but THANK YOU FOR THIS!!
     
  34. JonBanana

    JonBanana

    Joined:
    Feb 5, 2014
    Posts:
    85
    Hi,
    Where can i find documentation about using TwistRelaxer ?
    Thanks
     
  35. JonBanana

    JonBanana

    Joined:
    Feb 5, 2014
    Posts:
    85
    Hi @Partel-Lang ,
    I add a TwistRelaxer but the twist is not 'balanced' between wrist and elbow
    when i change the value of crossfade the twist move from elbow to wrist but not progressively

    Is it something wrong in my setup ?


    Thanks twist.png
     
  36. johnlumsdendeveloper

    johnlumsdendeveloper

    Joined:
    Jul 27, 2021
    Posts:
    15
    Hey @Partel-Lang , thanks for the patch, appreciate it! I have tried it with mixed results. Say the object is rectangular (e.g. a cereal box), each of the 4 narrow sides has a hand target placed placed in the middle of each side. There are also 4 other hand targets at the same location as the other hands, but turned 180 degrees. This is so the cereal box can be approached from differing angles. Should the patch work, or is there a bit of work my side to make sure the hand target (and not the 180 degree version) is the one appropriate for the side i am approaching it from? Thanks!
     
  37. copperrobot

    copperrobot

    Joined:
    May 22, 2013
    Posts:
    68
    Hi @Partel-Lang - I had a problem a while back where the look direction of a character was incorrect and off at a 90degree angle. I believe it was yourself, or one of the other Final IK team who came up with a solution. However, this solution is not working for the scene I have.

    These are the lines of code being called on awake.

    Code (CSharp):
    1. public void realignEyes()
    2.     {
    3.         foreach (IKSolverLookAt.LookAtBone eyeBone in _lookat.solver.eyes)
    4.         {
    5.             eyeBone.axis = EyeAxis;
    6.         }
    7.     }
    8.  
    9. public void realignHead()
    10. {
    11.     _lookat.solver.head.axis = HeadAxis;
    12. }
    13.  
    14.    
    Characters will either be incorrectly aligned (looking off angle) or if I call the realign script manually (rather than awake) it will stop functioning at all (no look tracking).

    Is there a way to ensure it is aligned correctly, or to re-start the LookIK tracking after manually realigning?
     
  38. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    65
    @Partel-Lang I understand why multi-threading wouldn't work on character's IK cause it has to be solved in a specific linear order, but what about when there are multiple characters? So it would be that one character's IK is solved on one thread, another's at the same time on another thread and so on..? Or..?
     
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Looks like it's just a bug in TwistRelaxer, please grab this patch to fix it.
    You don't need 2 TwistRelaxers, just 1 with 2 twist solvers.
    If it's UMA and you're adding everything in runtime, do it like this>

    Code (CSharp):
    1. TwistRelaxer relaxer = avatar.gameObject.AddComponent<TwistRelaxer>();
    2.         relaxer.ik = ik;
    3.         relaxer.twistSolvers = new TwistSolver[2] { new TwistSolver(ik.references.leftForearm), new TwistSolver(ik.references.rightForearm) };
    It should work, I mean the more hand targets you add, the more likely it will pick a natural looking one.
    It just compares angle from current avatar hand rotation to each target's rotation and picks the closest one to interact with.

    Hey,
    If you set those axes in Awake it won't work, because it will be overwritten by LookAtIK when it initializes. You'll know that's the case if you Debug.Log(lookAt.solver.head.axis) in Update and it returns something different from what you assigned.
    Make sure lookAtIK.solver.initiated returns true before you set those axes.

    As far as I've tested, the overhead from passing data to/from jobs via NativeContainers is more than whatever gain you get from solving IK on multiple threads. Because IK needs quite a lot of data to be transferred back and forth - all bone rotations, target positions and rotations and whatever other solver parameters that might change. I've done tests with a 100 characters with AimIK jobs on each and single threaded was still faster than multithreaded. Tested on build with Burst. Maybe if you had a 1000 characters, but who has that? Kinda lost interest in animation jobs after that.

    Cheers,
    Pärtel
     
    JonBanana and WonkyDonky like this.
  40. johnlumsdendeveloper

    johnlumsdendeveloper

    Joined:
    Jul 27, 2021
    Posts:
    15
    @Partel-Lang I ended up amending your code. I think what was happening was that while the angle was the best its position on the object wasn't necessarily suitable (e.g. underneath the object or on the far side of the object).
    What i have done is store all handtargets in an array which have an angle less then 100 (angle based on your code).
    I also created a variable which uses ClosestPoint on the item's collider, to an empty gameobject on the player, this gives me the closest point on the item (i want to pick up) to the player.
    For each object in the handtarget array (<100 angle targets only), i get the distance between the handtarget and the closest point variable i created earlier.
    The handtarget with the smallest distance is the one I pick. It seems to work well as I am picking both a handtarget with a close rotation to the players hand as well as it being close to the player. I may change the <100 logic though and instead store the smallest say 2 or 3 angles instead, will keep testing. I may also need to change this approach for objects which are heavy (i.e. the handtarget instead may need to be the furthest point), but this should be a straightforward change. Thanks for the great product! Cheers
     
  41. WonkyDonky

    WonkyDonky

    Joined:
    Aug 24, 2014
    Posts:
    65
    So Pure ECS version could still work?

    Well, anyway I also have a problem, instead of using animator I'm doing custom animation (transitioning between poses), so what should I do so that "Fix Transforms" doesn't interfere? But in a way that it still would work with Puppetmaster & amplifier etc. How does the update order go then? Is my custom animation system forced to execute in late update, so it doesnt get overridden by Fix Transforms?

    + Are there other factors I should consider when doing custom animation with Final IK and PM?
     
  42. ml785

    ml785

    Joined:
    Dec 20, 2018
    Posts:
    119
    Hi,
    I've followed this tutorial (
    ) up to 2:26. The thing is when I click the "Start Interaction with Sphere" button, nothing happens. Any ideas what might be going wrong? I have a fully rigged Humanoid character with "Full Body Biped IK" and "Interaction System" and "Interaction System Test GUI" components, and I have a sphere object with "Interaction Object" game component, with settings copying the tutorial instructions.

    Edit: I also tried doing by script and still cannot make anything happen... "Pressed" prints to console but the character doesn't move
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using RootMotion.FinalIK;
    5. public class InteractSc : MonoBehaviour
    6. {
    7.     public InteractionSystem interactionSystem; // Reference to the InteractionSystem component on the character
    8.     public InteractionObject button; // The object to interact with
    9.     public bool interrupt; // If true, interactions can be called before the current interaction has finished
    10.     void Update()
    11.     {
    12.         if (Input.GetKeyDown("space"))
    13.         {
    14.             print("Pressed");
    15.             interactionSystem.StartInteraction(FullBodyBipedEffector.LeftHand, button, interrupt);
    16.         }
    17.     }  
    18. }
    19.  
    Edit 2:
    Oh! I guess setting a Target is necessary. I created a Target and made it a child of the Sphere and now the interaction works.
     
    Last edited: Jan 16, 2022
  43. MackySoft

    MackySoft

    Joined:
    Dec 7, 2015
    Posts:
    1
    Hi, @Partel-Lang

    I am currently working on a humanoid sit animation.

    So I am using Grounder Full Body Biped to make the feet fit the ground, but the feet are buried in the ground.

    What I want to accomplish is as follows

    • The origin of the sit animation is at the Hips.
    • The character root should snap to the point where they sit.
    • The feets should be grounded on the floor.

    Is there any way to make Grounder Full Body Biped work as expected?
    Or how can I rewrite the scripts (GrounderBipedIK, Grounding.Leg, etc.) to make it work?
     

    Attached Files:

    • 01.jpg
      01.jpg
      File size:
      59 KB
      Views:
      285
    • 02.jpg
      02.jpg
      File size:
      37.8 KB
      Views:
      282
    • 03.jpg
      03.jpg
      File size:
      43 KB
      Views:
      283
    • 04.jpg
      04.jpg
      File size:
      60.8 KB
      Views:
      287
  44. hairibar

    hairibar

    Joined:
    Feb 25, 2017
    Posts:
    7
    Heya @Partel-Lang. I've got a character set up with FBIK and everything's working great normally. However, I need to be able to, at runtime, change the end bone that the arm IK uses. (We've got two very different animation types for the character).

    At first I thought it'd be a matter of changing IKEffector.bone, but that just caused endless nullrefs as Final IK searched for that bone's chain. I went down that rabbit hole and this is what I came up with - it doesn't error out, but the results are incorrect so I'm assuming I'm still missing something.

    Code (CSharp):
    1. void SetIKEndBone(FullBodyBipedChain chainType, Transform endBone)
    2. {
    3.     IKEffector effector = ik_FullbodyIK.solver.GetEndEffector(chainType);
    4.  
    5.     effector.bone = endBone;
    6.  
    7.     IKSolver.Node lastNode = ik_FullbodyIK.solver.GetChain(chainType).nodes[^1];
    8.     lastNode.transform = endBone;
    9.  
    10.     IKMappingLimb limbMapping = ik_FullbodyIK.solver.GetLimbMapping(chainType);
    11.     limbMapping.bone3 = endBone;
    12. }
    How would I go about doing this? Am I missing something? Is Final IK able to have the end node's transform change at runtime?
     
  45. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    193
    Got a couple of questions on Interaction...

    I've got it setup so that a hand touches an object, but because there's a curve weight on InteractionObject, the hand only stays there briefly then returns to the start point. I want the hand to stay there. If I move the slider to 1 for weight and rotation manually, it will stay, but what's the code to set weight and rotation to 1?

    Also, on hand poser, when I trigger the interaction, the Weight goes to 0 for some reason, I can manually adjust the slider to 1 and I get the correct hand position. Is there a way to tell the HandPoser to set Weight to 1?
     
  46. johnlumsdendeveloper

    johnlumsdendeveloper

    Joined:
    Jul 27, 2021
    Posts:
    15
    @cloverme Your second question, in short, handObject.GetComponent<HandPoser>().weight = 1. The InteractionObject may have a Poser Weight curve, going 0 to 1 to 0, which means the hand will be in the target position halfway through the animation (when it reaches 1), then by the time it finishes the poser weight is 0 (so the players default hand position). You can amend/create a Poser Weight curve which uses 0 to 1 to 1 instead, so that the animation finishes on 1 (and therefore the players hand is still in the hand poser position). When you go to drop an object, you can use
    handObject.GetComponent<HandPoser>().weight = 0 to reset the players hand back to default.
     
  47. cloverme

    cloverme

    Joined:
    Apr 6, 2018
    Posts:
    193
    Thanks, yeah I think the curve weight is throwing things off. I wanted an instant IK interaction, so I didn't put a curve but just a straight line. I think it's fighting that with some other timing setting, like the time to do the IK is ending before the weight curve or something.

    I figured out a somewhat non-elegant workaround where I just keep forcing the weight on Pos & Rot, and then on the hand poser, the same thing for a few seconds. Yeah and then set it to 0 manually when I want to reset.

    Thanks
     
  48. VR_Junkie

    VR_Junkie

    Joined:
    Nov 26, 2016
    Posts:
    77
    Hello, I am trying to rotate my character but his collider keeps jittering. My VRIK body is attached to my xr rig and I rotate my XR rig (so the VRIK body should follow). When the rig rotates I expect the legs to animate because I have locomotion set to animation in vrik. If I rotate slow the legs animate fine but if I rotate quickly the colliders starts flying all over the place and legs go with it. Not sure what to do to fix this so any help is appreciated

    Side Note: With vrik off my collider doesn't do this so I know its something with vrik

     
    Last edited: Jan 22, 2022
  49. Khang_Pham

    Khang_Pham

    Joined:
    Feb 28, 2021
    Posts:
    13
    Hi Partel,

    Do you know a way how to use VRIK - animated locomotion with a character that has a rigidbody?
    For me, any character with a rigidbody (even if set to kinematic) does constant feet shuffling, if the VRIK headtarget is rotated. Big rotations work fine (as the character will follow the rotation) but smaller ones lead to a constant feet shuffling.

    It works if I set the rigidbody to RigidbodyInterpolation.Interpolate.
    But I was wondering if you had a better (or less expensive) approach? One can easily reproduce this if you take the VRIk animated locomotion scene and add a rigidbody to the pilot. Rotating the headtarget will lead to constant shuffling of the feet.
    Many thanks in advance!
     
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey guys, sorry for the absence here, I've been down with the flu.

    Hey,
    Any time before PuppetMaster's LateUpdate is fine to update animation from. Can also use PuppetMaster.OnRead delegate for that. Fix Transforms stuff is applied in Update. You only need fix transforms if there are any bones used by PuppetMaster or some IK that's position/rotation is not being overwritten by the animation every frame.

    About Pure ECS, technically yes, but the animation tools Unity has for that are practically non-existent and definitely not production ready.

    Hey, sorry for the confusion, there's info about that known issue in the description of the video.

    Hey,
    That animation should have the feet at 0 (ground level). Can adjust that in the animation import settings. The it should also work with the Grounder.
    Hey,
    To do this properly would require reinitializing the entire solver, but that'd be slow to do mid-game. Could have 2 IK separate components and enable/disable the one you need.

    Hey,
    Same answer for the both of you..
    You should keep your Rigidbody character controller and the VRIK avatar separate (separate hierarchies). Consider the VRIK avatar to be just a virtual visualization of the player that has nothing to do with how the controller actually moves or rotates. Just parent the IK targets to the controller and let VRIK follow them around.
    VRIK only needs from you the head and hand target pos/rot data and matching Y of the avatar to the Y of the character controller.

    Best,
    Pärtel
     
    hairibar likes this.