Hey guys,

I was working on changing the old "sword trail" code into something we could all use a bit easier, and for more than one intended purpose. I notice a really weird bug which makes the trail only viewable from selective angles. For example, if you were to move around the map while looking at the trail effect it will appear and disappear depending on how close/far you are from the center of the map. I am pretty sure its a pointer issue but I wanted someone to take a look to see if they have any solutions. Here is the code I am using, I am trying to keep the entire function as self contained as possible for future adaptation.

Click to reveal..

action trail()
{
ENTITY* afterimage = me;
set(afterimage,PASSABLE|BRIGHT|TRANSLUCENT);
afterimage.alpha=100;
ENTITY* cloner = ent_clone(afterimage);
vec_sub(afterimage.x,cloner.x);
while(afterimage.alpha>0)
{
afterimage.alpha-=time_frame*5;
wait(1);
}
ent_remove(afterimage);
}

void trail_ribbon(var vert1, var vert2, ENTITY* ent)
{
ent = me;
VECTOR trailpos1;
VECTOR trailpos2;
VECTOR trailpos3;
VECTOR trailpos4;
VECTOR oldpos;
ENTITY* trail1;
var sspeed = 0;
while(ent.active)
{
sspeed++;
if(sspeed%2==0)
{
trail1 = ent_create("trail1mdl.mdl",ent.x,trail);
vec_for_vertex(trailpos2,ent,vert1);
vec_for_vertex(trailpos1,ent,vert2);
vec_to_mesh(trailpos1,trail1,1);
vec_to_mesh(trailpos2,trail1,2);
vec_to_mesh(trailpos3,trail1,3);
vec_to_mesh(trailpos4,trail1,4);
vec_set(trailpos3,trailpos1);
vec_set(trailpos4,trailpos2);
vec_set(oldpos.x,ent.x);
wait(1);
trail1=NULL;
}
}
}


If anyone has any ideas let me know. If you want to know how I am implementing it, I am using multiple test environments with one being the most recent multiplayer tutorial from the AUM (for replication purposes).