# Isometric - precise screen coordinates to isometric

I'm trying to translate mouse coords to precise isometric coords (I can already find the tile the mouse is over, but I want it to be more precise). I've tried several different methods but I seem to keep falling short.

For drawing I use:

batch.draw(
texture,
(y * tileWidth / 2) + (x  * tileWidth / 2),
(x  * tileHeight / 2) - (y * tileHeight / 2))


This is what I currently use for figuring out a tile position:

 float xt = x +  camPosition.x - (ScreenWidth/2) ;
float yt = (ScreenHeight) - y + camPosition.y - (ScreenHeight/2);

int tileY = Math.round((((xt) / tileWidth) - ((yt) / tileHeight)));
int tileX = Math.round((((xt) / tileWidth) + ((yt) / tileHeight))- 1);


I'm just wondering how I could update these to allow for more precise coordinates, instead of tile only. EDIT: Following what ccxvii said below, and removing the -1 from tileX, the object follows my mouse just like I had wanted. Just going to re-examine the math and figure out if that change will result in other messes =o

• What do you mean by "more precise"? Coordinates within a tile? How would such coordinates look like? – Liosan Dec 11 '12 at 10:00
• You already have the solution. Just drop the Math.round call and use floats for tileX and tileY. – ccxvii Dec 11 '12 at 10:02
• Ah, I had though that might be the right way, It follows the mouse more closely than my other attempts, but its still off a bit. Guessing a bug lies elsewhere in my code, I'll just keep looking, thanks =o – Rawrz Dec 11 '12 at 10:25
• @Rawrz Remember to post an answer when you find your solution! – Laurent Couvidou Dec 11 '12 at 10:41