Advertisement
Guest User

aim

a guest
May 1st, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1.     void OnAnimatorIK(){
  2.  
  3.         if (activeIK == false) {
  4.             mAnimator.SetLookAtWeight (0, 0, 0, 0, 0);
  5.  
  6.         }
  7.         else {
  8.  
  9.             Vector3 vtarget = target.position;
  10.             vtarget.y = vtarget.y + aimAdjustment;
  11.             mAnimator.SetLookAtPosition (vtarget);
  12.             mAnimator.SetLookAtWeight (1, 1, 1, 1, 1);
  13.  
  14.             if (leftHandle != null) {
  15.                 mAnimator.SetIKPosition (AvatarIKGoal.LeftHand, leftHandle.transform.position);
  16.                 mAnimator.SetIKRotation (AvatarIKGoal.LeftHand, leftHandle.transform.rotation);
  17.                 mAnimator.SetIKPositionWeight (AvatarIKGoal.LeftHand, 1);
  18.                 mAnimator.SetIKRotationWeight (AvatarIKGoal.LeftHand, 1);
  19.             }
  20.  
  21.             if (rightHandle != null) {
  22.                 mAnimator.SetIKPosition (AvatarIKGoal.RightHand, rightHandle.transform.position);
  23.                 mAnimator.SetIKRotation (AvatarIKGoal.RightHand, rightHandle.transform.rotation);
  24.                 mAnimator.SetIKPositionWeight (AvatarIKGoal.RightHand, 1);
  25.                 mAnimator.SetIKRotationWeight (AvatarIKGoal.RightHand, 1);
  26.             }
  27.  
  28.         }
  29.            
  30.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement