reverse camera project

Blitz3D Forums/Blitz3D Programming/reverse camera project

Leon Drake(Posted 2008) [#1]
has anyone created any code that can return the nearest x y z coordinate of a 2d x y viewport coordinate?


ringwraith(Posted 2008) [#2]
Correct me if I'm wrong, but I believe what you're looking for is the CameraPick function which you can find out more about in the Blitz manual.


Leon Drake(Posted 2008) [#3]
no because that requires you to pick an entity in order to get the x y z coordinates. but thanks anyways.

i found a nifty one in the code archives for orthogonic view which is what i was looking for.


Dreamora(Posted 2008) [#4]
orthogonal will just be wrong if you don't use that camera


Vorderman(Posted 2008) [#5]
no because that requires you to pick an entity in order to get the x y z coordinates


But if you don't pick to an entity, how can you possibly determine the Z component of the position?

If you don't want to make all your entities pickable, how about pick against using your skybox or ground plane instead? You could even place a vertical sprite in front of the camera, set the order to render behind anything else, then pick against that. Should be quick enough as you can use a really short pick range.


Ross C(Posted 2008) [#6]
Why not build up a list of onscreen entities. Grab all there 2d co-ords onscreen and compare against the mousex and y co-ords?

Or... colour the backround black. Have each entity have it's own colour. Grab the colour of the pixel on the screen at the mouse X and Y co-ords. And look it up against the entity colours? You'll need to keep track of your entities via types or array, which is always handy to do anyway :o)


Damien Sturdy(Posted 2008) [#7]
Uh, only way i can think of to easily do it in Blitz3D: have an invisible yete pickable quad in front of the camera and camerapick it. Z will always be whatever you want it to be, just set the plane at Z in front of the camera and align it to the camera.


Ross C(Posted 2008) [#8]
I think he's wanting to click somewhere on the screen, at the mouse's co-ords and get the nearest entity's xyz co-ords.


Leon Drake(Posted 2008) [#9]
the one i got works perfectly. i have 3 views which use ortho, top left and front. i only need two axises for each view. the one i got in the code archives works beautifully.


Leon Drake(Posted 2008) [#10]
basically i needed it so i can draw 3d geometry like ms paint LOL, best part is it works like paint with 3 views