the mouse/touch position is going to be translated to iso via the above as part of the render loop. What I need help with is offseting the above code so that when the orth->iso kicks in, it lines up...

The mouse position is already in Isometric space, you need to translate that back to orthographic space to determine the click point. I have 3 functions that I use in my engine for this.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public static Point isoToCoarseWorld(Point isoPoint, Point viewportOrigin, Dimension isoDims) { int xOrg = viewportOrigin.x + (isoDims.width >> 1); int yOrg = viewportOrigin.y;
int i = (int)Math.floor(((isoPoint.y - yOrg)/(double)isoDims.height + (isoPoint.x - xOrg)/(double)isoDims.width) * 32); int j = (int)Math.floor(((isoPoint.y - yOrg)/(double)isoDims.height - (isoPoint.x - xOrg)/(double)isoDims.width) * 32);
return new Point(i, j); }
public static Point coarseWorldToTile(Point coarseWorldPoint, Dimension worldTileDims) { return new Point((int)Math.floor(coarseWorldPoint.x / worldTileDims.width) ,(int)Math.floor(coarseWorldPoint.y / worldTileDims.height)); }
public static Point coarseWorldToTileFine(Point coarseWorldPoint, Dimension worldTileDims) { return new Point((coarseWorldPoint.x % worldTileDims.width) ,(coarseWorldPoint.y % worldTileDims.height)); } |

Where the worldTileDims are 32x32 and the isoDims are 64x32. isoToCoarseWorld takes an isometric point and converts it into raw orthographic space. The other two functions are used to determine which tile that raw point is in, and the offset within the tile respectively.

When working out any path finding or logic, you should be working in orthographic space. Isometric space is only used for viewing. I think this is what you were asking about. If not could you clarify a bit?