Evening all,
Im trying to give some level of awareness to the npc in my scene, in this case detecting where the nearest water is from its current position on the terrain. The water is a single plane stretched across the whole scene at a height of 0.
Now i believe a Physics.SphereCastAll down from above the npcs position would be a real nice solution if there were only a way of blocking the cast going through the terrain, as currently i can only ever retrieve the hit.point of the Water directly below the npc, which is obviously not cool or reachable.
-
So i suppose the question is, is there any way to block a SphereCast from passing through a collider?
-
Failing that, is there any other (or better) method to achieving my goal?
The only other method im familiar with is iterating through a stream of Terrain.SampleHeight or Physics.Raycast until Y=0, but that seems very costly for what should be just a quick scan
Any advice welcome.