4
\$\begingroup\$

I'm making a pseudo-2D top-down game, where my assets are actually 3d but I use an orthographic projection to introduce more depth.

I saw a picture of how the game "Enter the Gungeon" was actually made in unity 3d.

Gungeon 3D Gungeon actual view

When I tried doing something likes this I put the camera in orthographic view and after some adjusting I got it to look kind of like this.

The problem is that movement in the z-axis (away / toward the viewpoint, or up and down on the screen) feels very slow because of the whole orthographic thing. You can notice this when moving a player for example.

When I simply increased the speed of the player in the z-axis it felt pretty normal, but I am wondering if that would introduce some unforeseen consequences?

I couldn't find any guides, posts or videos about this. How should I solve this movement problem?

\$\endgroup\$
1
  • 2
    \$\begingroup\$ I'm not sure what the question is about. Different games handle the camera in different ways. If you found a way that works, then its all good. From what you described, it sounds to me like you've rotated the map or the camera to a weird angle. Could you provide us any picture of your own project? For clarity, when you mention the z-axis do you mean when the character moves up/down ? \$\endgroup\$ Oct 21, 2019 at 10:54

1 Answer 1

4
\$\begingroup\$

It sounds like you're dealing with foreshortening.

When you look down at the z-axis along a diagonal, only part of the length of a z-pointing vector goes into climbing your screen. The other part goes into receding into the depth "behind" your screen.

So a given worldspace distance along the x axis — which points perpendicular to your view — covers more on-screen pixels than the same worldspace distance along the z, where part of the length recedes away from the view.

As you pointed out, scaling your z movement to compensate can fix the most obvious consequences of foreshortening. So if that works for your game, do it.

There are situations where we wouldn't want to patch the artifact this way though. Let's say our game involves dodging the circular blast radius of bombs. If the radius is computed in world space, then players will find they can dodge faster along the z-axis than they can along the x, adding a bias in your strategy you might not have intended. And making all your circle checks into ellipses to compensate for foreshortening would get super messy fast.

Another solution is to eliminate foreshortening on your z axis altogether. It's optional. You can use an oblique projection to effectively scale the vertical axis of your camera's image sensor, so that 1 unit along the z translates to the same number of pixels as 1 unit along the x. This approach also saves you from having to lean your vertical assets back away from the camera as they do in some games to mitigate the foreshortening on wall/character/prop art.

\$\endgroup\$
3
  • \$\begingroup\$ I can't seem to find a good resource that discusses oblique projection a bit further (especially in the context of unity). Should I have a camera angled 45 degrees towards a plane like in the question above, how would you go about calculating / setting an oblique projection matrix with the correct z scaling? \$\endgroup\$
    – Shervin
    Jan 21, 2020 at 0:07
  • 1
    \$\begingroup\$ @Shervin it looks like you've already asked a question about that. That will be a better venue to gather answers than this comment thread. \$\endgroup\$
    – DMGregory
    Jan 21, 2020 at 0:56
  • \$\begingroup\$ Ok sounds good. Was simply wary if specific questions about oblique projections would have been too off topic on that question. \$\endgroup\$
    – Shervin
    Jan 21, 2020 at 1:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .