Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Mad() {
- float rocketSpeed = 2000;
- Rigidbody2D bulletInstance = Instantiate(rocket, transform.position, Quaternion.Euler(new Vector3(0, 0, 0))) as Rigidbody2D;
- Vector3 pos = Camera.main.WorldToScreenPoint(transform.position);
- Vector3 dir = Input.mousePosition - pos;
- bulletInstance.transform.LookAt(dir);
- myRigidbody = GetComponent<Rigidbody2D>();
- myRigidbody.AddForce(bulletInstance.transform.forward * rocketSpeed);
Add Comment
Please, Sign In to add comment