Time for action — using the deflector plane

Being able to let particle bounce of some surface can be helpful, so that is what we are going to do here.

  1. Instead of the randomizer, use the DeflectorPlane affector:
    affector DeflectorPlane
    {
    
  2. The plane is defined using a point in space and the normal of the plane:
    plane_point 0 20 0
    plane_normal 0 -1 0
    
  3. The last thing to define is how the plane should affect the particles that hit it. We want them to keep their original velocity, so we select 1.0 as the value:
    bounce 1.0
    }
    
  4. To see the effect of the deflector plane, we need our particles to travel in slightly different directions. So modify the emitter such that the particles' directions differ with a maximal value of 30 degrees. Moreover, as the plane hovers in the sky, our particles should have the up vector as the initial direction.
    emitter Point
    {
    emission_rate 30
    direction 0 1 0
    velocity 20
    time_to_live 4
    angle 30
    }
    
  5. Compile and run the application. The particles bounce off the invisible plane in the sky.
    Time for action — using the deflector plane

What just happened?

We added an invisible plane that hovers in the sky and deflects our particles while keeping their velocity.

Have a go hero — doing more with the thing

Create a new application where a second plane at point (0,0,0) deflects the particles that are deflected by the first plane. Also add the ColorInterpolator affector. The result should look like the following screenshot:

Have a go hero — doing more with the thing
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.33.157