I faced some troubles about Physics.OverlapSphere(). I want my Physics.OverlapSphere() only detect the gameobject in the particular layer mask, if not it will detect everything including those gameobject that don’t have rigidbody or collider.
I know can use layermask to fix this, but why it didn’t detect the object I want??
here is the code…
neighbourObject = Physics.OverlapSphere(transform.position, sightRadius, 5);
ps: currently learning flocking, want to detect the neighbour around the boid, but failed…
please help and thank you.