Mouse projection on terrain

Hi guys!

In the last days I tried to fiddle my way into mouse picking and mouse projection onto terrain. This is what I want to achieve:

I have a random terrain, say 128x128 and scaled (10, 1, 10). I placed the camera above so I can see all the terrain. When I move the mouse, I want a round cursor moving over the terrain like in any RPG these days.

I tried to do a MouseRay and a triangle pick, but I can't figure out how to overlay a texture on the current mouse position on the terrain. And I'm not sure if I get the terrain coordinates right. Can anyone give me a simple but complete example for that?

this is all i could think of:


Picking on terrain:

And I posted on the thread sfera mentioned above, it may interest you:

Ah, thanks! I knew there was such a thread, but I wasn't able to find it again. :slight_smile: