how to get a perspecitve look to an orthogonal tilemap

做~自己de王妃 提交于 2019-12-11 09:43:24

问题


I am currentliy using an orthogonal map, not an isometric. But I would like to get an perspective look. the first picuture shows, what I currently have, the second shows my goal.

Isn't it possible to do it with a transform matrix somehow? I did only manage to scale the whole image..


回答1:


You can use MapRenderer.setView(...) to achieve that.

Create a PerspectiveCamera and set it up to have the perspective that you've shown in your second picture. Note that the tiled map will be rendered to the X/Y-plane and you need to set your camera's position and look-at vectors accordingly.

When you are done with that, use MapRenderer.setView(...) with the camera.combined matrix.




回答2:


Be careful; as said by noone, you will still have 2D pixel: no 3D geometry: sprited will not be hidden behind wall.

If you want to achieve some simple fake perspective, you will have to code it yourself. The idea is to use use 2 different layers in the map, one for all the basic stuff (floor, walls, objects) and one for all elements that should hide all things drawn before – the “perspective”.

Then with some code, render the floor tiles, sprites and then the perspective layer to hide objects.

I have written a blog entry to achieved this with libgdx, which you can find here.



来源:https://stackoverflow.com/questions/24722434/how-to-get-a-perspecitve-look-to-an-orthogonal-tilemap

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!