问题
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