Hello all i was wondering how do i make it that a enemy has some sort of line looking towards the player and if the line gets blocked by a colider it will, //do somthing
thanks in adcanced
josif
Hello all i was wondering how do i make it that a enemy has some sort of line looking towards the player and if the line gets blocked by a colider it will, //do somthing
thanks in adcanced
josif
You can use Physics.Linecast(enemy, target, hit) and check if the item hit is the target (code in the enemy script):
var target: Transform; // the player transform ... var hit: RaycastHit; Physics.Linecast(transform.position, target.position, hit); if (hit.transform != target){ // something is in between } ...