i want to project a ray into the 3d world by touching the screen and using those 3d co ordinates.
i am not trying to select objects, but i want to move an object to the projected position.
i know the y component of the resulting projected vector (cuz the object must always be at a specific y height)
any ideas?
Take a look at my topic here, it might help
http://www.jpct.net/forum2/index.php/topic,1803.0.html
that won't work for this situation.
i started this thread because none of the other threads seem to work when i implemented their code.
i am trying to touch the screen (2d co-ordinates) and then cast a ray into the 3d world perpendicular to the screen.
its similar to the method of 2d to 3d object picking except i am now trying to move the object i have picked by clicking the screen
It's actually a simple vector equation once you have the position and direction vector. The position vector should be the camera position and the direction vector is the vector returned by the reproject...WS-method. If y of the target plane is known, you end up with three equations and two unknown variables x and z...that's pretty easy to solve on paper. I have some code lying around that does this iirc...i just can't post it right now, because i'm on holiday. Maybe wednesday if you still need it then.
no its okay i found out how to do it.
i followed the method for object picking and it didnt really work.
i sat down and re did it all and now it works so i guess there was something simple that i just overlooked.
thanks all!