Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for(var touch: Touch in Input.touches){
- if(touch.phase == TouchPhase.Stationary){
- this.rigidbody.isKinematic = true;
- }else if(touch.phase == TouchPhase.Ended){
- this.rigidbody.isKinematic = false;
- }else if(touch.phase == TouchPhase.Moved){
- moveVector = startPos - touch.position;
- }
- if(inverted == false){
- this.rigidbody.AddForce(-moveVector.normalized,ForceMode.Impulse);
- }else if(inverted == true){
- this.rigidbody.AddForce(moveVector.normalized,ForceMode.Impulse);
- }
- }
Add Comment
Please, Sign In to add comment