Select point on terrain using mouse

Blitz3D Forums/Blitz3D Beginners Area/Select point on terrain using mouse

Jim75(Posted 2007) [#1]
I can see how I can select an entity already placed using CameraPick()

What I want to know is how do I use MouseX/Y and then translate the viewport coordinates to terrain coordinates so I can select a place on the terrain.

I want to do a similar thing to populous where you can click the landscape to create a hill. I also want to be able to move the camera around.

I had a look at the code archive and found some code that purported to do what I wanted but only seemed to work when the camera was looking directly down on the scene which isn't what I want.

I know you can use a cameraproject to get from 3d to 2d there must be a way to do the reverse?

Any help would be greatly appreciated. Thankyou!


Uncle(Posted 2007) [#2]
PickedX, PickedY and PickedZ should help you. Have a look at the help supplied with Blitz as it has a good example of how to use this.

Also here is a link that might help you...

http://www.blitzbasic.com/Community/posts.php?topic=49109#546423


Jim75(Posted 2007) [#3]
Thankyou, the example you linked to was nice and simple.

I had tried that but had forgotten to make my terrain pickable. Now it works.

Hooray!