# Using multiple face islands with differing rot/pos as the "Target Geometry," how can the Raycast node's "Is Hit" boolean be used to separate geometry?

I'm attempting to remove the points which are in front of instanced planes of various sizes:

That way, the remaining points can be used for instances that won't overlap:

The task is almost solved with this setup:

However, I don't think I'm using the raycast node properly. I tried intuitively scaling the target geometry by 0.001 along the faces' normals, but that netted an incorrect selection. Just by happenstance, I tried the position, and that got close (the result pictured above), but if I reverse the selection for clarity it is easy to see that this setup isn't correct either as it includes points not in front of faces in the selection:

I've tried the following prior advice to no avail:

Raycast on Geometry generated by Geo Nodes?

Geo Nodes - Raycast from individual Mesh islands

Blender Geometry Nodes - Create individual XYZ curve/mesh lines per edge-defined cubic area

I hope this question is unique enough to be worth posting, but I'll let those with more insight than myself decide. Either way, an answer or even a hint in the right direction would be much appreciated.

## Explanation

The reason why it wasn't working for you is because you are actually raycasting from the points to the faces. This is how the raycast node works. therefore, the source position, ray direction, and ray length are sampled from the points geometry, which don't have a normal.

In your case there is an easy fix. All you have to do is capture (or store) the face normal in the beginning of your tree (alternatively, you could transfer it).

and use that data to offset the source position and set the ray direction.

(over here i inset the points and keep the ray direction going outward because it's less nodes)

You get a result like this.

If you want the file, let me know.

• I think I understand- by using the prior base geometry for the ray direction data, ALL points are able to cast a ray that can then be detected as hit or missed, while with my setup using just the planes for the ray direction, not all points were able to cast rays and be assesed as hit/miss. Thank you very much for the explanation and helping my understanding. Commented May 29, 2023 at 14:33
• @bobhasajetpack basicly when you used the normal as the direction, you actually were using vector[0,0,0] as the direction - because the attribute didn't exist . - and with the position the direction was the position, which is just facing away from the origin. Commented May 29, 2023 at 20:47

Don't use raycasting, just check the distance to the nearest face:

• Thank you very much for showing what, in this use case, is definitely the most efficient solution. Commented May 29, 2023 at 14:40
• @bobhasajetpack Just a stupid question: Why don't you mark this answer as "Accepted Answer" if it solves the question better? It's not about who answered first, but which answer solves the task best/efficiently. ...just as a hint. (But you are right: Regarding the title of your question, the other answer is more correct) Commented May 29, 2023 at 15:11
• @quellenform The only reason I marked the other as correct was in the hopes that, as you mentioned, anyone searching for a similar raycast problem (where Markus von Broady's answer might not be as ideal) will have the raycast-focused answer right away. If this isn't very likely in your opinion, I can change the "accepted answer." Commented May 29, 2023 at 15:34
• @bobhasajetpack All right, thanks for the clarification! Commented May 29, 2023 at 15:41