PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

BlastPressure

Explosion

float

Used to determine the amount of force applied to BaseParts caught in the Explosion/BlastRadius.

Currently this level of force applied does not vary based on distance from Explosion/Position. Unanchored BaseParts will accelerate equally away from the origin regardless of distance provided they are within the blast radius.

The blast pressure determines the acceleration of parts due to an explosion. It does not determine the degree to which joints are broken. When Explosion/DestroyJointRadiusPercent is equal to 1 all joints between parts in the Explosion/BlastRadius will be destroyed provided BlastPressure is greater than 0.

The BlastPressure also does not determine the amount of damage given to Terrain. Provided BlastPressure is greater than 0 and Explosion/ExplosionType isn’t set to Enum.ExplosionType.NoCraters the size of the crater created is determined exclusively by the Explosion/BlastRadius.

Setting BlastPressure to 0 eliminates the effect of the explosion and is useful when developers want to program their own custom behavior for explosions using the Explosion/Hit event.


Code Samples


Custom Explosion

This sample contains a simple function that creates a custom explosion. The custom explosion will not break joints as Explosion.DestroyJointRadiusPercent is equal to 0. This means Humanoids will not be instantly killed as their neck joints are broken. In this example explosion.BlastPressure is equal to zero so as not to apply force or damage terrain but this can be changed.

The Explosion.Hit event is used to listen for contact. Once contact has been made the code will look for the parent model of the BasePart hit by the explosion. If that model exists, hasn’t already been damaged and has a Humanoid in it damage will be applied based on distance from the explosion’s origin.