Advertisement
Eonirr

Untitled

Feb 6th, 2024
16
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. for (int i = 0; i < bulletsPerShoot; i++)
  2. {
  3. Ray ray = ust.playerCamera.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
  4.  
  5.  
  6. float x = Random.Range(-spread / 100 , spread / 100);
  7. float y = Random.Range(-spread / 200, spread / 200);
  8.  
  9. if (Physics.Raycast(ray, out hit))
  10. {
  11. targetPoint = hit.point + new Vector3(x, y, 0);
  12. }
  13. else
  14. {
  15. targetPoint = ray.GetPoint(range) + new Vector3(x, y, 0);
  16. }
  17.  
  18. InstantiateBullet(bulletDamage, bulletHeadDamage);
  19.  
  20. bulletsLeft--;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement