translation from screen to world coordinate

Started by
2 comments, last by mobeus 22 years, 9 months ago
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
Advertisement
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.


Author of Power Render (http:/www.powerrender.com)
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
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).

Author of Power Render (http:/www.powerrender.com)

This topic is closed to new replies.

Advertisement