Jump to content
• Advertisement

# Isometric view with 2 grids & tile size

## Recommended Posts

Posted (edited)

Please use the above image in your game, so I can see if everything is setup correctly.

1 hour ago, Androphin said:

I needed a rotation-matrix for the isometric perspective﻿

There seems to be a confusion. A Orthographic camera, produces a Isometric image when it is lined up at a 45 degree angle.

All Isometric images are Orthographic,however not all Orthographic images are Isometric. Like all thumbs are fingers but no all fingers are thumbs.

Edited by Scouting Ninja

#### Share this post

##### Share on other sites
Advertisement
2 hours ago, Androphin said:

﻿Due to the direction and position of the cam, I needed a rotation-matrix for the isometric perspective. (As described in my 3rd p﻿ost)﻿﻿﻿﻿﻿﻿﻿

Reading this again. Do you mean, you don't know how to make the image "look" at the camera? You could use a "look" formula, however because isometric is done from 45 degree angles; you can just rotate sprites by 45 degrees.

#### Share this post

##### Share on other sites
Posted (edited)
2 hours ago, Scouting Ninja said:

Reading this again. Do you mean, you don't know how to make the image "look" at the camera? You could use a "look" formula, however because isometric is done from 45 degree angles; you can just rotate sprites by 45 degrees.

Exactly, the image "planes" are not parallel to the projectionmatrix/viewport of the camera, because the camera is looking down to the origin in a 45 degree angle and the sprites get drawed on y/x.
This image shows how the sprites are drawn. The rotation matrix rotates the sprites 45 degree around the y-axis.

In your image

the one in the middle shows how I want it.
My sprites are perpendicular to the isometric grid. That's why they look scewed.

Edited by Androphin

#### Share this post

##### Share on other sites

I see libgdx allows you to define a matrix from the start for your sprites, using Batch() https://libgdx.badlogicgames.com/ci/nightlies/docs/api/com/badlogic/gdx/graphics/g2d/Batch.html#begin--

So if you use Batch.begin(); just as is, it will look at the camera. So if you wanted a HUD it would be: hudBatch.begin(); So don't assign any matrix to the batch of sprites.

It's nice to know that libgdx uses batches from the start.

#### Share this post

##### Share on other sites

I already tried this and the problem is, the sprites are drawn in the cameras y/x space (origin 0,0 is the bottom left corner)

and not on the isometric grid anymore:

#### Share this post

##### Share on other sites
Posted (edited)

Your grid tiles are diamonds, so to get a isometric look you "flatten" them by scaling the height. So when you load in my sprite that is already isometric, it just gets flattened.

      batch.setProjectionMatrix(camOrtho.combined);
batch.setTransformMatrix(imageFaceCameraMatrix);
batch.begin();
batch.draw(squareDummy, 0, 0);
batch.end();

Should be:

Matrix batchMatrix = camOrtho.combined.setToScaling(1,2,1); //Assuming XYZ; I really don't use LibGDX anymore

batch.setProjectionMatrix(batchMatrix);
batch.setTransformMatrix(imageFaceCameraMatrix);
batch.begin();
batch.draw(squareDummy, 0, 0);
batch.end();

//I didn't have time to test the above, but it should work.

The short story is that your sprites have to be twice as long, because your camera "flattens" the diamonds. You could use longer sprites, or adjust sprite scale with setScale( 1, 2)  when imported. Whatever you want, the camera is shrinking the Y scale by half.

Edited by Scouting Ninja

#### Share this post

##### Share on other sites

Im Actually not sure anymore what you are refering to as the problem. Your secondary video looks correct to me as it does render isometric quads. Or do you mean that the alpha is not present so it displays alot of white?

#### Share this post

##### Share on other sites
10 hours ago, Scouting Ninja said:

Your grid tiles are diamonds, so to get a isometric look you "flatten" them by scaling the height.

Many "isometric" games are actually at a 1:2:1 ratio, which is probably the angles you're thinking about.  It isn't quite isometric since only two of the three angles are the same, but it looks much nicer on pixels.

#### Share this post

##### Share on other sites
4 minutes ago, frob said:

Many "isometric" games are actually at a 1:2:1 ratio, which is probably the angles you're thinking about.

Yes, that is correct. I was thinking of correcting this so that the angle is correct again. It was the only problem I could still see in the last image.

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

## Sign in

Already have an account? Sign in here.

Sign In Now

• Advertisement
• Advertisement

• ### Popular Contributors

1. 1
2. 2
Rutin
19
3. 3
4. 4
5. 5
• Advertisement

• 9
• 9
• 9
• 14
• 12
• ### Forum Statistics

• Total Topics
633289
• Total Posts
3011231
• ### Who's Online (See full list)

There are no registered users currently online

×

## Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!