Hello, developers.
Now, I have trouble with detecting enemy.
Most of coders use Raycast when they need something to detect specific thing.
But raycasting is not quite good, I think.
For example,
void ExampleCode()
{
...
RaycastHit hit;
if(Physics.Raycast(player.position, player.forward, out hit, 15))
if(hit.transform.tag == "Enemy")
Debug.Log("It's Enemy!");
...
}
![alt text][1]
In this case, it is perfect what I wanted.
But, what if in this case?
![alt text][2]
Then we should plus the code like `player.back`
But what if enemy is coming from 7'o clock?
So, ultimately, I want to make player detect enemy in specific area like this.
![alt text][3]
Is it possible with Raycast? or other ways? Thanks for reading.
[1]: /storage/temp/21889-1.png
[2]: /storage/temp/21890-2.png
[3]: http://i.imgur.com/wnGMkPY.png
↧