Explosions

The Explosion component is a relatively simple component which will apply a force and damage to any nearby Rigidbodies or objects with the Health component attached. When it is spawned it can optionally explode immediately or wait for the Explode method to be called.

Setup

An explosion can be setup by performing the following:

  1. Open the Object Manager and create a new object of type Explosion.
  2. Specify the material used by the Particle System.
  3. Optionally add an AudioSource if the explosion should play an audio clip when it explodes.
  4. Assign the prefab to the object that should cause the explosion. As an example it can be assigned to the Frag Grenade under the Spawned Objects on Destruction foldout:

Inspected Fields

Explode On Enable

Should the object explode when the object is enabled?

Radius

Determines how far out the explosion affects other objects.The magnitude of the force and damage will be scaled based on the distance that the object was hit – the further from the explosion the less force/damage the object will receive.

Damage Amount

The maximum amount of damage to explosion applies to objects with the Health component.

Impact Force

The maximum amount of force the explosion applies to nearby Rigidbody/IForceObject objects.

Impact Layers

The layers that the explosion can affect.

Line Of Sight

Does the explosion require line of sight in order to damage the hit object

Lifespan

The duration of the explosion.

Max Collision Count

The maximum number of objects that the explosions can detect.

Explosion Audio Clip Set

A set of AudioClips that can be played when the explosion occurs. The AudioClip that is played will randomly be selected out of this list.