Drag and drop mesh over uneven ground

When dragging a mesh, it starts to cross the uneven surface. How to make the mesh not cross the surface, but slide smoothly over it?
I tried collisions but it didn’t work
Thanks

You could try to raycast on the uneven ground to compute the height ?

1 Like

Yes, I solved the problem with the help of rays. I direct the rays from the center of the mesh in all directions and check the distance of the intersection with the ground. If the distance is less than the mesh size, then I add movement only to the height (diff x and diff z = 0)
Thanks for the tip!

2 Likes