Flint Particle System Forum - perlinNoise() for moving the particles in a force's field Wed, 17 Nov 2010 10:18:29 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher perlinNoise() for moving the particles in a force's field http://flintparticles.org/forum/comments.php?DiscussionID=28&Focus=132#Comment_132 http://flintparticles.org/forum/comments.php?DiscussionID=28&Focus=132#Comment_132 Wed, 14 May 2008 12:21:58 +0100 raffou My problem is : how integrate a perlinNoise (say , in a bitmapdata) for creating a force's field (i'm not sure it's the right word in english) controlling the velocity and acceleration of particles created in Flint ]]> perlinNoise() for moving the particles in a force's field http://flintparticles.org/forum/comments.php?DiscussionID=28&Focus=138#Comment_138 http://flintparticles.org/forum/comments.php?DiscussionID=28&Focus=138#Comment_138 Mon, 19 May 2008 15:14:02 +0100 Richard
It depends if you want to use the perlin noise to set the initial velocity and acceleration or to modify the velocity and acceleration as the particle moves.

To set the initial velocity and acceleration you need one or two custom initializers. An initializer extends the Initializer class and implements a custom initialize() method. This method is called when each particle as it's created. It receives a reference to the particle and the emitter. Use the method to set the appropriate properties on the particle (in your case, the velocity and/or acceleration).

To alter the velocity and acceleration of the particle as it moves you need one or two custom actions. An action extends the Action class and implements a custom update method. This method is called every frame for every particle (so make it as efficient as you can). It receives a reference to the particle and the emitter and the duration (in seconds) of the frame. Use the method to alter the properties of the particle (again, in your case, the velocity and/or acceleration).

Take a look at the source code for the actions and initializers in the library for hints. ]]>