Page 1 of 1

conversion from 2d cord. to 3d and vice versa

Posted: Tue Dec 27, 2005 8:57 am
by Guest
How can we convert a 2d coordinate say mouse pointer coordinates to 3d world coordinates and from world coord to mouse cursor cord.

Posted: Tue Dec 27, 2005 9:19 am
by rincewind
Have a look at the API, in particular at the ISceneCollisionManager.
This class (for which a pointer can be received via the ISceneManager)
provides all methods you need for this tasks.
For example, you can use getScreenCoordinatesFrom3DPosition() to
transform 3d coordinats into 2d screen coordinates.

Posted: Tue Dec 27, 2005 10:40 am
by Guest
i know this but how can i perform vice versa

Posted: Tue Dec 27, 2005 5:49 pm
by AshmenGlue
I don't think you can do that(2D to 3D). Why would you want to do anyway. If you're trying select something on the screen there are tutorials for that. I'm not sure where though.

Posted: Tue Dec 27, 2005 6:51 pm
by bitplane
for 2d to 3d, look at the mouse picking section in the wiki-
http://www.irrforge.org/index.php/Mouse_Input
you don't need to use collision, you could just pick a set distance along the ray given by getRayFromScreenCoordinates