Explosions near the object exploding

I have my space staion exploding
but the biggest prefab i have isnt big enough but a think a few explosions going off will look pretty cool

this line:
Instantiate(stationExplosion, transform.position, transform.rotation);

is creating the prefab explosion in the objects transform.

I created empty game objects called explosion2 3 etc

and dragged them in the inspector but i cant work out how to instantiate the explosions at the new
“Way points”

Instead of transform.position use explosion2.transform.position for example.

1 Like

Bummer! I hate when that happens.

Usually you just make a script that instantiates the explosions at various positions in and around the object that is going away.

So structurally:

SpaceStation
   AllVisibleStuffAndOtherSpaceStationStuff
   ThingsThatGoBoom
      WhereTheyGoBoom
          x
          x
          x
          x

Then basically you would have a script that would spawn explosions at each of the points marked “x” above.

Bonus: if you make that spawner a coroutine you can delay each subsequent explosion by a small amount and it looks super cool as stuff chain-reactions along and the whole thing goes up.

By making it a coroutine you could do other stuff as the explosions go off, like replace some materials with dark smoky sooty materials, etc. or break it apart or spawn flying chunks as it gets exploded.

1 Like