Particle emitters now have the "direction_position_reference" parameter.
From the manual:
Code: Select all
format: direction_position_reference <x> <y> <z> <enable> example: direction_position_reference 0 -10 0 1 default: direction_position_reference 0 0 0 0
When enabled, the direction of particles is calculated as (positionReference - positionOfParticleAtEmission).
This image ilustrates the case in 2D: This is excellent for simulating explosions (velocity > 0) or implosions (velocity < 0) when the position reference is in the center. Without this enhancements, one could do this with point emitters setting angle to 180; however when using other types of emitters (Ellipsoid, box, ring, etc) this was a seemingly impossible task because the direction was completely random at angle 180, rather than being consistent to a single point of origin, or "source".
When the position ref. is below the emitters, it can be used to simulate dust stomps in the ground. I've made one in my own game that looks amazing (can't share the picture yet, sorry guys; demo was submitted to Intel Level Up contest).
When position ref. is on the side of the emitters, it can be used for simulating wind coming from a fan.
I hope you enjoy it.
PS: I thoroughly tested this enhancement as I wrote it a month ago, but just submitted right now.
Your PU system will probably need a few small changes in order to compile again. Changes are really small so it shouldn't be much of a problem. Basically "genEmissionDirection" now requires a second additional parameter, containing the particle's position.