Slide on surface

I’m attempting to ‘snap’ two parts of geometry together, without actually combining the meshes. I want for the second mesh to be able to slide across the surface of the first mesh, and I am unsure of how to proceed.

Mehes don’t know anything about sliding etc. You control that in your program logic. To give the appearance of one mesh on another you just make the min y value of the mesh on top equal to the max y value of the mesh underneath

Thank you, I know of the method of which you are speaking, I have seen it implemented. For example, a character walking along the ground. However, I don’t quite understand how it would work for moving a model completely around the surface of another. At some point the model would be totally sideways on the other, and at other times upside down.

Do you think that getting the normal information from the parent model, and then inverting its directional value would work?

Certainly the normal for a triangle will give you “up”.

Knowing what triangle to check is the hard part. That is a design problem that you have to solve for yourself because it depends on exactly what you program is doing.

If you can think of any tutorials, or books that might help, I would appreciate it.

Have a look at
Most of his stuff is for DirectX but it might help. Apart for DirectCompute there is a one-to-one for any function between DirectX and OpenGL

Also to useful books are
Mathematics for 3D Game Programming and Computer Graphics by Lengyel


Real-Time Rendering by Akenine-Moller