BEAM
The particle is "smeared" along
a line given by its velocity vector and starting at its position.
Normally used for continuous rays or trails.
In combination
with the BRIGHT flag, lines of light can be created this way for laser,
tracer bullet, vapor or light trail effects.
STREAK
Like BEAM, but stretches the particle along its velocity vector, instead
of smearing it.
This
gives the effect a motion blur like appearance.
Type:
flag, particles only
Edition:
C
Remarks:
-
When one of these flags are set, instancing can not be used for accelerating particle rendering.
- A8.4 Through particle_mode a 2D or 3D mode can be selected for BEAM and STREAK. In 2D mode, beams are generated by drawing many particles over each other, resulting in a slightly different looking (and slower) effect. 2D mode is not supported in isometric views.
-
For vapor trails, use the BEAM flag and set the velocity vector to the difference of the current emitter position
to its position in the last frame.
Example (lite-C):

function p_alphafade(PARTICLE *p)
{
p.alpha -= p.skill_a*time_step;
if (p.alpha <= 0) p.lifespan = 0;
}
function p_trace(PARTICLE *p)
{
set(p, BRIGHT|TRANSLUCENT|BEAM);
p.size = 2;
p.skill_a = 1; // fade factor
p.event = p_alphafade;
}
// entity that runs in circles and leaves a vapor trail
action tracer()
{
var dist = 0,radius = 10,sign = 1;
VECTOR last_pos;
while(1)
{
vec_set(last_pos,my.x);
dist += 30*time_step;
radius += sign*random(3)*time_step; // change radius randomly
if (radius > 150) sign = -1;
else if (radius < 30) sign = 1;
my.x = radius*sin(dist);
my.y = radius*cos(dist);
effect(p_trace,1,my.x,vec_sub(last_pos,my.x));
wait(1);
}
}
function main()
{
vec_set(sky_color,vector(50,1,1)); // dark blue
level_load(NULL);
video_window(NULL,NULL,0,"Vapor trail demo");
vec_set(camera.x,vector(-250,0,50));
vec_set(camera.pan,vector(0,-15,0));
ent_create(NULL,vector(0,0,0),tracer);
}
See also:
effect, lifespan, velocity, gravity, size, alpha, blue, bmap,
BRIGHT, TRANSLUCENT, MOVE,
skill
► latest
version online