Open main menu

CDOT Wiki β

Changes

DPS905 Kaitlyn ParticleEffects

2,688 bytes added, 19:28, 11 April 2011
no edit summary
'''scene->draw(PARTICLES);'''
hud->draw(HUD_ALPHA);
 
 
 
 
== [B] - HOW TO USE ==
 
To create a particle:
 
1) Include in ParticleGenerator.h
2) Use the following suggested code:
 
//VARIABLES
float generatorlifespan = 0.0f; // how long for the generator to run for (0.0f is forever) in seconds
float particlelifespan = 3.0f; // how long particles live for
float particlespawnrate = 180.0f; // how many particles can spawn, per second, up to the MAX_PARTICLES limit
float spawndispersion = 6.0f; // how varied are the spawn positions (0.0f means spawn on the same exact positon initially)
float theta = 80.0f; // how varied is the initial velocities, 180.0f is a full sphere, 90.0f is a hemisphere, 40.0f is a cone, etc
float startingspeed = 110.0f; // initial speed applied to the velocities
Colour startcolour = Colour(2.0f,0.0f,0.0f);
Colour endcolour = Colour(0.0f,0.0f,1.0f);
float frequencycolour = 0.0f;
float startsize = 5.0f;
float endsize = 0.0f;
float frequencysize = 0.0f;
Vector startgravity = Vector(0.0f, -29.8f, 0.0f);
Vector endgravity = Vector(0.0f, -199.8f, 0.0f);
float frequencygravityvertical = 0.0f;
float frequencygravityhorizontal = 0.0f;
float startalpha = 1.0f;
float endalpha = 0.0f;
float frequencyalpha = 0.0f;
Colour c = Colour(1.0f,0.0f,0.0f); //for object (material type)... not actually used
float p = 0.5f; //for object (reflectivity)... not actually used
 
 
iParticleGenerator* particleEffect1 = CreateParticleGenerator(generatorlifespan, particlelifespan, particlespawnrate, spawndispersion, theta, startingspeed, startcolour, endcolour, frequencycolour, startsize, endsize, frequencysize, startgravity, endgravity, frequencygravityvertical, frequencygravityhorizontal, startalpha, endalpha, frequencyalpha, &c, &p);
 
//Add your desired texture on
iTexture* particle_texture = CreateTexture(L"bubble.tga");
particleEffect1->attach(particle_texture,0);
 
//Position your particle
particleEffect1->translate(250,70,250);
 
//Optionally particles may be set to attract to other objects or positions in the world
//((ParticleGenerator*)particleEffect1)->AttractTo(someObject,250.0f);
//((ParticleGenerator*)particleEffect1)->AttractTo(&Vector(50,50,50),250.0f);
7
edits