SHARE
TWEET

UNITY 3D IK

a guest Apr 29th, 2018 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     public Vector3 offset_target;
  2.     private Animator mAnimator;
  3.     public Transform target;
  4.  
  5.     Vector3 targetPosition;
  6.     Vector3 dampVelocity;
  7.  
  8.     // Use this for initialization
  9.     void Start () {
  10.         mAnimator = GetComponent<Animator>();
  11.  
  12.     }
  13.    
  14.     void Update () {
  15.  
  16.     }
  17.  
  18.     void OnAnimatorIK() {
  19.         if (activeIK == false) {
  20.             mAnimator.SetLookAtWeight (0, 0, 0, 0, 0);
  21.        
  22.         }
  23.           else {
  24.             targetPosition = Vector3.SmoothDamp(targetPosition, target.position, ref dampVelocity, 0.2f);
  25.             mAnimator.SetLookAtPosition (target.position);
  26.             mAnimator.SetLookAtWeight (1, 1 , 1, 1, 1);
  27.  
  28.         }
  29.  
  30.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top