3d position from 2d position

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Spidla
Posts: 31
Joined: Tue Nov 25, 2003 3:46 pm
Location: Czech Republic
Contact:

3d position from 2d position

Post by Spidla »

Is there any way to retreive 3d position from screen 2d position
In CollisionManager are only functions to get scenenode from 2d but I need pure 3d position
hearsedriver
Posts: 81
Joined: Fri Aug 22, 2003 12:06 pm
Location: Germany
Contact:

Post by hearsedriver »

That's impossible. Imagine your mouse cursor on a position on the screen. The position on the screen plane is distinct, while the "position" in space could be anywhere on a ray from the interception point of the near clipping plane to the intersection point on the far clipping plane (and beyond, indeed). Thus, the only way to express the "3d position" is a linear equation.

Cheers.
matthias gall, lead programmer at sechsta sinn - email matthias@sechsta-sinn.de
saigumi
Posts: 921
Joined: Fri Aug 22, 2003 11:31 am
Location: St. Louis, MO USA
Contact:

Post by saigumi »

Or, if you mean what your mouse is over.

You could use getRayFromScreenCoordinates and then use that ray in getCollisionPoint.
Crud, how do I do this again?
Spidla
Posts: 31
Joined: Tue Nov 25, 2003 3:46 pm
Location: Czech Republic
Contact:

Post by Spidla »

yes that`s it thanks
Post Reply