1
0
Fork 0

TileMap: Fix floor precision in world_to_map on tile borders

Fixes #23250, supersedes #23315.
This commit is contained in:
Rémi Verschelde 2018-11-02 13:06:43 +01:00
parent a3501c096f
commit b9232ce7a3
1 changed files with 5 additions and 0 deletions

View File

@ -1445,6 +1445,11 @@ Vector2 TileMap::world_to_map(const Vector2 &p_pos) const {
default: {}
}
// Account for precision errors on the border (GH-23250).
// 0.00005 is 5*CMP_EPSILON, results would start being unpredictible if
// cell size is > 15,000, but we can hardly have more precision anyway with
// floating point.
ret += Vector2(0.00005, 0.00005);
return ret.floor();
}