2
\$\begingroup\$

I am developing a 2d isometric game and I was wondering if I can use a 3d plane for a 2d game.

\$\endgroup\$
  • \$\begingroup\$ That's pretty much what a viewport is \$\endgroup\$ – Eric Feb 26 '17 at 20:54
  • \$\begingroup\$ What specific obstacle have you encountered that you're trying to overcome? \$\endgroup\$ – DMGregory Feb 26 '17 at 23:18
  • \$\begingroup\$ Nice answers, but i'm still not sure what you're doing. If you're making a game out of 2d tiles/assets, just use unity's 2d mode, it's a shortcut to the "stacked quads with sprites on with an orthographic camera" configuration that people have been using to make 2d games on a 3d pipeline for a very long time now. If you want a 3d game to look like an isometric 2d game, @Theraot's answer is what you want. If you want the 3d camera system to position 2d sprites for you, that system with carefully placed billboard sprites is probably possible, but i imagine it would be hard to do well quickly. \$\endgroup\$ – StarWeaver Feb 27 '17 at 11:28
  • \$\begingroup\$ @StarWeaver what do you mean by stacked quads? \$\endgroup\$ – user97643 Feb 27 '17 at 11:29
  • \$\begingroup\$ Flat square planar meshes -- i think unity has them as a primative? -- that you texture with a tile or sprite (latter typically with transpanency) and move around. Stacked because they typically come in layers to prevent z-fighting and allow for… layering effects. Since an orthographic camera ignores depth you can use the z axis for scene management. Go take a look at an intro to 2d mode in unity, it's capable and i might be crazy :3 \$\endgroup\$ – StarWeaver Feb 27 '17 at 11:41
3
\$\begingroup\$

Sure, you want an orthographic projection.

Aside from that, you can render using an isometric point of view. That will allow you to look at surface with square tiles and have them appear as isometric tiles. Also, should allow you to use 3D models in your isometric game without worrying about the projection.

The following is from the Wikipedia link above:

There are eight different orientations to obtain an isometric view, depending into which octant the viewer looks. The isometric transform from a point ax,y,z in 3D space to a point bx,y in 2D space looking into the first octant can be written mathematically with rotation matrices as:

Isometrix matrix

where α = arcsin(tan 30°) ≈ 35.264° and β = 45°. As explained above, this is a rotation around the vertical (here y) axis by β, followed by a rotation around the horizontal (here x) axis by α.

(...)

The other 7 possibilities are obtained by either rotating to the opposite sides or not, and then inverting the view direction or not.

Emphasis mine.

Notice the article says there 8 possible such matrices. Some testing will be required to make sure you are use the right one for the coordinates of your map.


For unity, you want to set an orthographic matrix in Camera.projectionMatrix and the isometric matrix shown above in Camera.worldToCameraMatrix.

Note: I don't really have experience with Unity. So I can't tell if Camera.orthographic is a better option than setting an orthograpic matrix to Camera.projectionMatrix.

If you need to set the camera by hand, use the angles shown above (α = arcsin(tan 30°) ≈ 35.264° and β = 45°):

Demostration of angles to set isometric view

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Your assumption is true. You can use Camera.orthographic to enable orthographic projection (true) or perspective projection (false). This can also be done via the Unity Inspector and is set to orthographic by default when 2D projects are created. \$\endgroup\$ – Suddoha Feb 27 '17 at 3:01
  • \$\begingroup\$ @Suddoha I know it can be done, documentation says so. I don't know if it is better. \$\endgroup\$ – Theraot Feb 27 '17 at 3:24
1
\$\begingroup\$

Yes. A plane is a flat, two-dimensional surface... There are infinite planes in 3d space... You can use any of them...

| improve this answer | |
\$\endgroup\$
0
\$\begingroup\$

https://docs.unity3d.com/ScriptReference/Camera-orthographic.html

You want to be in orthographic view.

I found a script that tweens between orthographic and perspective views. I can post it if you'd like?

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy