Screen hit indicator

Started by
3 comments, last by Andreas Persson 15 years, 2 months ago
Hi In many fps when your shoot you get an indicator on screen that tells you where the opponent that shoot you is positioned. How would you go about translating that angle to a position on screen to show the indicator? Thanks
Casual game dev www.apgames.se
Advertisement
Quote:Original post by Andreas Persson
How would you go about translating that angle to a position on screen to show the indicator?


1) Which angle?
2) What kind of indicator do you want? A triangle at the edge of the screen pointing in the appropriate direction? A triangle just at one of the 8 compass points? A dot where the enemy would be in the environment if you could actually see him? A dot on a radar in the HUD? Or just what?
Quote:Original post by Zahlman
Quote:Original post by Andreas Persson
How would you go about translating that angle to a position on screen to show the indicator?


1) Which angle?
2) What kind of indicator do you want? A triangle at the edge of the screen pointing in the appropriate direction? A triangle just at one of the 8 compass points? A dot where the enemy would be in the environment if you could actually see him? A dot on a radar in the HUD? Or just what?


Sorry for not being clear enough. The angle from the players LookAt to the position of the enemy (might not need that).

The type of ndicator I am looking for is: A triangle at the edge of the screen pointing in the appropriate direction.
Casual game dev www.apgames.se
Project the vector-to-attacker onto the player/camera forward vector, take the perpendicular of that, then normalize it. Then transform to camera space and use the result however you want.

If you want a direction indicator from the top-down perspective (i.e. "down" indicates that you were shot from behind) then use the player or world 'up' vector instead of his forward vector.
Thanks I´ll try it out.
Casual game dev www.apgames.se

This topic is closed to new replies.

Advertisement