Advertisement
Guest User

s

a guest
May 27th, 2015
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1.  
  2. var mousePosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
  3.  
  4. Quaternion rot = Quaternion.LookRotation(transform.position - mousePosition,Vector3.forward);
  5.  
  6. transform.rotation = rot;
  7. transform.eulerAngles = new Vector3 (0, 0, transform.eulerAngles.z);
  8.  
  9.  
  10. float input = Input.GetAxis ("Vertical");
  11. rigidbody2d.AddForce (gameObject.transform.up * speed * input);
  12.  
  13.  
  14.  
  15. public float speed;
  16. public float time;
  17. public Rigidbody2D rigidbody2d;
  18. Animator anim;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement