kind of a question in reverse but here goes.
I can get my enemy to track and fire at my player using a raycast and Tag combination.
if(Physics.Raycast(shootingRay, out hit, attackDistance))
{
if(hit.collider.tag == "Player")
{
InvaderFireWeapon();
}
}
But… if I have an object between my enemy and the player it still fires as the raycast just goes through the obstruction?
Or to put it another way how do I make it so only a direct hit by the raycast will result in an attack
???