Navigation2D

    2D navigation and pathfinding node.

    Deprecated. node and are deprecated and will be removed in a future version. Use Navigation2DServer.map_get_path instead.

    Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of resources. By default, these are automatically collected from child NavigationPolygonInstance nodes.

    Tutorials

    Methods

    The XY plane cell size to use for fields.


    • edge_connection_margin

    This value is used to detect the near edges to connect compatible regions.


    A bitfield determining all navigation map layers the navigation can use on a get_simple_path path query.

    Method Descriptions

    • Vector2 get_closest_point ( to_point ) const

    Returns the navigation point closest to the point given. Points are in local coordinate space.


    • RID get_closest_point_owner ( to_point ) const

    Returns the owner of the NavigationPolygon which contains the navigation point closest to the point given. This is usually a .


    • RID get_rid ( ) const

    Returns the object’s .


    Returns the path between two given points. Points are in local coordinate space. If optimize is (the default), the path is smoothed by merging path segments where possible.