Making a nicer-looking top-down perspective in Unity

May 24, 2021 at 07:00 am by nemirc


For the past months I have been working on a top-down game as a side project. While 2D top-down games cheat the perspective (placing everything in a “laying down position”), almost all 3D top-down games just put the camera above the scene.

Some 3D games cheat this by putting the camera somewhere around the 45 degrees, making it a “tilted view top-down” of some sort.

However, I was not happy with that, because I wanted my camera to be a little bit higher (while not exactly above everything). At that point, a guy I was working with showed me this image from a Zelda game where it shows what they were doing for the perspective.

I found that to be an interesting solution, so I decided to try to reproduce that. For reference, the image below shows how the “before and after”. You can see the top image displays the characters in a more “vertical” view, so you see their heads first. If this was a “true” top down, then all you’d see are the heads and shoulders. On the other hand, the bottom image shows a fixed perspective, where you see characters in a more “lateral” perspective.

To do this, I had to do two things. First, change the perspective of the environment models, so they show in the right perspective. And second, make the characters rotate according to the camera. On a side note, my camera has a rotation of 15 degrees from the vertical axis.

The environment is the easy part. In this case I was using a pre-made asset, and all I did was tilt the walls 15 degrees (you can tilt them more if you want, depending on how you want the game to look). Below you can see a tilted wall next to a completely straight wall, so you can see the difference.

I did the same for the columns in the level, and this has to be repeated for every prop of your level.

However, if you are creating your own models, it’s best to add that inclination on the model itself. For example, for this other game, I created custom walls because I wanted them to be as low poly as possible, since I am making this for the Vita.

The second part was the tricky one, because I had to set the rotation of my character regardless of the direction the character was looking. What I ended up doing is using a function from Unity that calculates an inverse transform, so I could know how much the character has to be rotated, to reach my desired inclination. The full script I below (split in two images to keep them small).

I setup my character by setting the actual mesh as a child of a “Player” object that has all the controls attached to it. I then set my character as a “Character” for my script, and set the desired rotation.

When playing the game, the character will keep the desired perspective regardless of the direction. The image below shows what you see versus what the game is doing.

 

And that’s it. The result is a nicer looking top down view, where you can actually see your characters (and environments), not just the heads and shoulders.

Sections: Tips + Tutorials





Sign up for our newsletter

This website uses cookies to ensure you get the best experience possible More Info
Got it!