How to pick terrain?

I started from hello terrain and tryed to use Ray-terrain collision, but it gave non-usefull results.

For object positioning on terrain, I can use height from heightmap, but it does not help with determining where user clicked.

Is there any working way?

Try “Hello Mouse Picking”.

It uses Something-Ray collison, and terrain-Ray collision does not seem to work.

Look at TerrainTestCollision, it uses ray picking for terrain.


It works there, so I’ll compare and try to find out what I did wrong.

I found it, I was using straight down direction, and for some unknown reason, terrain picking does not work for straight down picking.


BresenhamTerrainPicker, line 97


if (tracer.isRayPerpendicularToGrid()) {

// no intersection

return null;



Why it is made so?