I have developed an iso engine for a farm game. In general it works fine, but the problem is that it is not always accurate when pressing the tiles, so the tile I wanted to select is not the one picked. Anybody has some ideas how to improve this?
2 Answers
\$\begingroup\$ \$\endgroup\$
3 You should use a transform matrix. Check out this tutorial: http://www.alcove-games.com/isometric_tile_picking.php
- 1\$\begingroup\$ Could you provide a few paragraphs on what a transform matrix is? Link-only answers are highly discouraged on the Stack Exchange network. \$\endgroup\$Manishearth– Manishearth2012-12-02 02:24:15 +00:00Commented Dec 2, 2012 at 2:24
- \$\begingroup\$ ok basically what we're trying to do is creating a transform matrix that will match the isometric world. So then, when looking up for coordinates of your isometric tiles, all you have to do is vector v = inv(transformMatrix) * vector u. Your game camera is in fact a transform matrix. It just is very basic (identity matrix scaled by some factor). The transform matrix for an iso world is a bit trickier (rotation by 45 degree, scaling, translation) but there is nothing that is really complicated. Hope this helps! \$\endgroup\$Tony– Tony2012-12-02 03:50:42 +00:00Commented Dec 2, 2012 at 3:50
- \$\begingroup\$ Oh, I have no interest in this post, I was reviewing. I meant for you to add that into your post--it helps prevent link rot. \$\endgroup\$Manishearth– Manishearth2012-12-02 09:53:13 +00:00Commented Dec 2, 2012 at 9:53
\$\begingroup\$ \$\endgroup\$
In this answer the ratio between the projected diagonal of a square laying on the ground are 70:30. You can generalize with ease for the particular perspective you are using.