Skip to content

Instantly share code, notes, and snippets.

@Plnda
Created May 20, 2022 07:54
Show Gist options
  • Save Plnda/3e87e26687f0e663628b61c1e9d4088e to your computer and use it in GitHub Desktop.
Save Plnda/3e87e26687f0e663628b61c1e9d4088e to your computer and use it in GitHub Desktop.
var projectileCount = 3;
var initialOffset = -30;
for(int i = 0; i < projectileCount; i++) {
var projectile = Instantiate(projectile, cam.transform.position, cam.transform.rotation * Quaternion.Euler(0,initialOffset,0));
initalOffset += 30;
projectile.GetComponent<Rigidbody>().AddForce(projectile.transform.forward * 15, ForceMode.Impulse);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment