Hey Guys and Girls,
I am using this line of code
hits = Physics.SphereCastAll(transform.position,transform.localScale.x / 3,playerTransform.position - transform.position, Vector3.Distance(playerTransform.position, transform.position));
to help me enemies spot me!
It works fine and all, but it does mean they can see me from literally hundreds of miles away. I tried writing the code like this,
hits = Physics.SphereCastAll(transform.position,transform.localScale.x / 3,playerTransform.position - transform.position, 10000f);
but then they don't seem to see me at all, I have to get right in there face for it to work!
Can anyone suggest what I am doing wrong.
Thanks in advance!
↧