Setting a model's shader time
Posted: Thu Dec 15, 2011 1:18 pm
I've been fiddling around with trying to apply a specific shader (with an
"alphagen wave sin" stage) to dead bodies so that the bodies disappear (fade out) instead of sinking into the floor (or, as is the case with my mod where they suddenly disappear, which is even worse).
I've added this bit of code to player_die() in g_combat.c:
Where when someone dies, a timestamp is saved and transmitted to the client. On the client, in the CG_Players() function (in the file of the same name). I do this:
(note: the same is done for torso and head as well)
I assumed that legs.shaderTime would properly set the starting point of the shader animation (the fade out) but it doesn't. It appears that this isn't the case, as the starting point of my alphagen sine differs every time I shoot an enemy (sometimes even inverted to how I want it, causing the body to suddenly disappear and fade into view). I've checked and cent->currentState.time does match the server-side level.time.
Does anyone know if I'm doing something wrong or if the shaderTime is bugged or something? I would love to be able to reliably set the starting point in the wave of my shader.
"alphagen wave sin" stage) to dead bodies so that the bodies disappear (fade out) instead of sinking into the floor (or, as is the case with my mod where they suddenly disappear, which is even worse).
I've added this bit of code to player_die() in g_combat.c:
Code: Select all
self->s.time = level.time;
Code: Select all
if ( cent->currentState.eFlags & EF_DEAD ) {
legs.customShader = cgs.media.deadBotShader;
legs.shaderTime = cent->currentState.time;
}
I assumed that legs.shaderTime would properly set the starting point of the shader animation (the fade out) but it doesn't. It appears that this isn't the case, as the starting point of my alphagen sine differs every time I shoot an enemy (sometimes even inverted to how I want it, causing the body to suddenly disappear and fade into view). I've checked and cent->currentState.time does match the server-side level.time.
Does anyone know if I'm doing something wrong or if the shaderTime is bugged or something? I would love to be able to reliably set the starting point in the wave of my shader.