# Use Geometry Nodes to mirror the angle of incidence of a geometry towards a surface?

I'm trying to replicate the behavior of a light source being shot to a mirror using Geometry Nodes, so the angle of incidence and the angle o reflection are the same.

In my setup, I set the endpoint Position of a line to the surface of a target, and then extruded that endpoint. However, I couldn’t figure how to match the angles properly. I was only able to extrude by the Normals of the target’s surface, or completely wrong angles. ## This is what I’m trying to accomplish. • I apologize beforehand that I cannot provide a good answer, I only want to give a hint in a (possibly) right direction. In the Vector Math node you have the mode Reflect. As far as I know this calculates the reflection vector of two vectors (the ray vector and the surface normal?). However, and that's why I cannot write an answer, I don't seem to get it to work correctly. Maybe you can find out how to use Reflect. Apr 28 at 7:03
• Gordon's done the job.. so not posting this as an answer, but here's another version that modifies a 'Ray Gun' object and uses Ray Cast to a given target . Apr 28 at 10:09
• Thanks, Robin Betts, for this alternative. This is version using Ray Cast is a very interesting approach. Apr 29 at 1:12

I've recreated your nodetree to get a similar setup like you have. The reflection is calculated in the frame titled "REFLECTION ON SURFACE".

It is basically doing two things: First evaluating the normal of the target surface which you already had in your nodetree. Next using the Vector Math node set to Reflect to calculate the vector of reflection between the position on the surface and the surface normal, then using this as offset for the Extrude Mesh node instead of the normal in your setup. Note: Usually I would get the vector of the incoming mesh line by subtracting the position from (0, 0, 0) and then plugging it into the Reflect node. This would result in a vector that needs to be scaled by -1 to get the correct result.

To save some nodes, the scaling wouldn't be necessary if instead of subtracting the position from (0, 0, 0), you could switch those inputs and subtract (0, 0, 0) from the position which is simply the position itself. In this case with the lines' Start Location at (0, 0, 0) it works to get rid of a Subtract and a Scale node.

The "full" setup would look like this: And this is the result viewed from the side and the top. I've reduced the number of lines to 3 and the Offset Scale on the Extrude Mesh node to 0.5 so that it becomes more cleearly visible which the reflected lines are. • Thank you. The solution was a lot simpler than I thought it would be needed. I didn't even know that you could extract that information from the position socket of the Geometry Proximity node. Apr 29 at 1:12