# Use Geometry Nodes Raycast to detect closest surface and place Object there

I'm trying to get a dynamic contact point for a shrinkwrap modifier. The normal projection of the shrinkwrap is not enough in my case, as i need the closest point of another surface. However i'm not having any luck in getting the values from the raycast back that i need.

Here is my current setup: I would want to get the shortest ray, and at its hit point i want to spawn a simple icosphere, or other mesh. In my mind its quite simple to achieve, but i cant get it to work.

• Just a few thoughts: It doesn't work this way because you use the sphere's Geometry for the Set Position and since the Ray Cast node also is connected to it, the Ray Cast node uses the sphere to cast rays from it. The Set Position node will move the vertices of the sphere to the hit position (=shrinkwrap the sphere). You need to do something with the circle's geometry (Group Input > Geometry). Also, you need the closest hit position. Maybe Attribute Statistics helps but this can only get you one value. You need the distance & location... you probably also need a Sample node... Feb 19 at 3:23
• You need 2 Attribute Statistic nodes then it kinda works. I'm just curious what do you need this for? The shortest distance makes the sphere jump over pits and stick it to bumps. Here is a demo: i.stack.imgur.com/J3nVt.gif. It reveals that the sphere sticks half into the ground because the origin is in the center. So I guess you have to move it "back" along the normal of the floor plane to gently touch the floor. Feb 19 at 4:39
• Thank you booth for your Tipps! I'll try it asap :) i need to visualize a theoretical contact point of a tire to the ground. I'll Post my result Feb 19 at 10:56