#RightHandIK

1 messages · Page 1 of 1 (latest)

rancid jetty
#

Does anyone know how to move the righthandIK?

echo chasm
#

What I did was moved the gun to fit in the right hand then parented the gun to the right hand or you could try making a custom animLayer script to do pretty much the same thing that the leftIKLayer does but for right Hand.

stoic sable
novel dirge
#

would the arm follow the weapon if I rotate it during an animation through this method?

stoic sable
cedar sky
#

@echo chasm did you manage to do the right hand ik layer? Beacuse i did my own layer just copied the leftHandIKLayer script changed the names to "Right" and added a reference to it in the CoreToolKitLib.cs but it doesnt seem to work. I even made sure to put right ik layer before the left ik layer, and my weapon objects are parented to rightHand.

stoic sable
cedar sky
# stoic sable If your weapons are parented to the right hand, and you want to modify its rotat...

did you mean something like this using Kinemation.FPSFramework.Runtime.Core;
using UnityEngine;

namespace Kinemation.FPSFramework.Runtime.Layers
{
public class RightHandIKLayer : AnimLayer
{
public Transform rightHandTarget;
private Transform gunHolderTransform;

    public override void OnAnimUpdate()
    {
        var target = GetGunData().rightHandTarget == null ? rightHandTarget : GetGunData().rightHandTarget;
        var rightHand = core.rigData.rightHand.obj.transform;

        if (gunHolderTransform == null)
        {
            gunHolderTransform = GetGunData().gunHolder.transform;
        }

        var gunHolderRotation = gunHolderTransform.rotation;
        var gunHolderPosition = gunHolderTransform.position;

        rightHand.position = Vector3.Lerp(rightHand.position, target.position, smoothLayerAlpha);
        rightHand.rotation = Quaternion.Slerp(rightHand.rotation, target.rotation, smoothLayerAlpha);

        gunHolderTransform.rotation = gunHolderRotation;
        gunHolderTransform.position = gunHolderPosition;
    }
}

}

cedar sky
#

i mean. it sort of works but when i pick up a weapon it rotates weirdly

#

this is with righHandIKLayer off:

cedar sky
#

i mean their transforms

stoic sable
#

The problem is that the weapon is parented to the right hand. So, instead of using a transform as a target for the right hand, you need to add a LocRot property to the weapon anim data, then instead of just setting rightHand transform, you need to use that LocRot property to translate and rotate bone

cedar sky
#

Btw. the rightHandIK transform should be parented to the "GunModelRecoilRef" object since my weapon recoil is applied only to that object and by logic all the children of that object. And when the bone uses the LocRot property then it doesnt include that recoil beacuse its a set variable.

#

but maybe my implementation was just wrong and i can somehow use the LocRot while including the recoil but, i dont know how, or if its even possible.

cedar sky
#

@stoic sable

stoic sable
#

@cedar sky Sorry for the delay. You don't have to parent the right hand IK transforms to the gun model itself, as recoil is applied to the hands via IK, and if gun is already parented to the hand bone (which is your case, correct if I'm mistaken) it will work fine

#

You can't really use the "left hand ik"-like method here, as the right hand also contains keyframed data from your animations, so you need an additive solution. Simply put, you want just to offset the right hand, so it matches the position/rotation of the rightHanfIK game object

stoic sable