public virtual void LoadIKAdjust(string category) { if (weaponIKAdjustList) { currentWeaponIKAdjust = weaponIKAdjustList.GetWeaponIK(category); } }
public void SetIKAdjust(vWeaponIKAdjust iKAdjust) { if (shooterManager) { shooterManager.SetIKAdjust(iKAdjust); } }
protected virtual void UpdateIKAdjust(bool isUsingLeftHand) { vWeaponIKAdjust weaponIKAdjust = shooterManager.CurrentWeaponIK; if (!weaponIKAdjust || IsAnimatorTag("IgnoreIK")) { weaponIKWeight = 0; return; } weaponIKWeight = Mathf.Lerp(weaponIKWeight, IsReloading || IsEquipping ? 0 : 1, 25f * Time.deltaTime); if (weaponIKWeight <= 0) { return; } // create left arm ik solver if equal null if (LeftIK == null) { LeftIK = new vIKSolver(animator, AvatarIKGoal.LeftHand); LeftIK.UpdateIK(); } if (RightIK == null) { RightIK = new vIKSolver(animator, AvatarIKGoal.RightHand); RightIK.UpdateIK(); } if (isUsingLeftHand) { ApplyOffsets(weaponIKAdjust, LeftIK, RightIK); } else { ApplyOffsets(weaponIKAdjust, RightIK, LeftIK); } }
protected virtual void ApplyOffsets(vWeaponIKAdjust weaponIKAdjust, vIKSolver weaponHand, vIKSolver supportHand) { bool isValid = weaponIKAdjust != null; weaponHand.SetIKWeight(weaponIKWeight); IKAdjust ikAdjust = isValid ? weaponIKAdjust.GetIKAdjust(isAiming, isCrouching) : null; //Apply Offset to Weapon Arm ApplyOffsetToTargetBone(isValid ? ikAdjust.weaponHandOffset : null, weaponHand.endBoneOffset, isValid); ApplyOffsetToTargetBone(isValid ? ikAdjust.weaponHintOffset : null, weaponHand.middleBoneOffset, isValid); //Apply offset to Support Weapon Arm ApplyOffsetToTargetBone(isValid ? ikAdjust.supportHandOffset : null, supportHand.endBoneOffset, isValid); ApplyOffsetToTargetBone(isValid ? ikAdjust.supportHintOffset : null, supportHand.middleBoneOffset, isValid); //Convert Animatorion To IK with offsets applied if (isValid) { weaponHand.AnimationToIK(); } }
public virtual void SetIKAdjust(vWeaponIKAdjust iKAdjust) { currentWeaponIKAdjust = iKAdjust; }