Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

How to check where I'm being shot from.

$
0
0
Hey there, So I'm working on an FPS multiplayer game. When a player shoots another player, I am able to tell the player that was shot what gameObject shot them. So that's already working. What I would like to have happen is when he is shot, an indicator shows up on the camera showing what direction he was shot from. Basically it would pop up in the direction I should turn my camera to see him. So what I was thinking is some how getting my forward direction, the other player's x and z position, and then some how getting an angle based on that info. So if he was directly behind me it'd read out 180, if he's to my right it'd be 45, to my left 270, and directly in front 0 or 360. How would I go about doing something like that? I've tried using Vector3.Angle on my forward direction and their position. There are two problems with that. First, the further the player is from me, the higher the number gets, second it's taking the y axis in to account which it just simply doesn't need to do. Thanks. EDIT: A bit more clarification. I want this to be a 2D object that floats around the camera much like what happens in this video: https://www.youtube.com/watch?v=0oDOf1gniso&list=UUhMjr9l80eeX4lLNU6Lry3A#t=172

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>