PDA

View Full Version : Slide on surface



DarkOne
03-29-2012, 02:55 PM
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.
Thanks,
-DO

tonyo_au
03-29-2012, 10:27 PM
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

DarkOne
03-30-2012, 01:36 PM
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?

tonyo_au
03-30-2012, 06:43 PM
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.

DarkOne
04-06-2012, 01:37 PM
If you can think of any tutorials, or books that might help, I would appreciate it.

tonyo_au
04-07-2012, 07:54 AM
Have a look at http://www.humus.name
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

tonyo_au
04-07-2012, 07:56 AM
Also to useful books are
Mathematics for 3D Game Programming and Computer Graphics by Lengyel

and

Real-Time Rendering by Akenine-Moller