13.07.2008, 07:35
If we cound get the pitch of the player's view, or better, the aiming vector of the player, then it could be possible...
But actually you could check,
if player1 is looking at player2 (+/- 5°) and is at a small distance from player2 and if he is firing a weapon then
OnPlayerGetHit(player2) would be called
...but it won't work really nicely because you can't calculate aiming vector of a player, only x and y axis...mean player1 could look at player2, move his mouse to look in the air, fire, and OnPlayerGetHit(player2) will still be called.
But actually you could check,
if player1 is looking at player2 (+/- 5°) and is at a small distance from player2 and if he is firing a weapon then
OnPlayerGetHit(player2) would be called
...but it won't work really nicely because you can't calculate aiming vector of a player, only x and y axis...mean player1 could look at player2, move his mouse to look in the air, fire, and OnPlayerGetHit(player2) will still be called.