Skip to content

format

typescript
Rigidbody.AddExplosionForce(explosionForce, explosionPosition, explosionRadius, upwardsModifier, mode)

class: Rigidbody

description

Applies a force to rigidbodies to simulate an explosion effect.

This method is commonly used to simulate explosion effects, such as throwing grenades or using explosive objects in a game. When an explosion occurs, you can call this method to apply an explosion force to surrounding rigidbodies, creating a realistic impact effect.

parameter

param_nametypedescription
explosionForcenumberThe force of the explosion.
explosionPositionVector3The center of the sphere in world coordinates where the explosion affects.
explosionRadiusnumberThe radius of the sphere in which the explosion affects.
upwardsModifiernumberAdjusts the apparent position of the explosion.
modeForceModeThe method used to apply the force to its targets.

reture

typedescription
void

code example