Raycast object finding and preference [Solved]

How do I…

How do I make a ray only give preference the first object it hits, and only hide the objects when they are covered by another object

What is the expected result

I want a “npc” look for the targets available and visible, giving preference the ones that are the nearest

Reference image


1 Like

Hi, for your second image, that’s exactly what a raycast does. Here is the description in the engine:

For your first image you would need several raycasts obviously and you could compare the distances between the ray generator and the objects that intersect the ray. Another option is to use “Pick nearest object”.

1 Like