MMOCCForum

Full Version: Some Maths - Need Help!
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hey there,
I need some help with Isometric and i hope someone here can help Happybracket

Here is my Problem:

I want to draw Walls in the Room.
Every tile get Calculated this way:

worldX = (isox * (tileWidth / 2)) - (isoy * (tileWidth / 2));
worldY = (isox * (tileHeight / 2)) + (isoy * (tileHeight / 2));

worldX = worldX + (tileWidth / 2);
worldY = worldY + (tileHeight / 2);

The Walls i calculate this Way:

worldX = (isox * (tileWidth / 2)) - (isoy * (tileWidth / 2));
worldY = (isox * (tileHeight / 2)) + (isoy * (tileHeight / 2));

worldX = worldX + (wallWidth / 2);
worldY = worldY - (wallHeight / 2);

Some more Informations:
tileWidth = 54 - 2;
tileHeight = 33 - 1;

wallWidth = 32 - 1;
wallHeight = Dunno atm, not @ home!

Hope someone can help me!
What exactly is the problem you're having? Are the walls not lining up properly?
The Wall Coordinates get calculated wrong,

They go down. Every new ISOWall Instance the Walls are 2-5 Pixels to much down.
Are you applying an offset?
Oh yeah, sorry i forgot!

OffsetX = 200
OffsetY = 100
Since you are calculating the placement from the tile height and width the height should ALWAYS be half of height. Change the height to 26 and see how it does Happybracket
I think 26 is a bit to low for WallHeight...
I'll test it later, if anyone has other Solutions: Simply Post, i'm happy for every help Happybracket
(07-22-2010 05:42 AM)P31 Wrote: [ -> ]I think 26 is a bit to low for WallHeight...
I'll test it later, if anyone has other Solutions: Simply Post, i'm happy for every help Happybracket
It's tile height you need to change to 26. Think about it. In isometrics you move 2 across and then 1 down, this means width should always be twice the height when calculating positions. Since you use tile height to calculate positioning then it needs to be half of the width.

If you don't want to change the tile height you could always do this:
worldY = (isox * ((tileHeight - 6) / 2)) + (isoy * ((tileHeight - 6) / 2));
Thank you very much, Assassin Happybracket

You solved my Problem, walls now get displayed right!
Reference URL's