Mouse Position

I am visualizing a 3D terrain by GeoMipTerrain and setHeightfield.
I want to obtain coordinate (x,y,z) as per movement of my mouse.
Is it possible to move mouse on terrain and get all three coordinates dynamically as per mouse position?
If yes, then please suggest me how it should be done.

Bullet has a BulletHeightfieldShape if you make one of these using the same height map you should be able to do a mouse/terrain ray test. The manual has some info on creating a BulletHeightfieldShape and doing ray test in the “Using Bullet with Panda3D” chapter.

Another option is to render the terrain to a small (1x1 pixel) offscreen buffer using a shader that renders the world space position of the terrain as color and then reading the value back (or writing the UV as color and getting the height from the heightmap). There was some sample code for doing this here on the fora, but I can’t find it now :blush:

Perhaps the code snippet I just posted can be of help :slight_smile: .