# Geometry Nodes: rotate instances which intersect with reference object (points and meshes)

The past months I received valuable feedback, coaching and knowhow on my first Geometry Nodes question on this forum (How to align object on normal vector between vertex and line)

The past weeks I have been editing one of the shared files. In this shared file, the GN tree places almost every instance with desired rotation. Unfortunately some instances are placed on points that intersect with the road. In my usecase the instances are streetlights that need to be directed to the road. The points are simple 2D geometry which are being used as reference in the Input Socket Points of the Instance on Points node. The road is delivered as a collection node and contains meshes. My questions are as following:

• Is it possible to rotate instances that intersect with the reference object (polygons of the road)? In this case, I would like to rotate the instances with 180 degrees.
• How can this transformation be applied to only the instances that are placed on the road? It is important that the correct placed instances stay in the same place.

After some research I discovered the Mesh Boolean node.I thought I could use this node to retrieve the intersection between the extrude mesh in the z-axis and the instances. From there on I would like to collect the objects that intersect and give them a rotation of 180 degrees.

In particular, I want to thank @quellenform for the in depth answers and the shared file. The file can be downloaded by the following link; https://we.tl/t-lo3Pvuy8PO

• If I were you, I would not use a Mesh Boolean in your case. Firstly, you wouldn't be able to do much with the information you get with it, and it's slow. It's best to use Raycast and add a little to the starting point on the Z-axis so that the starting points raycast onto the mesh from above. Commented Dec 1, 2023 at 22:16
• @quellenform Thanks for the feedback! With this advice it was a matter of logical thinking and adding two nodes to the GN tree. I solved the question by using the Geometry of the road as a Target Geometry Input Socket. The Is Hit Output Socket from the Raycast node is being used by the Rotate Instances node. For reference see the following link; imgur.com/a/JSyh914 Commented Dec 2, 2023 at 15:12
• Very nice! You could write that as an answer and accept it. ...and the other/linked question can also be marked as solved? (just to keep this Q&A platform tidy) Commented Dec 2, 2023 at 15:41