(NativeObjectWorldArchitecture) NOWA-Engine

Chapter: PhyicsExplosionComponent

This component is used to simulate an explosion within a given range, so that affected physics active game objects will be thrown away. It can be appended e.g. below a physics active or artifact component. Appending under a physics active one, may simulate e.g. that an enemy or the player throws an dynamite. The component comes with the following properties:

  • ExplosionAffectedCategories: The affected categories, that will be handled when in range of an explosion. Its possible to exclude certain categories. A [+] prefix following by the category name adds those category to the type mask and a [-] substracts it from a specifed category name. The category name ‘ALL’ has a special meaning. It enables all categories. Example:
    • generateCategoryId(“+All-House-Floor”) generates an id, with which all objects but houses and floors are for example affected.
    • generateCategoryId(“+Player+Enemy”) whould mark Players and Enemies to be selected
  • Activate [true|false]: True means game object will detonate automatically controlled by the explosition timer. False means the explosion has not been activated yet.
  • CountDown[0|+]: The explosition count down in seconds at which the game object will detonate.
  • Radius [0|+]: The radius in meters, which detemines the other game objects that are in range, which get an impulse applied by the given strength.
  • Strength [0|+]: The maximum explosion strength in newton meters. Note, the more a game object away from the detonation, the weaker the detonation for the game object.
  • ExplosionCallbackScriptFile: Optional lua script file name to execute when the explosion occured. In this callback a list with the affected game object will be delivered.

Example lua script file to play a sound each second and when the detonation occurs play an explosion particle effect and explosion sound:

function onTimerSecondTick(originGameObject)
 soundComponent = originGameObject:getSimpleSoundComponent();
 soundComponent:setActivated('Timer', true);

function onExplode(originGameObject)
 soundComponent = originGameObject:getSimpleSoundComponent();
 soundComponent:setActivated('Explosion', true);
 particleComponent = originGameObject:getParticleUniverseComponent();
 particleComponent:setActivated(particleComponent:getFirstParticleName(), true);

function onExplodeAffectedGameObject(originGameObject, affectedGameObject, distanceToBomb, detonationStrength)