Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

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

  1. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Disable "Draw Capsule Hand" in the VRIKHand.cs on the VRIKHand_L and VRIKHand_R under the leap's HandModels.

    Hey,
    I found a bug in the code that made this work with only models that have the same world space bone orientations for both hands. Please reimport.

    Hey,
    Normally this is done by spherecasting from the character towards the wanted camera position and if there is a hit, putting the camera to hit.distance instead.
    At the end of UpdateTransform() in CameraController.cs you'll find
    Code (CSharp):
    1. position = smoothPosition + rotation * (offset - Vector3.forward * distance);
    .
    After that line, make a Physics.SphereCast from the character towards position and if there is a hit, call that same line but with hit.distance instead of distance.

    Best,
    Pärtel
     
  2. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Hi Pärtel,
    Many thanks for your suggestion. I have been trying to implement but am struggling a bit:

    My code excerpt:
    // Position
    position = smoothPosition + rotation * (offset - Vector3.forward * distance);

    RaycastHit hit;
    if (Physics.SphereCast (transform.position, 2.0f, Vector3.forward, out hit, Mathf.Infinity)) {
    transform.position = hit.point;
    }


    // Translating the camera
    transform.position = position;
    transform.rotation = rotation;
    }

    I am not sure what you mean with:"call that same line but with hit.distance instead of distance."
    Would you be willing to take a look at this? How do I move the camera if a SphereCast is true in this code?
    I am struggling to avoid wall/object clipping, then you could also add this to a future update?
     
  3. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    I tried as you suggested but I still have not found any solution to this issue.
    When I disable executionOrder then my avatar is not locked to the controller's position (I get an out of body experience) when on sloped terrain or when falling or climbing stairs.

    [UPDATE]
    I have just tried adding a terrain to the VRIK (grounder) example, then I added a hill to the terrain.

    When I drag the "CenterEyeAnchor" object around to make the VRIK character walk up the hill I notice that the character is not locked to the hand or head targets and it begins to float away on the sloped terrain. So I know it's not my setup or armature, and this is an issue with VRIK/grounder/execution order.

    I can fix the VRIK (grounder) example by again re-enabling VRIK after executionOrder has disabled it.




    [UPDATE]

    I have found (by accident) that by adding two identical executionOrder scripts to my avatar then I get great results. Everything seems to be locked to the vive controls, the feet are always on the ground and the toes even bend correctly. It's very strange that I have to do this but here's a video showing the results:


    I'm affraid that by doing this I'm making the IK solvers run many more times than they need to but this is the only way I can get truly fluid visuals.

    Is this the only solution???
     
    Last edited: Nov 22, 2017
  4. skinwalker

    skinwalker

    Joined:
    Apr 10, 2015
    Posts:
    509
    Hey,

    If I have an animation (loop) where the finger's are not posed properly, because they have to pull down a rope, what's your suggestion to fix that? I really want to play my looped animation for the hand and arms, but only pose the fingers to be holding the rope properly.

    I think if I use the HandPoser, it will ignore the animation of the whole hand.
     
  5. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Here you go, will be added to the next version.

    Hey,
    I had actually already figured this out, but I forgot the solution :). It was in the Comments on the "READ ME!" gameobject. Basically just keep the IKExecutionOrder script as it was, but set "Lower Pelvis Weight" to 0 in the Grounder.

    Hey,
    You could apply offsets to finger bone localRotations in LateUpdate:

    Code (CSharp):
    1. indexBone1.localRotation = Quaternion.Euler(indexBone1Offset * offsetWeight) * indexBone1.localRotation;
    Declare those bone offsets so you could tweak them in the Editor.

    There is an IK tool for fingers (check out the "FingerRig" demo) as well, but I'm not sure if it would be any easier to set up. It's always a ton of manual work dealing with the fingers one way or another.

    Cheers,
    Pärtel
     
    CloudyVR likes this.
  6. AsaBattle

    AsaBattle

    Joined:
    Jan 3, 2017
    Posts:
    7
    Hi, I'm trying to use Photon to instantiate a vrik character on the network, and then attaching the htc vive hmd and controllers to that character/gameobject. Everything attaches, but the rotations are off on the model. Such that even though the headset is perfectly level and looking straight forward, the models head is looking straight up. And I have much the same issue with how the hands line up with the controllers. Where they are rotated at what looks to be a 90 degree angle to where I actually want them positioned. Is there a way to fix the rotation somewhere?
    Below, on the left, is a picture of how it looks when the headset is level and looking straight forward. On the right is how I'd like it to look( I have to physically rotate my headset to achieve this as of now)

    Thank you, Asa character example.jpg
     
  7. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Wow, cool, thanks Pärtel, I'm going to try right away!
     
  8. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    It is a bone orientation thing. Keep in mind that the IK solver matches the bones to the targets so that the position/rotation of the hand/head bone will be exactly the same as the IK target after the solving is done. Do not set IK targets directly to the controllers, they need to be gameobjects parented to the controllers, so you could adjust their localPosition/Rotation to compensate for the bone-controller orientation difference.

    Here's a workflow I'd recommend for networked VRIK, especially if you have avatars with arbitrary bone orientations:
    Make an avatar prefab, add a new GameObject as a child of it, parent 3 empty gameobjects to it - "CenterEyeAnchor", "LeftHandAnchor", "RightHandAnchor", position them to your model so the CenterEyeAnchor is where the eyes are and hand anchors placed as if they were Touch/Vive controllers in the hands of the model: Screenshot 2017-11-24 14.24.38.png

    Then add a script to the prefab:

    Code (CSharp):
    1. public Transform centerEyeAnchor, leftHandAnchor, rightHandAnchor;
    2.  
    3.     public Vector3 headLocalPosition { get; private set; }
    4.     public Vector3 leftHandLocalPosition { get; private set; }
    5.     public Vector3 rightHandLocalPosition { get; private set; }
    6.     public Quaternion headLocalRotation { get; private set; }
    7.     public Quaternion leftHandLocalRotation { get; private set; }
    8.     public Quaternion rightHandLocalRotation { get; private set; }
    9.  
    10.    void Awake() {
    11. Animator animator = GetComponent<Animator>();
    12.         Transform head = animator.GetBoneTransform(HumanBodyBones.Head);
    13.         Transform leftHand = animator.GetBoneTransform(HumanBodyBones.LeftHand);
    14.         Transform rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand);
    15.  
    16.         headLocalPosition = centerEyeAnchor.InverseTransformPoint(head.position);
    17.         leftHandLocalPosition = leftHandAnchor.InverseTransformPoint(leftHand.position);
    18.         rightHandLocalPosition = rightHandAnchor.InverseTransformPoint(rightHand.position);
    19.  
    20.         headLocalRotation = Quaternion.Inverse(centerEyeAnchor.rotation) * head.rotation;
    21.         leftHandLocalRotation = Quaternion.Inverse(leftHandAnchor.rotation) * leftHand.rotation;
    22.         rightHandLocalRotation = Quaternion.Inverse(rightHandAnchor.rotation) * rightHand.rotation;
    23.     }
    That calculates the localPositions/Rotations of the IK targets for you.
    Then you can create the IK proxies and targets for your remote avatar with a script like this:

    Code (CSharp):
    1. // Build VR anchor proxies
    2.         centerEyeProxy = new GameObject("Center Eye Proxy").transform;
    3.         centerEyeProxy.position = ik.references.head.position;
    4.         centerEyeProxy.rotation = ik.references.head.rotation;
    5.  
    6.         leftHandProxy = new GameObject("Left Hand Proxy").transform;
    7.         leftHandProxy.position = ik.references.leftHand.position;
    8.         leftHandProxy.rotation = ik.references.leftHand.rotation;
    9.  
    10.         rightHandProxy = new GameObject("Right Hand Proxy").transform;
    11.         rightHandProxy.position = ik.references.rightHand.position;
    12.         rightHandProxy.rotation = ik.references.rightHand.rotation;
    13.  
    14.         // Build and assign VRIK targets
    15.         ik.solver.spine.headTarget = new GameObject("VRIK Head Target").transform;
    16.         ik.solver.spine.headTarget.parent = centerEyeProxy;
    17.         ik.solver.spine.headTarget.localPosition = unitModelVRIK.headLocalPosition;
    18.         ik.solver.spine.headTarget.localRotation = unitModelVRIK.headLocalRotation;
    19.  
    20.         ik.solver.leftArm.target = new GameObject("VRIK Left Hand Target").transform;
    21.         ik.solver.leftArm.target.parent = leftHandProxy;
    22.         ik.solver.leftArm.target.localPosition = unitModelVRIK.leftHandLocalPosition;
    23.         ik.solver.leftArm.target.localRotation = unitModelVRIK.leftHandLocalRotation;
    24.  
    25.         ik.solver.rightArm.target = new GameObject("VRIK Right Hand Target").transform;
    26.         ik.solver.rightArm.target.parent = rightHandProxy;
    27.         ik.solver.rightArm.target.localPosition = unitModelVRIK.rightHandLocalPosition;
    28.         ik.solver.rightArm.target.localRotation = unitModelVRIK.rightHandLocalRotation;
    unitModelVRIK is a reference to the component that has the localPositions/Rotations (the first snippet).

    Then all you need to do is sync the centerEyeProxy, leftHandProxy and rightHandProxy to the position/rotations of the player's controllers in world space.

    Hope it helps,
    Pärtel
     
    ProtoPottyGames likes this.
  9. DiggingNebula8

    DiggingNebula8

    Joined:
    Oct 2, 2016
    Posts:
    21
    I've purchased Final IK a long time ago, and it's been a pleasure working with it. Now, I am thinking of buying Invector's TPS template, so I am just wondering about its integration with Final IK. Is it tedious or is it flexible?
     
  10. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    I am having trouble with recoil. I use the InteractionSystem to grab a sidearm that was a child of the animated rig's hip bone, I then use AimIK to aim the sidearm. I also use grounderIK for planting the feet, but I found that I had to use ExecutionOrder so the grounder solves first. And if I do not use ExecutionOrder then the interaction target and the actual hand will be offset.

    However by using execution order, I find that now the recoil twists in weird ways:


    Is this possible to fix? I feel like I'm stuck in a stale mate.

    ----
    one other question,

    I have created a few buttons that control my character's state. One button starts Lerping the AimIK weight from 0 to 1. However I want to start aiming the instant the sidearm has been parented to the character's hand (as well as blend AimIK's weight while putting the sidearm away).
    If it is possible to mix the two this would be very nice, so my character doesnt grab the weapon then put it down to his side only to lift it up and start aiming.

    Here's a video showing the character picking up the sidearm, aiming it, then putting it away.
    It shows that if I transition directly from full AimIK weight (during holstering of the sidearm) then the interaction system is not accurate, or there is some conflict and things get twisted:



    How should I blend InteractionIK directly into AimIK (and back again)? Thanks.

    [UPDATE]

    I have just replaced the GroundIK component with FBBIKGrounder. This helped with the recoil issue and I believe that is fixed. However I still had the issue of the target hand offset due to grounder and animator, so I wrote a script that stores the position of the target after ground offsets have been applied, then I apply those offsets in the next frame (which works well enough to get by for now).



    Any suggestions or tips on how to improve this would be very appreciated!
     
    Last edited: Nov 26, 2017
  11. Partel-Lang

    Partel-Lang

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

    They do have an integration package for FIK, but it was written by them so I have not tested that much. Should be smooth though, just let me or them know if you have any problems.

    Hey,
    Please try without the IKExecutionOrder, but with these changes to the InteractionSystem.cs:
    1. Rename LateUpdate to UpdateEffectors
    2. Add UpdateEffectors(); to the bottom of private void OnPreFBBIK()

    About blending AimIK weights, try using this technique:

    Code (CSharp):
    1. public AimIK ik;
    2.         [Tooltip("The direction of the animated weapon aiming in character space. Tweak this value to adjust the aiming.")] public Vector3 animatedAimingDirection = Vector3.forward;
    3.  
    4.         void LateUpdate () {
    5.             ik.solver.axis = ik.solver.transform.InverseTransformVector(ik.transform.rotation * animatedAimingDirection);
    6.         }
    It will basically tell AimIK that wherever the gun is pointing at in the animation, that is the forward direction, so you can actually even leave AimIK weight at 1 at all times. It also enables you to use recoil animation instead of that procedural recoil and also reloading animations with AimIK. You'll just might have to tweak the "animatedAimingDirection" vector in the Editor if the gun is not aiming 100% straight forward in the animation clip.

    Best,
    Pärtel
     
  12. DiggingNebula8

    DiggingNebula8

    Joined:
    Oct 2, 2016
    Posts:
    21
    Thank you so much, I will contact you whenever it is necessary. I will try to rewrite Invector’s IK solution with the help of Final IK, I certainly need your help to achieve it.

    Cheers.
     
  13. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476
    Hi Pärtel, I'm trying to use your updated CameraController.cs but am not seeing that it avoids objects/colliders, is there anything I need to set or be aware of? How did you test this, e.g. which scene with your asset, then I can try on there too to understand some more.
     
  14. AsaBattle

    AsaBattle

    Joined:
    Jan 3, 2017
    Posts:
    7
    This worked perfectly! Thank you very much!
     
  15. OllieCJ

    OllieCJ

    Joined:
    Aug 2, 2017
    Posts:
    8
    Dear Partel,

    I remember reading somehwere that the interaction system currently only works with FBBIK, and not VRIK. Has this changed at all?

    If not, then what would be the best system for implementing a full hand adjustment for the IK object when, for example, the hand is in close proximity to an object that is to be picked up? I'd imagine it looks similar to your answer in post #2908, but I was hoping to adjust the fingers as well and lerp between the player hand pose and desired grab pose based on proximity, similar to how the interaction system works currently.

    Best,
    O
     
  16. McGunn

    McGunn

    Joined:
    Aug 7, 2012
    Posts:
    33
    Hi.
    I'm having a serious issue with Final IK in 2017.2. (I've not yet tested in older versions).
    https://gyazo.com/4e13160a4b1251f0f62f949dd05266be
    The Biped character will not turn. (In this .gif the only key I'm pressed in D). This is a fresh project with Final IK and Puppet Master imported (I tested it importing them in both orders, with no difference). The quadruped, mech, and bot work just fine. The issue isn't related to input, but is instead related to the "Turn" parameter in the animator of the biped character. (The character also works properly in strafe mode).
    I've spent a lot of time in CharacterAnimationThirdPerson.cs at the "// Calculate the angular delta in character rotation" section at line 53-60 trying to resolve the issue, but I've had no luck. I suspect that there's a simple solution, I hope to hear back soon.

    Thanks,
    Curtis
     
  17. carsonkaucher

    carsonkaucher

    Joined:
    Sep 19, 2017
    Posts:
    5
    I just bought Final IK during a sale, and I was trying to set up a simple scene. I downloaded a pre-rigged model from Mixamo and set up a simple scene including the model, a plane, and the Camera Rig. When I ran the program, the hands were aligned really odd. The elbows were perfectly fine and I tried it with other models and even made an entirely new project. I have no clue what is wrong! Here are my screenshots. https://postimg.org/image/paiq5grln/
    https://postimg.org/image/xss69vipn/
    Thank you in advance!
     
  18. MrG

    MrG

    Joined:
    Oct 6, 2012
    Posts:
    363
    @carsonkaucher You need to bend the joints just slightly in the correct direction for the solver to work out which way they should bend. This has been covered in this thread many times. Please scroll back.
     
  19. carsonkaucher

    carsonkaucher

    Joined:
    Sep 19, 2017
    Posts:
    5
    @MrG How should I do this, I've already tried bending them in the bone editor and the changes won't show up in the scene. I've tried changing it in the scene, but it's still the same thing. I'm sorry, but I'm new to this and it would be helpful if someone directly told me how to do it.
     
  20. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey, did you set up the "Blocking Layers" to the objects that you need to block the camera?

    Hey,
    The InteractionSystem still works with just FBBIK. VR would require a whole new approach that is fundamentally different from what the InteractionSystem does.

    But the way I'd do it, parent a hand hierarchy to the object, similar to how you would pose an InteractionTarget.
    Then add this script to that hand target hierarchy:
    Code (CSharp):
    1. public class HandPose : MonoBehaviour {
    2.  
    3.     public Transform[] transforms { get; private set; }
    4.  
    5.     void Awake() {
    6.         transforms = (Transform[])GetComponentsInChildren<Transform>();
    7.     }
    8. }
    Add another target object like that to the hand anchor.

    Then, to the IK target of each hand, add this script:
    Code (CSharp):
    1. public class HandTarget : MonoBehaviour {
    2.  
    3.     [Range(0f, 1f)] public float weight = 1f;
    4.     public HandPose currentPose;
    5.     public Transform handBone;
    6.  
    7.     public Transform[] transforms = new Transform[0];
    8.     private Vector3 position;
    9.     private Vector3 lastPosition;
    10.     private Quaternion rotation = Quaternion.identity;
    11.     private Quaternion lastRotation = Quaternion.identity;
    12.     private Quaternion[] localRotations = new Quaternion[0];
    13.     private Quaternion[] lastLocalRotations = new Quaternion[0];
    14.  
    15.     private float lerpWeight;
    16.     private float lerpV;
    17.     private HandPose lastPose;
    18.  
    19.     void Start() {
    20.         transforms = (Transform[])handBone.GetComponentsInChildren<Transform>();
    21.         localRotations = new Quaternion[transforms.Length];
    22.         lastLocalRotations = new Quaternion[transforms.Length];
    23.  
    24.         position = transform.position;
    25.         rotation = transform.rotation;
    26.         lastPosition = position;
    27.         lastRotation = rotation;
    28.  
    29.         for (int i = 2; i < transforms.Length; i++) {
    30.             localRotations[i] = transforms[i].localRotation;
    31.             lastLocalRotations[i] = transforms[i].localRotation;
    32.         }
    33.     }
    34.  
    35.     void LateUpdate() {
    36.         if (weight <= 0f) return;
    37.         if (currentPose == null) return;
    38.  
    39.         // Changing the pose
    40.         if (currentPose != lastPose) {
    41.             position = lastPosition;
    42.             rotation = lastRotation;
    43.  
    44.             for (int i = 1; i < transforms.Length; i++) {
    45.                 localRotations[i] = lastLocalRotations[i];
    46.             }
    47.  
    48.             lerpWeight = 0f;
    49.             lastPose = currentPose;
    50.         }
    51.  
    52.         lerpWeight = Mathf.SmoothDamp(lerpWeight, 1f, ref lerpV, 0.1f);
    53.  
    54.         Vector3 p = Vector3.Lerp(position, currentPose.transform.position, lerpWeight);
    55.         transform.position = weight >= 1f? p: Vector3.Lerp(transform.position, p, weight);
    56.         lastPosition = transform.position;
    57.  
    58.         Quaternion r = Quaternion.Lerp(rotation, currentPose.transform.rotation, lerpWeight);
    59.         transform.rotation = weight >= 1f? r: Quaternion.Lerp(transform.rotation, r, weight);
    60.         lastRotation = transform.rotation;
    61.  
    62.         for (int i = 1; i < transforms.Length; i++) {
    63.             Quaternion localR = Quaternion.Lerp(localRotations[i], currentPose.transforms[i].localRotation, lerpWeight);
    64.             transforms[i].localRotation = weight >= 1f? localR: Quaternion.Lerp(transforms[i].localRotation, localR, weight);
    65.             lastLocalRotations[i] = transforms[i].localRotation;
    66.         }
    67.     }
    68.  
    You should then be able to switch between any object by just changing handTarget.currentPose to the HandPose parented to each object or if no object is held, the HandPose parented to the hand anchor.

    Hey,
    I'm already aware of this issue, it has got to do with all of the new physics issues introduced with Unity 2017.2 such as this, this, and this. Got to do with rotating Rigidbodies that have interpolation enabled. I suspect it happens when the Animator rotates objects with interpolated Rigidbodies by root motion. Also dependent on what your VSync value is in the project. Still looking into it, it's what's keeping me from pushing the next update, but technically it is just the demo character controller that is not working. The core functionality of the package is fine and you can still use it on any other character controller.

    Hey,
    Which IK component were you trying to use? If its FBBIK, please see this old tutorial.

    Cheers,
    Pärtel
     
  21. OllieCJ

    OllieCJ

    Joined:
    Aug 2, 2017
    Posts:
    8
    Amazing! Thank you for your in depth reply, these scripts are great.
    Best,
    O
     
  22. carsonkaucher

    carsonkaucher

    Joined:
    Sep 19, 2017
    Posts:
    5
  23. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,476

    Oops! My bad, it works nicely, awesome work!
     
  24. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    I am not able to make the character controller in any of the examples make turns. They just walks in straight lines with an occasional twitch a few degrees.

    I have created new projects using 2017.2.0f3 and 2017.3.0f1. I import the finalIK asset and run the demos and always get same behavior.This is also true for the character controllers in PuppetMaster..

    Video shows character controller bug in Unity 2017.3.x.

    The pilot character just will not turn! Only the mech, bot and quadruped work. Is this a Unity related issue?

    [UPDATE]
    Not sure if this will help but by disabling CharacterAnimationThirdPersonIK allows the character to turn, but it can no longer walk:


    [UPDATE]
    I just downloaded 2017.1.0f3 and tried the example and it works. So it's definitely version related, however my project requires 2017.3.x and I can't figure out what needs to change.

    [UPDATE]
    I have verified all of the above on a separate Windows PC and got same results for all versions.
     
    Last edited: Dec 4, 2017
  25. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    One more question, do you have the Animator enabled for that character? Please try disabling that and bending the limbs in the scene view (while not playing) as in the FBBIK tutorial. Please let me know how that works, I'm planning to restructure that for the next version as it is creating problems for many users.

    Hey,
    As I said in my last post, there are physics bugs in Unity 2017.2. I've made a bug report (as have many others) but Unity seems to consider it a "by design" or "won't fix" kind of a problem. It is actually just the demo character controller that is not working, the package can still be used with other character controllers. I'm working on a workaround, hold on...

    Best,
    Pärtel
     
    CloudyVR likes this.
  26. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Please import this patch, that should do it.

    Best,
    Pärtel
     
  27. ocimpean

    ocimpean

    Joined:
    Aug 10, 2013
    Posts:
    128
    I watched your videos how you apply whole body ik, on different characters or how you make a custom action, like opening a door or pushing a button.

    Could you clarify for me, how this animation is saved, what format, and how it is applied on the character in the game?
     
  28. AxisUnity

    AxisUnity

    Joined:
    May 16, 2017
    Posts:
    12
    Hello,

    First off all, this is an amazing asset, I love it. Great documentation and you cover almost everything in the demos.

    I am working on a baseball catcher controller and have almost everything worked out. I use different animations depending on where the ball is going to land along with IK for the precise catch position. When the ball is in the glove's collider, I set it's transform.parent to the glove's transform, reset it's local position and then gradually reduce the IK's weight (using FBBIK with effector to the left hand).

    All of this works wonders, but here is my issue: If I add a LookAtIK script to the catcher with the baseball as the target, it works up until the ball's transform parent is changed to the glove. After that, the look at is suddenly pointing to where the ball would be (instead of where the ball is) if the current animation had no IK. I feel like I might be missing something obvious here but I'm not sure what.

    I have noticed that this behavior is not happening in the demos that uses the interaction system, but if I remove the LookAtIK reference from the interaction system and simply set the target manually, the same issue occurs. I was wondering what I had to do to fix this without having to use an interaction system. (I did try using an IS instead of setting the parent myself during the collision, but the result ended up being very wierd and the ball was not in the correct position). I'm not sure what would be the best approach for this kind of controller, maybe my approach or using an interaction system are both fine, but I feel like there could be a simpler way I might be missing out on.

    PS: A ball or similar mid-air projectile catching scene in the demo would be sweet, the closest thing to it that I found in the demos were the Interaction ones.
     
  29. carsonkaucher

    carsonkaucher

    Joined:
    Sep 19, 2017
    Posts:
    5
    @Partel-Lang I just tried it out. It was the exact same thing as before. I do not have an animator on the model anymore. I added the FBBIK component and rotated the arms so that the IK could figure them out, but the hands are still 90 off. I tried rotating the hands slightly, but still nothing. I also clicked the guess hand orientations button. This is really annoying so I really hope you fix it soon.
     
    Last edited: Dec 6, 2017
  30. Volkerku

    Volkerku

    Joined:
    Nov 23, 2016
    Posts:
    113
    Hi
    Tried VRIK first time, with success but run into a few issues I do not know how to resolve. I’m using a Vive with the controllers and additional Vive trackers.
    I would like to be able to adjust the position (offset) and orientation of the controller/tracker in relation to the skeleton joints. These are currently not match correctly. Also player height and body proportions need adjustment. How would I go about this?
    Thanks, volker
     
  31. unity_3drapidsolutions

    unity_3drapidsolutions

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

    First off - thanks for making such incredible applications for the Unity community.

    I saw you are active in this forum so I thought I would post my question here. I found a similar question earlier in this discussion about a week ago, and your answer is here:

    https://forum.unity.com/threads/fin...d-ik-1-0-released.222685/page-59#post-3299076
    (I include this link as a reference to build off of)

    So let's get down to it. I am building a multiplayer VR experience based off of FinalIK, VRTK and Photon. The main problem I am having is getting the hands and head to optimally line up with the controller and viewpoint using the simple 'Pilot' model included in your product. I am able to make this system work if I use separate objects for the head and each hand, but everything goes awry when I try to include the pilot.

    Based on what you have said to the other commenter, it seems I should 'ideally' use the following structure

    (1) Main Prefab Gameobject
    (2a) Pilot Object, which has animator + VRIK component
    (3a) Skinned mesh renderer of pilot
    (3b) Folder of bone locations, named 'Pelvis'
    (3c) Grounder folder​
    (2b) Folder for all the actual VRIK Targets
    (3a) Head Target - Linked Directly to Headset
    (4a) VRIK Subtarget​
    (3b) Left Hand Target - Linked Directly to Controller
    (4a) VRIK Subtarget​
    (3c) Right Hand Target - Linked Directly to Controller
    (4a) VRIK Subtarget​

    The VRIK subtarget goes to the VRIK script, allowing me to make small alterations in translation/rotation to best match hands. The parent folders of each {head target, left/right hand} are connected directly to the VRTK sdk through a script that 'transformfollows' each folder to the relevant component of the VR system. The entire scheme is instantiated through VRTK and the head target/left hand target/right hand target become automatically children to the parent controller references.

    However, this structure creates lots of problems, so I found a more convoluted hierarchy method which worked better but still did not allow perfect alignment. Just like the other commenter, the head is always pointing upwards and the hands are not nearly aligned. It seems that simply translating and rotating the VRIK targets is having little effect.

    I saw the scripts you recommended including. The first script can be easily placed into the main prefab. The second script - I have no clue where the proper place to put it is and additionally much of it is not recognized, like the 'centerEyeProxy' and 'ik' component - I assume I have to include libraries but it is unclear how to do so.

    In conclusion, I have the following questions:

    (1) Do you have any experience integrating VRIK with VRTK into a networked game? If so, what is the ideal structure?

    (2) My main goal is to have the upper body animated with the controllers and the lower body with the animator. Is VRIK really the best tool? I do not fully understand what the advantages are of VRIK over other tools for VR development.

    (3) When is the appropriate times to use 'Fix Transforms' or 'Plant Feet' in the VRIK script?

    (4) How do I incorporate the second script in your example to the other user?

    (5) Do you have any tutorial available for this goal?
     
  32. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    That animation is not saved at all, it is a runtime modification of the animation, so the IK runs in each frame after the Animator, reads the current pose, solves according to it's parameters and writes the results back on the skeleton.

    Hey,
    So the problem is that LookAtIK solves before FBBIK. As it runs in LateUpdate that is after Animator.Update, it's target position (as it is parented to a hand) is set to where the ball would be in the animation clip. Then FBBIK runs and reorients the arms.

    You'll need to set LookAtIK's target position to where the ball will be at the end of the frame. One way to do that, set LookAtIK.solver.IKPosition to ball.position after FBBIK has updated using FBBIK's solver.OnPostUpdate delegate.
    LookAtIK will lag a frame behind of the target, but I don't think you'd ever notice that.

    Another way would be not to set LookAtIK target position to the ball itself, but it's position relative to handEffector.position and rotation.

    Also, if you don't need the looking behaviour to include any spine bones, just the neck and head, you could use AimIK instead and just make it update after FBBIK by using the IKExecutionOrder component.

    Oh, I see, it is the hands that are 90 degrees off from their targets? The IK components solve so that the bone rotations will match up with their IK targets, so it is the IK targets that you'll have to rotate. Different models have different bone orientations so those targets might need to be rotated if you switch characters. Do not assing the hand anchor directly as the IK target, parent an empty gameobject to it and use that instead so you could adjust it's localRotation. Please see this short tutorial to see how it's done.

    Hey,
    About the position and orientation of the controller relative to the skeleton, please see my answer to Carsonkaucher just above.
    Concerning player height, you can just scale the root of the avatar and the IK will adapt:
    Code (CSharp):
    1. ik.references.root.localScale *= (ik.solver.spine.headTarget.position.y / ik.references.head.position.y);
    The next version of FIK includes a calibrator tool for VRIK, also arm length multipler and automatic arm stretching. I'm planning to upload it for review next week, but if you are in a hurry, please just send me your invoice number to support@root-motion.com or PM.

    Hey,

    1. I do have experience integrating VRIK into a networked game, not with VRTK though, I've used other code for stuff like that. I just made a demo package for you that should help you get going. Please import it to a project with VRTK, Final IK and the Oculus/SteamVR utilities. I only tested it on Oculus since I dont have my Vive with me at the moment, but by all means it should work on both.

    2. Yes, you can do that by setting locomotion weight to 0 in VRIK settings. Then your legs will follow the animation and upper body follows the IK targets. About the advantages of VRIK over other tools, I'm not sure, don't really know of any other tools like that for Unity.

    3. It's all in the tooltips as with any other parameter of VRIK. Basically, "Fix Transforms" should be used if you have the Animator disabled or the solver uses any bones that are not animated. Prevents the solver from solving additively on top of it's own results. "Plat Feet" keeps the toes planted to the ground even if the head target is out of reach.

    4,5. Please see the demo, turned those snippets into proper scripts.

    Cheers,
    Pärtel
     
  33. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    I am getting the message "invalid rotation of interaction trigger". The object is a box with a rigidbody, and when it lands on certain faces (like dice toss) the message appears and the target is no longer accessible.

    My InteractionTrigger component object is a child of an InteractionTarget object (which is the root).

    I have enabled "Fix Y Axis", which works right up until the "dice" are at exactly right angles, then it breaks (but depends on which face points up).

    The only way I could imagine fixing this is to write a script that keeps the rotation of the InteractionTarget object always pointing up, but might not always work (eg. if orbit is disabled).

    Is there any particular way I should configure an interaction target for use with cubes/dice that can land on any side?

    Thanks!
     
  34. unity_3drapidsolutions

    unity_3drapidsolutions

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

    I am stunned by your generosity and overnight response. The package you sent worked beautifully, and by reading your code I better understand this issue which I spent weeks trying to resolve. For clarification, I was asking before why I should use VRIK over your other solvers, like full body IK, Biped IK, etc. What precisely are the additional benefits? (I did look through your main website, http://www.root-motion.com/final-ik.html, but I could not find an answer)
     
  35. ocimpean

    ocimpean

    Joined:
    Aug 10, 2013
    Posts:
    128
    I apologize for ignorant questions.
    I am trying to understand about this program as I used to love to animate in Maya/Motionbuilder, but have
    little-no programming knowledge.
    So you said, that the animation is not saved but called at runtime. What I don't understand, how this process is working, as I didn't see example on your videos, do you have a component that is added to the character that automatically saves this info, and you have a script that calls it at runtime and is automatically handled by Final IK, or I have to write a script to do that? Let's say I have Invector Third Person and I have character arriving at a door, and I want it to ring the bell. I animate that scene in Final IK, then I want to have it in the game, at the same precise area, also maybe I want use it in Slate for a cut scene. Is this possible, and what are the steps that I have to follow?

    Thank you
     
  36. unity_3drapidsolutions

    unity_3drapidsolutions

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

    One more quick question,

    The package you developed properly maps everything together (model skeleton and hmd/controllers) but it requires the player prefab to already be present in the scene due to the Avatar Setup script. In my online design, the player prefab must be instantiated upon joining a room, but the 'Avatar Setup' script attached to OculusVR and SteamVR loses (forgets?) the 'Model' component since it is not present at runtime. Do you have any advice how to reorganize this so the avatarsetup occurs after joining a room? I've tried to set the value of 'Model' after runtime but it is not seeming to help.
     
  37. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    95
    Hi Partel,

    I am trying to add FBBIK and HeadEffector to my model in run time.
    I found your script here the I used it with a little modification for my model.
    Now FBBIK works just fine but the HeadEffector seems not working as I get an error of
    in the console window.
    Any idea, please? Do I have to set something else to make it work?

    FYI, here is the code I use. In the start function, I just load asset bundles, then I apply FBBIK and HeadEffector in ApplyFBBIK function.
    Code (CSharp):
    1.    
    2.  IEnumerator Start()
    3.     {
    4.         var resultAssetBundle = AssetBundle.LoadFromFileAsync(AssetPath + "/" + assetBundleName);
    5.  
    6.         yield return new WaitWhile(() => resultAssetBundle.isDone == false);
    7.  
    8.         var assetbundle = resultAssetBundle.assetBundle;
    9.         var resultObject = assetbundle.LoadAssetAsync<GameObject>(assetName);
    10.  
    11.         yield return new WaitWhile(() => resultObject.isDone == false);
    12.  
    13.         obj = Instantiate(resultObject.asset) as GameObject;
    14.  
    15.         assetbundle.Unload(false);
    16.  
    17.         ApplyFBBIK(obj);
    18.     }
    19.  
    20.     public void ApplyFBBIK(GameObject obj)
    21.        {
    22.  
    23.         List<GameObject> bonesList = GetAllChildren.GetAll(obj);
    24.  
    25.         for (int i = 0; i < bonesList.Count; i++)
    26.         {
    27.             string name = bonesList[i].name;
    28.             if (bonesList[i].name.Contains("Col") == false)
    29.             {
    30.  
    31.                 if (bonesList[i].name.Contains(".joint_Head"))
    32.                 {
    33.                     joint_Head = bonesList[i].transform;
    34.                 }
    35.  
    36.                 if (bonesList[i].name.Contains(".joint_Torso"))
    37.                 {
    38.                     if (bonesList[i].name.Contains(".joint_Torso2"))
    39.                     {
    40.                         joint_Torso[1] = (bonesList[i].transform);
    41.                     }
    42.                     else
    43.                     {
    44.                         joint_Torso[0] = (bonesList[i].transform);
    45.                     }
    46.                 }
    47.  
    48.                 if (bonesList[i].name.Contains(".joint_LeftEye"))
    49.                 {
    50.                     joint_Eyes[0] = (bonesList[i].transform);
    51.                 }
    52.  
    53.                 if (bonesList[i].name.Contains(".joint_RightEye"))
    54.                 {
    55.                     joint_Eyes[1] = (bonesList[i].transform);
    56.                 }
    57.  
    58.                 if (bonesList[i].name.Contains(".!Root"))
    59.                 {
    60.                     root = (bonesList[i].transform);
    61.                 }
    62.             }
    63.         }
    64.         FullBodyBipedIK ik = obj.AddComponent<FullBodyBipedIK>();
    65.        
    66.         BipedReferences references = new BipedReferences();
    67.         BipedReferences.AutoDetectReferences(ref references, ik.transform, BipedReferences.AutoDetectParams.Default);
    68.         ik.SetReferences(references, null);
    69.        
    70.         ik.solver.leftHandEffector.maintainRelativePositionWeight = 0.75f;
    71.         ik.solver.rightHandEffector.maintainRelativePositionWeight = 0.75f;
    72.  
    73.         GameObject headEffectorGO = new GameObject();
    74.         headEffectorGO.name = ik.gameObject.name + " Head Effector";
    75.         headEffectorGO.transform.position = references.head.position;
    76.         headEffectorGO.transform.rotation = references.head.rotation;
    77.  
    78.         FBBIKHeadEffector headEffector = headEffectorGO.AddComponent<FBBIKHeadEffector>();
    79.         headEffector.ik = ik;
    80.  
    81.         FBBIKHeadEffector.BendBone spine = new FBBIKHeadEffector.BendBone();
    82.         spine.transform = references.spine[0];
    83.         spine.weight = 1f;
    84.  
    85.         FBBIKHeadEffector.BendBone chest = new FBBIKHeadEffector.BendBone();
    86.         chest.transform = references.spine[1];
    87.         chest.weight = 0.75f;
    88.  
    89.         headEffector.bendBones = new FBBIKHeadEffector.BendBone[2] {
    90.                   spine,
    91.                   chest
    92.               };
    93.        
    94.         headEffector.bendWeight = 1f;
    95.         headEffector.positionWeight = 1f;
    96.         headEffector.rotationWeight = 1f;
    97.        
    98.         lookAtIK = obj.AddComponent<LookAtIK>();
    99.         lookAtIK.solver.SetChain(joint_Torso, joint_Head, joint_Eyes, root);
    100.     }
    101.  
     

    Attached Files:

  38. carsonkaucher

    carsonkaucher

    Joined:
    Sep 19, 2017
    Posts:
    5
  39. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Perhaps it would be better to make a script that makes the trigger follow the object's position, instead of parenting it to an object that can rotate in arbitrary ways?

    Hey,
    You're welcome. It is better over FullBodyBipedIK because the FBBIK doesn't have a head effector built it. There is a hack (FBBIKHeadEffector.cs) that I used before I had VRIK, but VRIK is twice as fast and has more options for VR-specific stuff. BipedIK doesn't have a head effector at all, I haven't even tried to use it for VR.

    Hey,
    You don't animate with Final IK at all. You just add an IK component to the character and it will enable you to modify whatever the animation that is playing more easily than just by rotating the bones. For example if you have aiming animation playing on the character, but that animation is not aiming exactly where you need your game character to aim at. You can just add the AimIK component to the root of your character, set it up, give it a target and your character will be aiming perfectly at that target once you play the game. It doesn't bake or save any of that, it is all dynamically computed each frame in runtime. Think of it as a procedural layer on top of your baked animation.

    When you instantiate the avatar, just use GetComponent to get the AvatarModel that is already on that prefab.

    About AvatarSetup, it was only necessary for this demo. In your networked game, just call avatarModel.CreateIKTargets() with the proxies you create for it. Or update AvatarModel.cs to this:
    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3. using RootMotion.FinalIK;
    4.  
    5. public class AvatarModel : MonoBehaviour {
    6.  
    7.     [Tooltip("The Transform representing the position and rotation of the 'CenterEyeAnchor'[Oculus] or 'Camera (head)'[SteamVR] relative to this model.")]
    8.     public Transform centerEyeAnchor;
    9.  
    10.     [Tooltip("The Transform representing the position and rotation of the 'LeftHandAnchor'[Oculus] or 'Controller (left)'[SteamVR] relative to this model.")]
    11.     public Transform leftHandAnchor;
    12.  
    13.     [Tooltip("The Transform representing the position and rotation of the 'RightHandAnchor'[Oculus] or 'Controller (right)'[SteamVR] relative to this model.")]
    14.     public Transform rightHandAnchor;
    15.     public Vector3 headLocalPosition { get; private set; }
    16.     public Vector3 leftHandLocalPosition { get; private set; }
    17.     public Vector3 rightHandLocalPosition { get; private set; }
    18.     public Quaternion headLocalRotation { get; private set; }
    19.     public Quaternion leftHandLocalRotation { get; private set; }
    20.     public Quaternion rightHandLocalRotation { get; private set; }
    21.     public Transform centerEyeProxy { get; private set; }
    22.     public Transform leftHandProxy { get; private set; }
    23.     public Transform rightHandProxy { get; private set; }
    24.  
    25.     private VRIK ik;
    26.  
    27.     void Awake() {
    28.         ik = GetComponent<VRIK>();
    29.         Animator animator = GetComponent<Animator>();
    30.  
    31.         // Find the head and hand bones
    32.         Transform head = animator.GetBoneTransform(HumanBodyBones.Head);
    33.         Transform leftHand = animator.GetBoneTransform(HumanBodyBones.LeftHand);
    34.         Transform rightHand = animator.GetBoneTransform(HumanBodyBones.RightHand);
    35.  
    36.         // Positions of the bones relative to their anchors
    37.         headLocalPosition = centerEyeAnchor.InverseTransformPoint(head.position);
    38.         leftHandLocalPosition = leftHandAnchor.InverseTransformPoint(leftHand.position);
    39.         rightHandLocalPosition = rightHandAnchor.InverseTransformPoint(rightHand.position);
    40.  
    41.         // Rotations of the bones relative to their anchors
    42.          headLocalRotation = Quaternion.Inverse(centerEyeAnchor.rotation) * head.rotation;
    43.          leftHandLocalRotation = Quaternion.Inverse(leftHandAnchor.rotation) * leftHand.rotation;
    44.          rightHandLocalRotation = Quaternion.Inverse(rightHandAnchor.rotation) * rightHand.rotation;
    45.  
    46.         centerEyeProxy = new GameObject("Center Eye Proxy").transform;
    47.         centerEyeProxy.position = centerEyeAnchor.position;
    48.         centerEyeProxy.rotation = centerEyeAnchor.rotation;
    49.  
    50.         leftHandProxy = new GameObject("Left Hand Proxy").transform;
    51.         leftHandProxy.position = leftHandAnchor.position;
    52.         leftHandProxy.rotation = leftHandAnchor.rotation;
    53.  
    54.         rightHandProxy = new GameObject("Right Hand Proxy").transform;
    55.         rightHandProxy.position = rightHandAnchor.position;
    56.         rightHandProxy.rotation = rightHandAnchor.rotation;
    57.  
    58.          // We have calculated all the localPositions/Rotations, so we don't need those gameobjects anymore.
    59.          Destroy(centerEyeAnchor.parent.gameObject);
    60.     }
    61.  
    62.     /// <summary>
    63.     /// Creates the IK targets for VRIK based on the localPositions/Rotations calculated above, parents those IK targets to the proxies.
    64.     /// </summary>
    65.     public void CreateIKTargets(Transform centerEyeProxy, Transform leftHandProxy, Transform rightHandProxy) {
    66.         // Build and assign VRIK targets
    67.         ik.solver.spine.headTarget = new GameObject("VRIK Head Target").transform;
    68.         ik.solver.spine.headTarget.parent = centerEyeProxy;
    69.         ik.solver.spine.headTarget.localPosition = headLocalPosition;
    70.         ik.solver.spine.headTarget.localRotation = headLocalRotation;
    71.         ik.solver.leftArm.target = new GameObject("VRIK Left Hand Target").transform;
    72.         ik.solver.leftArm.target.parent = leftHandProxy;
    73.         ik.solver.leftArm.target.localPosition = leftHandLocalPosition;
    74.         ik.solver.leftArm.target.localRotation = leftHandLocalRotation;
    75.         ik.solver.rightArm.target = new GameObject("VRIK Right Hand Target").transform;
    76.         ik.solver.rightArm.target.parent = rightHandProxy;
    77.         ik.solver.rightArm.target.localPosition = rightHandLocalPosition;
    78.         ik.solver.rightArm.target.localRotation = rightHandLocalRotation;
    79.     }
    80.  
    81.     /// <summary>
    82.     /// Creates the IK targets, parents them to the proxies that have already been created in Awake.
    83.     /// </summary>
    84.     public void CreateIKTargets() {
    85.         CreateIKTargets(centerEyeProxy, leftHandProxy, rightHandProxy);
    86.     }
    87. }
    88.  
    to have it create the proxies for you too. Then you'd just have to instantiate the model, get the AvatarModel component on it, call avatarModel.CreateIKTargets(the override without any parameters). All you need to do after that is sync avatarModel.centerEyeProxy, leftHandProxy and rightHandProxy to the positions/rotations of the owner player's VR devices.

    Hey,
    Please go to FBBIKHeadEffector.cs and rename Awake to Start, it had already made that change for the next version.

    Cheers,
    Pärtel
     
    ocimpean likes this.
  40. Kagyu

    Kagyu

    Joined:
    Mar 5, 2016
    Posts:
    95
    Partel,
    Got it and now it is working perfectly!
    Thank you so much!
     
  41. specsdev

    specsdev

    Joined:
    Apr 28, 2014
    Posts:
    2
    Hi Partel,
    Actually, I can use the arms of my model with the htc vive using SteamVR with no problems. But I always get this errors

    referring to this line of code
    Code (CSharp):
    1. var capactiy = hmd.GetStringTrackedDeviceProperty(deviceId, prop, null, 0, ref error);
    Can you please help me to fix it?
    thanks!
     
  42. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    Great! I had a similar idea but just wanted to check if there was a more internal approach. Thanks again!
     
  43. CloudyVR

    CloudyVR

    Joined:
    Mar 26, 2017
    Posts:
    714
    I was wondering how I can reduce this visible wrist twisting with VRIK? I notice the forearm does not rotate at all when the wrists are rotated and I was wondering if it would be possible to spread out and apply the rotations up the chain?



    Also I am having trouble where my avatar is not always attached to my headset and I can sometimes see the back of my avatar's head:


    Any chance there is something I can do to make this look better?

    [Update]
    As for the second issue I tried disabling "plant feet" which helped significantly, but not entirely.

    I am wondering if this has something to do with my avatar's height? Any ideas on how to stretch or fit the avatar to the proper player's height?
     
    Last edited: Dec 13, 2017
  44. Padilha

    Padilha

    Joined:
    Jun 6, 2016
    Posts:
    12
    I import the finalIK asset and run the demos and always get same behavior, i was able to make the bug works in 2:05. Video shows character controller bug in Unity 2017.2.x.

     
  45. Riderfan

    Riderfan

    Joined:
    Jan 10, 2013
    Posts:
    514
    Hi there.

    I'm using a BipedIK component and I'm trying to do two things at once.

    I'm giving the right and left hand solvers their IKPositions, and that's working okay, but I'm also trying to rotate the hands so the palms are facing a different target. I've tried numerous variants of Quaternion.LookRotation() to set the IKRotation but the hands always rotate in strange ways.

    Is there an example of hand rotation so they face something other than their target positions? I'm probably using the wrong method here. The local axis of the hand bones are Z forward if that helps.

    thanks
     
  46. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    That error has nothing to do with Final IK, no idea, sorry.

    Hey,
    About the first issue, please see the "VRIK (Twist Relaxers)" demo.

    Disabling Plant Feet should do it. Could you check if the head IK target just lags behind if you move the HMD very fast?

    Hey, here's a patch to the character controller physics bug in Unity 2017.2 and here's another for the wall interactions.

    Hey,
    Here's a method for you:

    Code (CSharp):
    1. /// <summary>
    2.         /// Used for matching the rotations of objects that have different orientations.
    3.         /// </summary>
    4.         public static Quaternion MatchRotation(Quaternion targetRotation, Vector3 targetforwardAxis, Vector3 targetUpAxis, Vector3 forwardAxis, Vector3 upAxis) {
    5.             Quaternion f = Quaternion.LookRotation(forwardAxis, upAxis);
    6.             Quaternion fTarget = Quaternion.LookRotation(targetforwardAxis, targetUpAxis);
    7.  
    8.             Quaternion d = targetRotation * fTarget;
    9.             return d * Quaternion.Inverse(f);
    10.         }
    set IKRotation to
    Code (CSharp):
    1. MatchRotation(target.rotation, Vector3.forward, Vector3.up, handBoneAxisPointingForward, handBoneAxisPointingUp);
    Cheers,
    Pärtel
     
  47. Subzeroblack68

    Subzeroblack68

    Joined:
    Apr 3, 2014
    Posts:
    19
    So was setting up my VRIK character like in the video and I noticed theres a HitReaction VRIK script... is it meant to function/setup like your HitReaction video except on the VR player character? So my character can react to getting hit since I as the person/player cant react to hits? ....Also is there a tutorial on how to set it up or is it similar to the standard HitReaction?
     
  48. blitzvb

    blitzvb

    Joined:
    Mar 20, 2015
    Posts:
    284
    Hey,

    Performance wise is it possible to have ground IK for multiple units at the same time ?

    Thanks in advance.
     
  49. Partel-Lang

    Partel-Lang

    Joined:
    Jan 2, 2013
    Posts:
    2,548
    Hey,
    Sorry, that's a WIP, got into the package by accident, doesnt really work yet.

    Hey,
    Sure no problem. If you use GrounderIK with LimbIK components instead of GrounderFBBIK with FBBIK, that will be as fast as this kind of a thing can ever be.

    Best,
    Pärtel
     
    blitzvb likes this.
  50. Subzeroblack68

    Subzeroblack68

    Joined:
    Apr 3, 2014
    Posts:
    19
    oh lol, was just curious what it was.