getting world coordinates of point at specific distance from camera

Started by saadasif21, November 07, 2017, 07:33:33 AM

Previous topic - Next topic

saadasif21

Hi geeks,
i have been trying to get world coordinates at specific distance from camera. i cant use collision detection because i do not have object at that point. I'm at my wits' end!

let me explain briefly,
lets suppose my camera is at (0,0,-50) and i cant have any object in my world. If i tap anywhere on my 2d screen, where in the world space at z=0 that tap goes. please help
please ask if you need further clarification.

EgonOlsen

You can use this for example: http://www.jpct.net/jpct-ae/doc/com/threed/jpct/Interact2D.html#reproject2D3DWS(com.threed.jpct.Camera, com.threed.jpct.FrameBuffer, int, int, float)

I'm not sure if it does exactly what you want, because you are talking about z=0 in world space here!? However, this method takes z in camera space (which is actually natural, because that's the space into which your taps are going). Just remember that z=0 in camera space isn't a bright idea, so use 1 for 10 or whatever fits you instead.

EgonOlsen


saadasif21

Thanks for your help,
I got out of that mess by using
Interact2D.reproject2D3D(world.getCamera(), fb, x, y);
Thanks again :)