daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Apr 16th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for(var touch: Touch in Input.touches){
  2.     if(touch.phase == TouchPhase.Stationary){
  3.         this.rigidbody.isKinematic = true;
  4.     }else if(touch.phase == TouchPhase.Ended){
  5.         this.rigidbody.isKinematic = false;
  6.     }else if(touch.phase == TouchPhase.Moved){
  7.         moveVector = startPos - touch.position;
  8.     }
  9.  
  10.     if(inverted == false){
  11.         this.rigidbody.AddForce(-moveVector.normalized,ForceMode.Impulse);
  12.     }else if(inverted == true){
  13.         this.rigidbody.AddForce(moveVector.normalized,ForceMode.Impulse);
  14.     }                  
  15. }
RAW Paste Data
Top