virtualx-engine-docs/_sources/classes/class_gridmap.rst.txt

646 lines
29 KiB
Text
Raw Normal View History

2024-10-23 18:41:33 +02:00
:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/3.6/modules/gridmap/doc_classes/GridMap.xml.
.. _class_GridMap:
GridMap
=======
**Inherits:** :ref:`Spatial<class_Spatial>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
Node for 3D tile-based maps.
.. rst-class:: classref-introduction-group
Description
-----------
GridMap lets you place meshes on a grid interactively. It works both from the editor and from scripts, which can help you create in-game level editors.
GridMaps use a :ref:`MeshLibrary<class_MeshLibrary>` which contains a list of tiles. Each tile is a mesh with materials plus optional collision and navigation shapes.
A GridMap contains a collection of cells. Each grid cell refers to a tile in the :ref:`MeshLibrary<class_MeshLibrary>`. All cells in the map have the same dimensions.
Internally, a GridMap is split into a sparse collection of octants for efficient rendering and physics processing. Every octant has the same dimensions and can contain several cells.
\ **Note:** GridMap doesn't extend :ref:`VisualInstance<class_VisualInstance>` and therefore can't be hidden or cull masked based on :ref:`VisualInstance.layers<class_VisualInstance_property_layers>`. If you make a light not affect the first layer, the whole GridMap won't be lit by the light in question.
.. rst-class:: classref-introduction-group
Tutorials
---------
- :doc:`Using gridmaps <../tutorials/3d/using_gridmaps>`
- `3D Platformer Demo <https://godotengine.org/asset-library/asset/125>`__
- `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/126>`__
.. rst-class:: classref-reftable-group
Properties
----------
.. table::
:widths: auto
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`bake_navigation<class_GridMap_property_bake_navigation>` | ``false`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`cell_center_x<class_GridMap_property_cell_center_x>` | ``true`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`cell_center_y<class_GridMap_property_cell_center_y>` | ``true`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`cell_center_z<class_GridMap_property_cell_center_z>` | ``true`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`int<class_int>` | :ref:`cell_octant_size<class_GridMap_property_cell_octant_size>` | ``8`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`float<class_float>` | :ref:`cell_scale<class_GridMap_property_cell_scale>` | ``1.0`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`cell_size<class_GridMap_property_cell_size>` | ``Vector3( 2, 2, 2 )`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`int<class_int>` | :ref:`collision_layer<class_GridMap_property_collision_layer>` | ``1`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`int<class_int>` | :ref:`collision_mask<class_GridMap_property_collision_mask>` | ``1`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`MeshLibrary<class_MeshLibrary>` | :ref:`mesh_library<class_GridMap_property_mesh_library>` | |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`int<class_int>` | :ref:`navigation_layers<class_GridMap_property_navigation_layers>` | ``1`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`PhysicsMaterial<class_PhysicsMaterial>` | :ref:`physics_material<class_GridMap_property_physics_material>` | |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
| :ref:`bool<class_bool>` | :ref:`use_in_baked_light<class_GridMap_property_use_in_baked_light>` | ``false`` |
+-----------------------------------------------+----------------------------------------------------------------------+------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear<class_GridMap_method_clear>` **(** **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`clear_baked_meshes<class_GridMap_method_clear_baked_meshes>` **(** **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`get_bake_mesh_instance<class_GridMap_method_get_bake_mesh_instance>` **(** :ref:`int<class_int>` idx **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_bake_meshes<class_GridMap_method_get_bake_meshes>` **(** **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_cell_item<class_GridMap_method_get_cell_item>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_cell_item_orientation<class_GridMap_method_get_cell_item_orientation>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_collision_layer_bit<class_GridMap_method_get_collision_layer_bit>` **(** :ref:`int<class_int>` bit **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_collision_mask_bit<class_GridMap_method_get_collision_mask_bit>` **(** :ref:`int<class_int>` bit **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_meshes<class_GridMap_method_get_meshes>` **(** **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_used_cells<class_GridMap_method_get_used_cells>` **(** **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>` | :ref:`get_used_cells_by_item<class_GridMap_method_get_used_cells_by_item>` **(** :ref:`int<class_int>` item **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`make_baked_meshes<class_GridMap_method_make_baked_meshes>` **(** :ref:`bool<class_bool>` gen_lightmap_uv=false, :ref:`float<class_float>` lightmap_uv_texel_size=0.1 **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`map_to_world<class_GridMap_method_map_to_world>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`resource_changed<class_GridMap_method_resource_changed>` **(** :ref:`Resource<class_Resource>` resource **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_cell_item<class_GridMap_method_set_cell_item>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` item, :ref:`int<class_int>` orientation=0 **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_clip<class_GridMap_method_set_clip>` **(** :ref:`bool<class_bool>` enabled, :ref:`bool<class_bool>` clipabove=true, :ref:`int<class_int>` floor=0, Vector3.Axis axis=0 **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_collision_layer_bit<class_GridMap_method_set_collision_layer_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_collision_mask_bit<class_GridMap_method_set_collision_mask_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`world_to_map<class_GridMap_method_world_to_map>` **(** :ref:`Vector3<class_Vector3>` pos **)** |const| |
+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_GridMap_signal_cell_size_changed:
.. rst-class:: classref-signal
**cell_size_changed** **(** :ref:`Vector3<class_Vector3>` cell_size **)**
Emitted when :ref:`cell_size<class_GridMap_property_cell_size>` changes.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Constants
---------
.. _class_GridMap_constant_INVALID_CELL_ITEM:
.. rst-class:: classref-constant
**INVALID_CELL_ITEM** = ``-1``
Invalid cell item that can be used in :ref:`set_cell_item<class_GridMap_method_set_cell_item>` to clear cells (or represent an empty cell in :ref:`get_cell_item<class_GridMap_method_get_cell_item>`).
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_GridMap_property_bake_navigation:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **bake_navigation** = ``false``
.. rst-class:: classref-property-setget
- void **set_bake_navigation** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **is_baking_navigation** **(** **)**
If ``true``, this GridMap uses cell navmesh resources to create navigation regions.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_cell_center_x:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **cell_center_x** = ``true``
.. rst-class:: classref-property-setget
- void **set_center_x** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **get_center_x** **(** **)**
If ``true``, grid items are centered on the X axis.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_cell_center_y:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **cell_center_y** = ``true``
.. rst-class:: classref-property-setget
- void **set_center_y** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **get_center_y** **(** **)**
If ``true``, grid items are centered on the Y axis.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_cell_center_z:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **cell_center_z** = ``true``
.. rst-class:: classref-property-setget
- void **set_center_z** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **get_center_z** **(** **)**
If ``true``, grid items are centered on the Z axis.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_cell_octant_size:
.. rst-class:: classref-property
:ref:`int<class_int>` **cell_octant_size** = ``8``
.. rst-class:: classref-property-setget
- void **set_octant_size** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_octant_size** **(** **)**
The size of each octant measured in number of cells. This applies to all three axis.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_cell_scale:
.. rst-class:: classref-property
:ref:`float<class_float>` **cell_scale** = ``1.0``
.. rst-class:: classref-property-setget
- void **set_cell_scale** **(** :ref:`float<class_float>` value **)**
- :ref:`float<class_float>` **get_cell_scale** **(** **)**
The scale of the cell items.
This does not affect the size of the grid cells themselves, only the items in them. This can be used to make cell items overlap their neighbors.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_cell_size:
.. rst-class:: classref-property
:ref:`Vector3<class_Vector3>` **cell_size** = ``Vector3( 2, 2, 2 )``
.. rst-class:: classref-property-setget
- void **set_cell_size** **(** :ref:`Vector3<class_Vector3>` value **)**
- :ref:`Vector3<class_Vector3>` **get_cell_size** **(** **)**
The dimensions of the grid's cells.
This does not affect the size of the meshes. See :ref:`cell_scale<class_GridMap_property_cell_scale>`.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_collision_layer:
.. rst-class:: classref-property
:ref:`int<class_int>` **collision_layer** = ``1``
.. rst-class:: classref-property-setget
- void **set_collision_layer** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_collision_layer** **(** **)**
The physics layers this GridMap is in.
GridMaps act as static bodies, meaning they aren't affected by gravity or other forces. They only affect other physics bodies that collide with them.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_collision_mask:
.. rst-class:: classref-property
:ref:`int<class_int>` **collision_mask** = ``1``
.. rst-class:: classref-property-setget
- void **set_collision_mask** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_collision_mask** **(** **)**
The physics layers this GridMap detects collisions in. See `Collision layers and masks <../tutorials/physics/physics_introduction.html#collision-layers-and-masks>`__ in the documentation for more information.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_mesh_library:
.. rst-class:: classref-property
:ref:`MeshLibrary<class_MeshLibrary>` **mesh_library**
.. rst-class:: classref-property-setget
- void **set_mesh_library** **(** :ref:`MeshLibrary<class_MeshLibrary>` value **)**
- :ref:`MeshLibrary<class_MeshLibrary>` **get_mesh_library** **(** **)**
The assigned :ref:`MeshLibrary<class_MeshLibrary>`.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_navigation_layers:
.. rst-class:: classref-property
:ref:`int<class_int>` **navigation_layers** = ``1``
.. rst-class:: classref-property-setget
- void **set_navigation_layers** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_navigation_layers** **(** **)**
The navigation layers the GridMap generates its navigation regions in.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_physics_material:
.. rst-class:: classref-property
:ref:`PhysicsMaterial<class_PhysicsMaterial>` **physics_material**
.. rst-class:: classref-property-setget
- void **set_physics_material** **(** :ref:`PhysicsMaterial<class_PhysicsMaterial>` value **)**
- :ref:`PhysicsMaterial<class_PhysicsMaterial>` **get_physics_material** **(** **)**
Overrides the default friction and bounce physics properties for the whole **GridMap**.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_property_use_in_baked_light:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **use_in_baked_light** = ``false``
.. rst-class:: classref-property-setget
- void **set_use_in_baked_light** **(** :ref:`bool<class_bool>` value **)**
- :ref:`bool<class_bool>` **get_use_in_baked_light** **(** **)**
Controls whether this GridMap will be baked in a :ref:`BakedLightmap<class_BakedLightmap>` or not.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_GridMap_method_clear:
.. rst-class:: classref-method
void **clear** **(** **)**
Clear all cells.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_clear_baked_meshes:
.. rst-class:: classref-method
void **clear_baked_meshes** **(** **)**
.. container:: contribute
There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_bake_mesh_instance:
.. rst-class:: classref-method
:ref:`RID<class_RID>` **get_bake_mesh_instance** **(** :ref:`int<class_int>` idx **)**
.. container:: contribute
There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_bake_meshes:
.. rst-class:: classref-method
:ref:`Array<class_Array>` **get_bake_meshes** **(** **)**
Returns an array of :ref:`ArrayMesh<class_ArrayMesh>`\ es and :ref:`Transform<class_Transform>` references of all bake meshes that exist within the current GridMap.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_cell_item:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_cell_item** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** |const|
The :ref:`MeshLibrary<class_MeshLibrary>` item index located at the grid-based X, Y and Z coordinates. If the cell is empty, :ref:`INVALID_CELL_ITEM<class_GridMap_constant_INVALID_CELL_ITEM>` will be returned.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_cell_item_orientation:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_cell_item_orientation** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** |const|
The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is returned if the cell is empty.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_collision_layer_bit:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_collision_layer_bit** **(** :ref:`int<class_int>` bit **)** |const|
Returns an individual bit on the :ref:`collision_layer<class_GridMap_property_collision_layer>`.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_collision_mask_bit:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_collision_mask_bit** **(** :ref:`int<class_int>` bit **)** |const|
Returns an individual bit on the :ref:`collision_mask<class_GridMap_property_collision_mask>`.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_meshes:
.. rst-class:: classref-method
:ref:`Array<class_Array>` **get_meshes** **(** **)** |const|
Returns an array of :ref:`Transform<class_Transform>` and :ref:`Mesh<class_Mesh>` references corresponding to the non-empty cells in the grid. The transforms are specified in world space.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_used_cells:
.. rst-class:: classref-method
:ref:`Array<class_Array>` **get_used_cells** **(** **)** |const|
Returns an array of :ref:`Vector3<class_Vector3>` with the non-empty cell coordinates in the grid map.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_get_used_cells_by_item:
.. rst-class:: classref-method
:ref:`Array<class_Array>` **get_used_cells_by_item** **(** :ref:`int<class_int>` item **)** |const|
Returns an array of all cells with the given item index specified in ``item``.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_make_baked_meshes:
.. rst-class:: classref-method
void **make_baked_meshes** **(** :ref:`bool<class_bool>` gen_lightmap_uv=false, :ref:`float<class_float>` lightmap_uv_texel_size=0.1 **)**
.. container:: contribute
There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_map_to_world:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **map_to_world** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** |const|
Returns the position of a grid cell in the GridMap's local coordinate space.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_resource_changed:
.. rst-class:: classref-method
void **resource_changed** **(** :ref:`Resource<class_Resource>` resource **)**
.. container:: contribute
There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_set_cell_item:
.. rst-class:: classref-method
void **set_cell_item** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` item, :ref:`int<class_int>` orientation=0 **)**
Sets the mesh index for the cell referenced by its grid-based X, Y and Z coordinates.
A negative item index such as :ref:`INVALID_CELL_ITEM<class_GridMap_constant_INVALID_CELL_ITEM>` will clear the cell.
Optionally, the item's orientation can be passed. For valid orientation values, see :ref:`Basis.get_orthogonal_index<class_Basis_method_get_orthogonal_index>`.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_set_clip:
.. rst-class:: classref-method
void **set_clip** **(** :ref:`bool<class_bool>` enabled, :ref:`bool<class_bool>` clipabove=true, :ref:`int<class_int>` floor=0, Vector3.Axis axis=0 **)**
.. container:: contribute
There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_set_collision_layer_bit:
.. rst-class:: classref-method
void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
Sets an individual bit on the :ref:`collision_layer<class_GridMap_property_collision_layer>`.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_set_collision_mask_bit:
.. rst-class:: classref-method
void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
Sets an individual bit on the :ref:`collision_mask<class_GridMap_property_collision_mask>`.
.. rst-class:: classref-item-separator
----
.. _class_GridMap_method_world_to_map:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **world_to_map** **(** :ref:`Vector3<class_Vector3>` pos **)** |const|
Returns the coordinates of the grid cell containing the given point.
\ ``pos`` should be in the GridMap's local coordinate space.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`