ParticleExampleSun         A particle effect like a sun
Print

This example code can be used for something like a Sun. Save the following as a .particle file:

Particle script:

particle_system Space/Sun
 {
    material        Examples/Flare
    particle_width  20
    particle_height 20
    cull_each       false
    quota           100
    billboard_type  point
 
    // Area emitter
    emitter Ellipsoid
    {
        angle           30
        emission_rate   30
        time_to_live_min 2
        time_to_live_max 5
        direction       0 1 0
        velocity       0.001
        colour 0.15 0.1 0.0
        width           5
        height          5
        depth           5
    }
 
    // Fader
    affector ColourFader
    {
        red -0.010
        green -0.025
        blue -0.025
    }
 }

 

Usage:

Then you can load it within the createScene() method of your application:

mSceneMgr->setSkyBox( true, "Examples/SpaceSkyBox" );
 ParticleSystem* sunParticle = mSceneMgr->createParticleSystem("Sun", "Space/Sun");
 SceneNode* particleNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("Particle");
 particleNode->attachObject(sunParticle);

 
Note: For a better result you have to change the flare.png from the example. Around the flare it should be really black, then you see no edges at the sun!

See also:

 


Contributors to this page: jacmoe111451 points  and Spacegaier3733 points  .
Page last modified on Saturday 02 of January, 2010 07:11:52 GMT by jacmoe111451 points .


The content on this page is licensed under the terms of the Creative Commons Attribution-ShareAlike License.
As an exception, any source code contributed within the content is released into the Public Domain.