summaryrefslogtreecommitdiff
path: root/modules/gridmap/grid_map.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-06 17:01:16 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-06 17:01:16 +0200
commit5fb84e5702d7fbfc011c05304500c0b61ef2ef92 (patch)
tree62a285f9ed56cba8c709e1b08278d599d33c4f0e /modules/gridmap/grid_map.cpp
parent13c880911b2a9b8c979e665bb52d6ffe2d4a1165 (diff)
parent694190a354c1634caaff5cbd7357de345a334c01 (diff)
Merge pull request #64661 from Mickeon/rename-tilemap-world
Rename TileMap/GridMap.`world_to_map` and opposite to `local_to_map`
Diffstat (limited to 'modules/gridmap/grid_map.cpp')
-rw-r--r--modules/gridmap/grid_map.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/modules/gridmap/grid_map.cpp b/modules/gridmap/grid_map.cpp
index 8486e2c58b..ac0755cf68 100644
--- a/modules/gridmap/grid_map.cpp
+++ b/modules/gridmap/grid_map.cpp
@@ -497,18 +497,18 @@ int GridMap::get_orthogonal_index_from_basis(const Basis &p_basis) const {
return 0;
}
-Vector3i GridMap::world_to_map(const Vector3 &p_world_position) const {
+Vector3i GridMap::local_to_map(const Vector3 &p_world_position) const {
Vector3 map_position = (p_world_position / cell_size).floor();
return Vector3i(map_position);
}
-Vector3 GridMap::map_to_world(const Vector3i &p_map_position) const {
+Vector3 GridMap::map_to_local(const Vector3i &p_map_position) const {
Vector3 offset = _get_offset();
- Vector3 world_pos(
+ Vector3 local_position(
p_map_position.x * cell_size.x + offset.x,
p_map_position.y * cell_size.y + offset.y,
p_map_position.z * cell_size.z + offset.z);
- return world_pos;
+ return local_position;
}
void GridMap::_octant_transform(const OctantKey &p_key) {
@@ -1047,8 +1047,8 @@ void GridMap::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_basis_with_orthogonal_index", "index"), &GridMap::get_basis_with_orthogonal_index);
ClassDB::bind_method(D_METHOD("get_orthogonal_index_from_basis", "basis"), &GridMap::get_orthogonal_index_from_basis);
- ClassDB::bind_method(D_METHOD("world_to_map", "world_position"), &GridMap::world_to_map);
- ClassDB::bind_method(D_METHOD("map_to_world", "map_position"), &GridMap::map_to_world);
+ ClassDB::bind_method(D_METHOD("local_to_map", "local_position"), &GridMap::local_to_map);
+ ClassDB::bind_method(D_METHOD("map_to_local", "map_position"), &GridMap::map_to_local);
ClassDB::bind_method(D_METHOD("_update_octants_callback"), &GridMap::_update_octants_callback);
ClassDB::bind_method(D_METHOD("resource_changed", "resource"), &GridMap::resource_changed);