How to rotate an isometric grid

Godot Version

4.3

Question

Hello everyone, I’m having some trouble implementing map rotation in my demo. I’m trying to rotate an isometric grid by 90 degrees so the user can look at the map from different angles. The effect I want is illustrated below via the two images. I am using both a 2d camera and 2d nodes.

Original Position:
2_platform

After rotating 90 degrees:
3_platform

Below is also a screenshot of all the code I’m using to rotate the cells. This seems to work for a “normal” (non-isometric) graph but once it gets projected to an isometric view it gets messed up.

Some more information I think is relevant is that the tiles I’m using are 32x32 but for the isometric view they are 32x16. The settings are as follows:

4_settings

I would appreciate any and all help. Thanks in advance :godot:

can you show the end-result of your rotation, so its easier to understand what goes wrong?

Of course. Here are some screenshots of my isometric shape after I rotate it 90 degrees.

After a full rotation it goes back to its original shape.

hmm your code does seem fine. Can you put different tiles in the corners so we know where they end up in the rotation?

Whats confusing me is that 90 degrees and 270 degrees are the same, but rotation ends up different. i think something has to be changed with the rotate_vector_90_clockwise-method

I don’t know if this is of any use, but this is what the platform looks like when shown on a flat graph vs how it looks in isometric mode

Have you tried changing the Tile Layout property from stacked to anything else? For a none square tile shape it can help sometimes.
Failing that, you could try printing out a tiles position before and after the rotation to see exactly what exactly is happening is to help figure it out.

1 Like

This is very odd. But you can apply a manual rotation and look at it in “Flat”-view and then compare to the 0-degree rotation and check how the tiles have to be moved

I changed the Tile Layout from “Stacked” to “Diamond Right” and it worked ! Apparently the code itself was correct, I just needed to change that one setting. Now the new problem is getting multiple z levels to rotate correctly. Since that is beyond the scope of the question I originally asked, I will mark your suggestion as the solution.

Thank you.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.