Original Post
Can someone tell me if theres anything wrong with this function? I'm getting weird results in game. Whenever I call it multiple times each frames, the first value is OK, but every one afterward is screwed up...
void CBaseWeapon::SpreadProjectile( Vertex3f *v, scalar spread )
{
Vertex3f vOut;
vOut = v;
scalar c,s;
scalar pitch = randomf() * spread;
scalar roll = randomf() * 360;
SinCos( DEG2RAD(pitch), &s, &c );
Vertex3f vTemp = vOut;
vOut.x = vTemp.x*c + vTemp.z*-s;
// vOut.y = vTemp.y;
vOut.z = vTemp.x*s + vTemp.z*c;
SinCos( DEG2RAD(roll), &s, &c );
vTemp = vOut;
vOut.x = vTemp.x*c + vTemp.y*s;
vOut.y = vTemp.x*-s + vTemp.y*c;
// vOut.z = vTemp.z;
*v = vOut;
}