Next: , Previous: , Up: Combat   [Contents][Index]


6.5 Explosion

Component: Explosion

BOOM! This component implements damage and physics effects from explosions. You will also need to add a particle effect to your explosion object, and we recommend adding some lights, animation, sound etc as well. This object can destroy itself immeditately after dealing damage & adding force, or you can destroy it a few moments later using other means (if it has visuals attached, this is recommended).

Important - Must populate

Field of Explosion: LayerMask rayMask

What layers should be checked against a ray at explosion time? Add the layers of the targets as well as occluders.

Explosion Settings

Required Field of Explosion: float radius

How large is the explosion influence (also affects damage!)

Default value: 10.0f

Required Field of Explosion: float power

How much force?

Default value: 25.0f

Optional Field of Explosion: float upwardModifier

How much force upwards?

Default value: 6.0f

Required Field of Explosion: float damage

How much damage should this deal? Works by sending ’ModifyHealth’.

Default value: 175.0f

Field of Explosion: bool autodestruct

Should the explosion object destroy itself automatically?

Default value: false

Field of Explosion: RotationModes rotationMode

Should we randomly re-orient the object on Start?

Default value: RotationModes.None

Field of Explosion: AnimationCurve rolloff

How should the force of the explosion be affected by distance? Values on the left side are closer to the origin of the explosion, values on the right are closer to the edge. Damage is calculated with the formula (damage * rolloff.Evaluate (_distance / radius)). ’Evaluate’ is a built-in Unity function that determines the final value based on ’rolloff’ curve defined here. If no curve is defined, the rolloff wil be defined linearly.

Field of Explosion: bool debug

WARNING! SLOW OPERATION! Send errors to the console and draw lines

Default value: false

Important - Must populate

Field of Explosion: LayerMask rayMask

What layers should be checked against a ray at explosion time? Add the layers of the targets as well as occluders.

Explosion Settings

Required Field of Explosion: float radius

How large is the explosion influence (also affects damage!)

Default value: 10.0f

Required Field of Explosion: float power

How much force?

Default value: 25.0f

Optional Field of Explosion: float upwardModifier

How much force upwards?

Default value: 6.0f

Required Field of Explosion: float damage

How much damage should this deal? Works by sending ’ModifyHealth’.

Default value: 175.0f

Field of Explosion: bool autodestruct

Should the explosion object destroy itself automatically?

Default value: false

Field of Explosion: RotationModes rotationMode

Should we randomly re-orient the object on Start?

Default value: RotationModes.None

Field of Explosion: AnimationCurve rolloff

How should the force of the explosion be affected by distance? Values on the left side are closer to the origin of the explosion, values on the right are closer to the edge. Damage is calculated with the formula (damage * rolloff.Evaluate (_distance / radius)). ’Evaluate’ is a built-in Unity function that determines the final value based on ’rolloff’ curve defined here. If no curve is defined, the rolloff wil be defined linearly.

Field of Explosion: bool debug

WARNING! SLOW OPERATION! Send errors to the console and draw lines

Default value: false


Next: , Previous: , Up: Combat   [Contents][Index]