I recently put a laser effect in my project, and for the most part, the BEAM effect looks just like I imagined. However, I noticed that when I switched to a flying camera mode, the beam would occasionally grow very large and disappear when the camera was at certain angles.
After stripping the problem down to just the particles, I now know that when the source position of the beam (particle.x) leaves the screen, the size of the particles and the apparent beam target position (particle.x + particle.vel_x) begins to change subtly.
As the camera turns away from the source, the target position approaches the camera rapidly until the source position is 90 degrees to the side of the camera, at which point the beam vanishes. I believe this is based on the assumption that if the source is behind the camera, the particle is no longer visible, which is true for regular particles but not for BEAM or STREAK particles.
Screenshots don't really illustrate the problem, so here's the stripped-down
Code:
#include <acknex.h>
#include <default.c>
STRING* Level = "at_world.wmb";
// at_world is just a hollow cube about 100 quants wide
BMAP* BeamBmap = "EG\\laserparta.png";
// any small image with an alpha channel will work
var BeamPart(PARTICLE* p)
{
p.bmap = BeamBmap;
p.size = 2;
p.flags = BEAM | BRIGHT;
p.lifespan = 0.001;
p.event = NULL;
}
var main()
{
video_mode = 7;
video_screen = 1;
level_load(Level);
vec_set(camera.x, vector(-10, 0, 10));
vec_set(camera.pan, vector(0, -45, 0));
while(1)
{
effect(BeamPart, 1, vector(0, -40, 0), vector(0, 80, 0));
wait(1);
}
}
This may also cause a problem in which the beam splits into discrete particles when the camera is directly behind it.
(I also think bmap_to_alpha isn't working correctly, but I don't have enough evidence that this isn't my fault to confidently post that as a bug.)
My version is 7.07.5 Commercial.