Function _IrrAddGravityParticleAffector

au3Irr2

au3Irr2 Function Reference

_IrrAddGravityParticleAffector

Adds a gravity affector to a particle system gradually pulling the particles in the direction of the effect.

#Include <au3Irrlicht2.au3>
_IrrAddGravityParticleAffector($h_ParticleSystem, $f_X, $f_Y, $f_Z, $i_TimeForceLost = 1000)

 

Parameters

$h_ParticleSystem Handle of the particle system the created affector is attached to.
$f_X, $f_Y, $f_Z Set the direction and force of gravity in all 3 dimensions.
$i_TimeForceLost [optional] Set the time in milliseconds when the gravity force is totally lost. At that point the particle does not move any more.

 

Return Value

success: Handle of the created affector.
failure: false

 

Remarks

The gravity affector is adding a small amount of velocity to the particles each frame. Although its called a gravity affector it can be used to push the particles in any direction so you can have drifting smoke bubbling fountains, to make a wind effect and have the particles drift off to the side, etc.

 

Related

_IrrAddParticleSystemToScene, _IrrSetParticleAffectorEnable, _IrrRemoveAffectors

 

Example


#include "au3Irrlicht2.au3"

_IrrStart()

; add particle system with default emitter to the irrlicht scene manager
local $particleSystem = _IrrAddParticleSystemToScene($IRR_DEFAULT_EMITTER)
local $ParticleTexture = _IrrGetTexture( "./media/ParticleGrey.bmp" )

; setup this affector to let the particles drift off
_IrrAddGravityParticleAffector( $particleSystem, -0.4, 0, 0.8, 3000)

_IrrSetNodeMaterialTexture( $particleSystem, $ParticleTexture, 0 )
_IrrSetNodeMaterialFlag( $particleSystem, $IRR_EMF_LIGHTING, $IRR_OFF )
_IrrSetNodeMaterialType ( $particleSystem, $IRR_EMT_TRANSPARENT_ADD_COLOR )

local $nodeCamera = _IrrAddCamera( 80,0,0, 0,40,40 )

WHILE _IrrRunning()
    _IrrBeginScene( 0,0,50 )
    _IrrDrawScene()
    _IrrEndScene()
WEND

_IrrStop()