Archived

This topic is now archived and is closed to further replies.

mobeus

translation from screen to world coordinate

Recommended Posts

Hi I''m a new power render user, just starting to learn the api''s. I am trying to create a isometric view of a 3d world (diablo, AOE, etc.) However I can not figure out how to translate the (screen)mouse position to the world position. So when I click on the ground I can get the world coordinate and move my players to the position. The other question is would it be a good idea to write a scene manager for my game so I filter the enties to pass to the render, or does the render dod this fast enough already. Any help would be greatly apprecaited. mobeus

Share this post


Link to post
Share on other sites
Take a look at the MakeRay function from the Pick Object example (pickobj.c)

If you have a lot of objects the engine will transform the bounding boxes of them all to find out if they are visible. You''ll want to divide a large world into sections so you can filter out many objects at a time.


Share this post


Link to post
Share on other sites
In the example the camera is facing the origin so it''s easy to translate screen to world coordinate and create a ray. but how to you get the ray when the camera is not facing the origin?

mobeus

Share this post


Link to post
Share on other sites
That routine creates a ray in camera space. To get back to world space transform the ray endpoints by the inverse of the view matrix.

There is an example of that in interact.c of the Landscape Studio source. (search for INT_MatrixInvert).

Share this post


Link to post
Share on other sites