Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

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

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

  1. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    I just re-checked the Grounder in 2019.3 and seems to be working the same, I haven't changed much in that for a long time either. If the pelvis is the root, there are probably other scripts acting on that transform and moving it, so might be that in 2019.3 they are executed in different order or something.
     
  2. blurdot

    blurdot

    Joined:
    Jan 26, 2014
    Posts:
    24
    Makes sense, I'll dig in more today and see what I can find. If it's something useful I'll report back :)

    I hadn't updated since 2019.1 so there appear to be quite a lot of changes from the previous version of Grounder since then (at least some structural reorganizing).
     
    Last edited: Mar 6, 2020
  3. blurdot

    blurdot

    Joined:
    Jan 26, 2014
    Posts:
    24
    Ok, I found the issue, it is something relevent to my project mostly. We use multiple Physics scenes to support a Client/Server architecture and Client Side Prediction, because of this, I had to make sure that the raycasts are using the correct Physics scene when running.

    In GroundingLeg.cs I changed line 266 to:

    Code (CSharp):
    1.                 SceneManager.GetActiveScene().GetPhysicsScene().Raycast(origin + grounding.maxStep * up, -up, out hit, grounding.maxStep * 2, grounding.layers);
    and modified the GetRootHit() method on lines 166-167 of Groundig.cs to:

    Code (CSharp):
    1.             if (quality != Quality.Best) SceneManager.GetActiveScene().GetPhysicsScene().Raycast(legsCenter + _up * maxStep, -_up, out h, maxStep * distMlp, layers, QueryTriggerInteraction.Ignore);
    2.             else SceneManager.GetActiveScene().GetPhysicsScene().SphereCast(legsCenter + _up * maxStep, rootSphereCastRadius, -up, out h, maxStep * distMlp, layers, QueryTriggerInteraction.Ignore);
    This seems to have fixed it for me, kind of a bandaid for now, I'll probably figure out a more elegant solution for this and any other related Physics scene issues going forward for 3rd party assets. Thanks!
     
  4. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    257
    Hey Partel, do you offer paid support? I'm having trouble getting things together and if someone as smart as you could help then I'll be on my way. I want to pay I don't want free help
     
  5. Nihil688

    Nihil688

    Joined:
    Mar 12, 2013
    Posts:
    409
    No I meant with finalIK, basically we have lots of enemies that we push back etc and use ragdolls. So I need to optimize it as much as possible
     
  6. caste

    caste

    Joined:
    Dec 19, 2012
    Posts:
    6
    How to set all finalik joints (biped ik) from 1 to all finalik joints (biped ik) 2 in runtime? It's must looks as the same pose after update.
     

    Attached Files:

    • bik.png
      bik.png
      File size:
      210.5 KB
      Views:
      66
    Last edited: Mar 11, 2020
  7. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    Thanks for the info, I'll write it down to add that change to the next version.

    Hey,
    I'm way too busy with support and development already to take on any extra paid work. But if you have many questions, don't worry, I'll still be here to answer.

    OK, can you tell me more, which IK components are you using and for what purposes?

    Hey,
    Not sure if I understood you right. Did you mean you needed to match the pose of character 1 to character 2?
    You could do this by getting all Transforms in both character hierarchies and matching the localPositions and localRotations:

    Code (CSharp):
    1. Transform[] children1 = character1.GetComponentsInChildren<Transform>();
    2.  
    3. Transform[] children2 = character2.GetComponentsInChildren<Transform>();
    4.  
    5. for (int i = 0; i < children.Length; i++) {
    6. children1[i].localPosition = children2[i].localPosition;
    7. children1[i].localRotation = children2[i].localRotation;
    8. }
     
    caste likes this.
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hi all!

    Because of all the frequent automated spam, notification issues and other limitations of the old RootMotion Q/A page, I am nuking that and moving over to https://rootmotion.freshdesk.com/support/home.

    It has FAQ, forum and a ticketing system so hopefully that will improve the support experience for you guys!

    Cheers,
    Pärtel
     
    ROBYER1 and hopeful like this.
  9. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    14
    So im having a problem with a rotating player, everything is working pretty well, except whenever i rotate my player using OVRplayer , my left elbow rotates. it seems related to the step, as in every click left or right.
    my right elbow stays fine, but i cant find anything different- targets, bend goals, etc.
    Anyone have this issue? im thinking maybe its related to player space and something using the wrong root, but i cant find it.
     
  10. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    I tried rotating the Pilot around every axis here, but did not see this. Could you please send a screenshot of your VRIK arm settings?
     
  11. TaylorCaudle

    TaylorCaudle

    Joined:
    Feb 8, 2018
    Posts:
    14
    Sure, here's my VRIK script input settings.

    Basically it all works GREAT, until i use the OVR locomotion settings to snap left or right-

    Then the Left Elbow basically spins around, with each "snap" turn.
     

    Attached Files:

  12. rmon222

    rmon222

    Joined:
    Oct 24, 2018
    Posts:
    59
    Hi @Partel-Lang . Using VRIK, if I set locomotion to zero, I understand the legs float freely depending on velocity. If I set locomotion to 1, the legs react to velocity by walking or side-stepping. What's the best setting to simulate a player on a surfboard (player moving, legs static)? Where in the code do you sample the velocity? Sorry, it's been a while since I looked at your code. Thanks.
     
  13. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey, I see you have Bend Goal Weight set to 1, but no Bend Goal objects assigned, so that is probably the issue. (bend goal direction remains stuck in whatever the default value is in world space). Either set that weight to 0 or assign some bend goal transforms and parent them to the root of the character so they rotate along with the root.

    Hey,
    Please check out the "VRIK (Moving Platform)" demo, that is an example about attaching VRIK to moving objects. Also the "VRIK (Moving Platform Controller)" demo, that is a bit more complex solution, use that if you need to switch platforms at some point.

    Best,
    Pärtel
     
  14. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    257
    Hi Partel,

    I want to use FinalIK for weapons and no weapons. I tried using the AimController but its not setup to work as FPS like the FPS demo you made. If I put a camera inside the head and play with the Aim Target in the AimController demo, the aiming looks awful. I tried many many times to get this to work..
     
  15. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    257
    I don't know what to do, I've programmed for over 10 years and I simply cannot wrap my head around FinalIK. I don't think I'm wired that way :/
     
  16. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    257
    If you could help me solve this one issue I would do anything.. This is why I rather pay you, I feel like you could do this in 10 minutes.. The forum way of support is just slow..
     
  17. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    792
    Having the strangest issue with the VRIK HandIKTarget script here where the hand IK rotates during medium to fast movement of the controller. I have submitted a support ticket #14

    Edit: just realised this was a pose locks issue with the Hand pose script, didn't have all angular set to locked, only locked in XZ

    https://drive.google.com/open?id=1OcZqWA3eVplPziknp4KiSBipv-LB3Rhp
     
    Last edited: Mar 19, 2020
  18. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    You could use the FPSAiming for aiming weapons. Then, if you want to put the gun down and run around, just blend FPSAiming.aimWeight to 0 to disable the IK, no need for AimController in just running around. What kind of IK exactly did you need to use while not holding a weapon?

    Full body FPS is a very complex problem to solve (probably the most difficult thing you could do with FIK) because the camera needs to be locked to the head that carries the motion of animation, but at the same time must allow mouse input, so it is kind of a circular dependency issue. So yeah, it is definitely not easy (for me neither).

    I know forums can be slow, but there's just one of me and already way too busy to offer any extra paid services, sorry.

    Best,
    Pärtel
     
    unityasoft likes this.
  19. unityasoft

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    257
    Setting the aimWeight disables AimIK but I want the character to use AimIK to look down and up while walking/running

    I thought because your the creator of FIK and PM you could do anything in like 5 minutes haha I understand your point, sorry.

    I want what the "First Person Shooter" scene has but with or without weapon, or different animation. I guess I have to compromise as I'll probably never get it right. I'll move on man thank you for help!
     
  20. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    Hi, Lang,

    I am using VRIK(calibration) sample. I replaced both models and changed some settings accordingly. But I found the legs are a bit strange with the bend goal weight set to 1.

    Untitled2.png

    when I changed the bend goal weight to 0, it seems better.

    Untitled.png

    I am using the code of CalibrateLeg in VRIKCalibrator, but I am not sure how to modify the code about bendGoal, I wish you could give me some hint, thank you.
     
  21. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    OK I see.. That would require adding another AimIK with spine bones and head assigned as Aim Transform. And a little change to FPSAiming.cs. Please import this package, play the scene, then set aimWeight to 0. You should also switch to non-aiming animation of course if you wanna put down the gun.

    Hey,
    VRIKCalibrator adds bend goal objects to the foot targets. If it looks better without, you can disable it by calling
    ik.solver.leftLeg.bendGoalWeight = 0; after the calibration call. Or you could adjust ik.solver.leftLeg.bendGoal.localPosition to adjust the position of the bend goals.

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

    unityasoft

    Joined:
    Oct 28, 2011
    Posts:
    257
    Hey the link doesnt work. Thank you for help!!!
     
  23. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    Thank you, Pärtel, I adjusted the position of the bend goals, it's better now.

    And I think I am not sure about the code in VRIKCalibrator yet. You have the head offset and hand offset in the settings. I know it's the offset between the tracker and the bone, but why don't we need to set the offset of the trackers on hip and foot? Thank you.
     
  24. skowronski

    skowronski

    Joined:
    Jan 17, 2018
    Posts:
    20
    Hi,

    adding the Finger Rig to a Hand during runtime and switching to the scene mode results in these errors:

    and following

    with the latter probably just stemming from the function not ending properly.

    Do you have any idea on how to fix that?
     
  25. adamz

    adamz

    Joined:
    Jul 18, 2007
    Posts:
    997
    @Partel-Lang

    Hi, so I'm playing around with your VRIK and it's working well. Do you have any scripts that I can add for forearm twist bones? I'm getting a weird bend at the wrist when its at a certain angle.

    Thanks.

    arm-twist.jpg
     
  26. erw29

    erw29

    Joined:
    Sep 27, 2018
    Posts:
    10
    Hi @Partel-Lang,

    can you recommend parameter settings for the locomotion in VRIK when having only upper-body tracking to get the most natural walking behavior?

    Best,

    Erik
     
  27. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Those trackers are just calibrated differently so some things can be calculated automatically for the feet (you have the "Foot Forward/Inward/Heading Offset" for them). Because with the feet we can make some presumptions, like we know they are supposed to be flat on the ground so I can calculate some angles based on that, it is difficult to explain. For the pelvis, when you calibrate, I can just use offset of the tracker from the pelvis bone because I assume the player is standing straight at that time so his pelvis matches more or less with the avatar's pelvis.

    Hey,
    Sure you are running the latest FIK (can check that from "Plugins/RootMotion/FinalIK/FinalIK ReadMe", the latest is v1.9)? Because the lines that produce the errors are empty here. Tried to add it in runtime, didn't see that error, can you please send me the code you were using for adding FingerRig in runtime?

    Hey,
    Please try adding TwistRelaxer component to the forearm (or forearm roll bone if your model has them).

    Hey,
    The default settings. It depends on the proportions of the model and what you personally think is "most natural", so it really is just a matter of tweaking these settings to your liking. If you hover the mouse over each variable, there is information about what they do as tooltips.

    Cheers,
    Pärtel
     
  28. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    Thank you for your patience, Pärtel, that helps a lot!
     
  29. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,747
    How would I go about making a character nod or shake her head, when she's also using the Look At IK script?

    Basically I'm looking to add a bit of additional rotation to whatever LookAtIK does (ideally while keeping the eyes looking at the target). Should I just make sure my own script runs after FullBodyBipedIK, and monkey with the head transform in LateUpdate? Or is there some more elegant/built-in solution?
     
  30. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    Might be easiest to adjust ik.solver.head.axis to create a procedural nod. Something like this:

    Code (CSharp):
    1. public LookAtIK ik;
    2.     public Vector3 headForwardAxis;
    3.     public Vector3 headUpAxis;
    4.     public AnimationCurve headNod;
    5.  
    6.     private float headNodTimer;
    7.  
    8.     public void StartHeadNod()
    9.     {
    10.         headNodTimer = 0f;
    11.     }
    12.  
    13.     private void LateUpdate()
    14.     {
    15.         headNodTimer += Time.deltaTime;
    16.  
    17.         ik.solver.head.axis = (headForwardAxis + headUpAxis * headNod.Evaluate(headNodTimer)).normalized;
    18.     }
    That would make only the head move, but keep eyes and spine as they were.
    Fill in the headNod curve to bounce up-down to "create the animation".
     
    JoeStrout likes this.
  31. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    792
    Is there a best practice way to keep the VRIK body straight when you look down? Currently when I look down, the pelvis moves back and the chest isn't very visible then.
     
  32. JMab

    JMab

    Joined:
    Nov 29, 2013
    Posts:
    17
    How can I change the animation state of an interaction object at runtime? My use case is a door that remains in an open or closed state. I'd like to change the animation to opening or closing depending on the state of the door. I've tried changing the animation state before calling TriggerInteraction() but it just uses the original animation state. My code is below (thanks!):

    Code (CSharp):
    1.             // Get the original animation state.
    2.             string origAnimationState = interactionObject.events[0].animations[0].animationState;
    3.  
    4.             // If the door is already open, use the closing animations.
    5.             if (isOpen)
    6.             {
    7.                 if (origAnimationState == "DoorOpening1")
    8.                 {
    9.                     interactionObject.events[0].animations[0].animationState = "DoorClosing1";
    10.                 }
    11.                 else if (origAnimationState == "DoorOpening2")
    12.                 {
    13.                     interactionObject.events[0].animations[0].animationState = "DoorClosing2";
    14.                 }
    15.                 else
    16.                 {
    17.                     Debug.LogWarning("Unrecognized animation state.");
    18.                 }
    19.  
    20.                 isOpen = false;
    21.             }
    22.             else
    23.             {
    24.                 isOpen = true;
    25.             }
    26.  
    27.             // Trigger the interaction.
    28.             interactionSystem.TriggerInteraction(closestTriggerIndex, false);
    29.  
    30.             // Reset the original animation state.
    31.             interactionObject.events[0].animations[0].animationState = origAnimationState;
     
  33. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,747
    I think you need only adjust the Body Weight in the Look At IK component (which is what I assume you're using). If you set that to 0, the body won't move at all and looking will be done entirely from the head and neck. Probably you want at least a little body weight to make it look more natural, but not too much.

    @JMab, I think you've posted in the wrong thread.
     
  34. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    792
    I'm using the VRIK component only as that's what the VR example assets use too, I haven't seen the Look At IK component used with VRIK.
     
  35. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,747
    Oops, my mistake. I don't have any insight in that case... hopefully someone else can chime in!
     
    ROBYER1 likes this.
  36. JMab

    JMab

    Joined:
    Nov 29, 2013
    Posts:
    17
    @JMab, I think you've posted in the wrong thread.[/QUOTE]

    Hi Joe, I should have been more specific, although I'm trying to swap an animation state, it is for a FinalIK InteractionObject, it's a FinalIK-specific question.
     
    JoeStrout likes this.
  37. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    Hi, Pärtel, I am comparing FInalIK with IKInema, and FinalIK does a really great job!

    13.gif

    One thing I noticed is that the body in IKinema seems to be more stable, how can I prevent the shake of the body on the right side? Any hint will be appreciated, thank you.
     
  38. JMab

    JMab

    Joined:
    Nov 29, 2013
    Posts:
    17
    Don't worry, I answered my own question. Because the animation is played asynchronously (of course!) I had to wait to reset the original animation state in the OnInteractionStop event. Working now.
     
    Partel-Lang likes this.
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    Please try reducing "Neck Stiffness" and/or "Body Rot Stiffness" in the Spine settings.

    I think it would be easier and more elegant to add a new script Door.cs to the door. Add a function like public void OnHandleInteraction() to it. Remove the animation call from the InteractionObject event and replace it with a Unity Event that calls that OnHandleInteraction method.
    Then in that method you can do something like:

    Code (CSharp):
    1. public void OnHandleInteraction() {
    2. if (isOpen) animator.CrossFadeInFixedTime("DoorClosing", 0.2f);
    3. else animator.CrossFadeInFixedTime("DoorOpening", 0.2f);
    4.  
    5. isOpen = !isOpen;
    6. }
    Hey,
    Can you tell me more about your rig, which IK targets are you using? Do you have a HMD, hand controllers and vive trackers on the feet? Do you have a body/hips tracker? Also could use a screenshot of your VRIK settings please.

    Cheers,
    Pärtel
     
    ROBYER1 likes this.
  40. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    Hi, Pärtel, thank you for your reply. I am using two vive controllers, and four trackers to track head, hip, and feet. I am basically using the code in the VRIK (Calibration) demo. I added some lerps to stabilize the transformation of the trackers, but it didn't seem to make any differences.

    Below is my VRIK settings. If you need anything else, please tell me, thank you!

    2020-04-06.png
     
  41. Onat-H

    Onat-H

    Joined:
    Mar 11, 2015
    Posts:
    93
    Hi Pärtel, in my Builds SolverManager.LateUpdate costs about 6ms with 6 Characters in the scene on a high-end pc. Do you know what could be the reason for this? The Characters all have FBBIK, LookAt IK, and in addition to this, my main character has the grounder and PuppetMaster. I'm currently on 2020.1.4 by the way, but I can also check if the same happens in 2019.3 in case you are not testing with 2020.1 yet. Do you have general performance recommendations?
     
  42. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    26
    @Partel-Lang
    hello. for vrik. how can i know how much my avatar's arm has strteched? stretchCurve will automatically stretch my arm. but i need to know how much it stretched for my own code logic.
     
  43. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    Only thing wrong I can notice is that your "Wrist To Palm Axis" and/or "Palm To Thumb Axis" are wrong in the arm settings, they can not have the same values. The former should be the local orthogonal axis of the hand that points from wrist towards the palm and the latter should be pointing from palm to thumb. But that should give you problems with arms, not the spine. Weird I can't see it in the demo with similar settings. Sure it's not the body tracker that is moving like that or losing tracking?
    What if you removed the Neck bone from the References?

    Hey,
    That seems like a lot for SolverManager.LateUpdate. Could you please deep profile it and send me the binary file? (click "Save" in Profiler).

    Hey,
    Could calculate arm length (distance from upper arm to forearm + forearm to hand) in before VRIK and then again after VRIK solved (using ik.solver.OnPreUpdate/ik.solver.OnPostUpdate delegates), then compare.

    Cheers,
    Pärtel
     
  44. nglasl

    nglasl

    Joined:
    Oct 22, 2018
    Posts:
    4
    Hi Partel, I'm having an issue with aim IK that I thought you might have a solution to.

    When transitioning to aiming by setting aimIK.solver.IKPositionWeight to 1, I noticed that my player animator.GetBoneTransform(HumanBodyBones.Head).position value is never consistent and jumps around as though the head is trying to be in multiple positions at once. The scene view clearly shows my head staying in the one position, so I have no idea why this value is constantly changing. It only happens when aimIK.solver.IKPositionWeight is > 0, as my aim IK is attached to the player spine (and subsequently the head). I unfortunately don't have the option to change the bones I'm targetting, so I'm wondering if there's anything you might know that would cause this to happen?
     
  45. songjiekun

    songjiekun

    Joined:
    Jan 21, 2017
    Posts:
    26
    @Partel-Lang

    does the code at IKSolverVRArm.txt. line 265,266 does exactly the same thing as you described?
    Code (CSharp):
    1. float distanceToTarget = Vector3.Distance(upperArm.solverPosition, position);
    2. float stretchF = distanceToTarget / armLength;
    can i caculate "before vrik length" and "after vrik length" at one method instead of two preupdate and postundate?
     
  46. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    Hi, Pärtel,

    Thank you, I misunderstood the settings before.

    I added a low pass filter on the tracker, it's better now. Thank you.
     
  47. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    Hi, Pärtel,

    I have another question, is it possible to disable the bend of the calf joint? I just want the legs to be straight. I haven't found any settings about that, and I tried the way you used in VRIK Arm Mocap.unitypackage, to calculate the rotations of the thigh and calf again after VRIK, but it didn't seem to work. I am not sure about the math here, if you could give me some hint, it will be appreciated, thank you!

    Code (CSharp):
    1.  
    2. void AfterVRIK()
    3. {
    4.     UpdateLeg(ik.references.rightThigh, ik.references.rightCalf, ik.references.rightFoot, rightFootTarget);
    5.     UpdateLeg(ik.references.leftThigh, ik.references.leftCalf, ik.references.leftFoot, leftFootTarget);
    6. }
    7.  
    8. private static void UpdateLeg(Transform thigh, Transform calf, Transform foot, Transform footTarget)
    9. {
    10.     if (footTarget == null) return;
    11.  
    12.     thigh.rotation = Quaternion.FromToRotation(foot.position - thigh.position, footTarget.position - thigh.position) * thigh.rotation;
    13.     calf.rotation = Quaternion.Euler(Vector3.zero);
    14. }
    15.  
     
  48. Olafson

    Olafson

    Joined:
    Aug 7, 2012
    Posts:
    252
    Hi there. I am wondering if final IK is able to apply IK to generic characters that use the "Optimize Game Object" feature in rig tab?

     
  49. fengkan

    fengkan

    Joined:
    Jul 10, 2018
    Posts:
    46
    I found rotation limit in previous posts, and now it works!
     
  50. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,058
    Hey,
    It depends on when you read the position value.
    If you read it in Update, it returns the position of the head as it was at the end of last frame (animation not applied yet)
    If you read it in LateUpdate, it returns the position of the head as it is in animation (animation updated between Update and LateUpdate).
    If you read it in LateUpdate from a script that has a higher value in Script Execution Order than AimIK has, it returns the position of the head with IK applied.
    Same as last if you used ik.solver.OnPostUpdate delegate.

    It is almost the same, I mean stretchF is also evaluated by the stretch curve to get the final stretch amount (float m).
    You could add a
    Code (CSharp):
    1. public float stretch {get; private set;}
    , add
    Code (CSharp):
    1. stretch = 1f + m;
    to line 270, then read ik.solver.leftArm.stretch in OnPostUpdate to use it for what you need.

    Hey,
    That code should do it.. Are you sure it even gets called? Do you have ik.solver.OnPostUpdate += AfterVRIK somewhere?

    No, sorry. Final IK needs to rotate some bones and for that it needs to have access to them.
    Even if they are exposed, those exposed bones are read-only, can't change their transforms.

    Cheers,
    Pärtel
     
unityunity