daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 46 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Mad() {
  2.  
  3.     float rocketSpeed = 2000;
  4.     Rigidbody2D bulletInstance = Instantiate(rocket, transform.position, Quaternion.Euler(new Vector3(0, 0, 0))) as Rigidbody2D;
  5.     Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
  6.     Vector3 dir = Input.mousePosition - pos;
  7.     bulletInstance.transform.LookAt(dir);
  8.  
  9.  
  10.  
  11.     myRigidbody = GetComponent<Rigidbody2D>();
  12.     myRigidbody.AddForce(bulletInstance.transform.forward * rocketSpeed);
RAW Paste Data
Top