Making a projectile pass through glass yet leaving a mark
Posted: Tue Jun 10, 2014 4:52 pm
The goal is to get a projectile to pass through a nonsolid glass material on a plane or brush, yet leave a mark on it. A couple months ago I dabbled with getting a projectile to pass through a wall and leave a mark, and it was never totally successful. I figured I'd try this again but with only glass, that it should be easier somehow, yet it isn't. Right under where the game does the trace in g_runrocket or whatever, I added:
if ( tr.surfaceFlags & SURF_METAL ) {
G_AddEvent( ent, EV_MISSILE_MISS_GLASS, DirToByte( tr.plane.normal ) );
G_Printf( "work dammmit \n");
}
this is right above the part:
if ( tr.startsolid || tr.allsolid ) {
The idea is if the surface the trace touched is metal (yes surf_metal for now because of problems with adding new surfs), then add the event mostly for the CG effects to occur. In game this does nothing on either a brush or a plane with the glass texture. So back to the question: how would you get the game to detect the type of surface the projectile touched, and how would you tell it to place a mark on that surface while allowing the projectile to continue through it?
if ( tr.surfaceFlags & SURF_METAL ) {
G_AddEvent( ent, EV_MISSILE_MISS_GLASS, DirToByte( tr.plane.normal ) );
G_Printf( "work dammmit \n");
}
this is right above the part:
if ( tr.startsolid || tr.allsolid ) {
The idea is if the surface the trace touched is metal (yes surf_metal for now because of problems with adding new surfs), then add the event mostly for the CG effects to occur. In game this does nothing on either a brush or a plane with the glass texture. So back to the question: how would you get the game to detect the type of surface the projectile touched, and how would you tell it to place a mark on that surface while allowing the projectile to continue through it?