inexorgame-obsolete / deprecated-cube-engine-inexor

UNMAINTAINED: Please have a look at the vulkan-renderer
https://inexor.org
zlib License
12 stars 1 forks source link

Straveshots #140

Open Croydon opened 9 years ago

Croydon commented 9 years ago

Original requested by @koppiman in https://github.com/inexor-game/data/issues/10:

It would be nice to hear shots that strave near of you, as I heard it in Fanatic Client. Sometimes you dont see when someone shoots at you from behind, but if you hear it.........

chasester commented 8 years ago

Thats super easy do a reject on the ray vector.

float buffer = 5; 
//buffer should be how close you want the bullet to be to have to be before it plays a sound 
//aka chinmusic.
if( hit a player)
{
}

else if(! player->o.reject(bullet->start, player->width + buffer)) 
//reject will basically check to see if the object is heading in the direction of a player
{
       //play sound
}

http://math.stackexchange.com/questions/823308/how-is-rejection-defined-question-from-linear-and-geometric-algebra

that will work as kinda a hack, you could make it better by doing and intersect from the players -x x -y -y and see where the conection point is, then see how close that is. This would be much faster though :+1: