Skip to main content

Rigidbody.AddExplosionForce(number explosionForce, Vector3 explosionPosition, number explosionRadius, number upwardsModifier = 0, ForceMode mode = ForceMode.Force)

Applies a force to a rigidbody that simulates explosion effects.

Parameters:

NameTypeDescription
explosionForcenumberThe force of the explosion (which may be modified by distance).
explosionPositionVector3The centre of the sphere within which the explosion has its effect.
explosionRadiusnumberThe radius of the sphere within which the explosion has its effect.
upwardsModifiernumberAdjustment to the apparent position of the explosion to make it seem to lift objects.
modeForceModeThe method used to apply the force to its targets.

Usage

---@type Rigidbody
local rigidbody;

---@type number
local explosionForce;

---@type Vector3
local explosionPosition;

---@type number
local explosionRadius;

---@type number
local upwardsModifier;

---@type ForceMode
local mode;


rigidbody.AddExplosionForce(explosionForce, explosionPosition, explosionRadius, upwardsModifier, mode)