Struct NavigationServer2D
#[repr(C)]pub struct NavigationServer2D { /* private fields */ }
experimental-godot-api
only.Expand description
Godot class NavigationServer2D.
Inherits Object
.
Related symbols:
navigation_server_2d
: sidecar module with related enum/flag typesINavigationServer2D
: virtual methods
See also Godot docs for NavigationServer2D
.
§Singleton
This class is a singleton. You can get the one instance using NavigationServer2D::singleton()
.
Implementations§
pub fn singleton() -> Gd<NavigationServer2D>
pub fn get_maps(&self) -> Array<Rid>
pub fn map_create(&mut self) -> Rid
pub fn map_set_active(&mut self, map: Rid, active: bool)
pub fn map_is_active(&self, map: Rid) -> bool
pub fn map_set_cell_size(&mut self, map: Rid, cell_size: f32)
pub fn map_get_cell_size(&self, map: Rid) -> f32
pub fn map_set_use_edge_connections(&mut self, map: Rid, enabled: bool)
pub fn map_get_use_edge_connections(&self, map: Rid) -> bool
pub fn map_set_edge_connection_margin(&mut self, map: Rid, margin: f32)
pub fn map_get_edge_connection_margin(&self, map: Rid) -> f32
pub fn map_set_link_connection_radius(&mut self, map: Rid, radius: f32)
pub fn map_get_link_connection_radius(&self, map: Rid) -> f32
pub fn map_get_path(
&self,
map: Rid,
origin: Vector2,
destination: Vector2,
optimize: bool,
) -> PackedVector2Array
pub fn map_get_path( &self, map: Rid, origin: Vector2, destination: Vector2, optimize: bool, ) -> PackedVector2Array
To set the default parameters, use Self::map_get_path_ex
and its builder methods. See the book for detailed usage instructions.
pub fn map_get_path_ex<'a>( &'a self, map: Rid, origin: Vector2, destination: Vector2, optimize: bool, ) -> ExMapGetPath<'a>
pub fn map_get_closest_point(&self, map: Rid, to_point: Vector2) -> Vector2
pub fn map_get_closest_point_owner(&self, map: Rid, to_point: Vector2) -> Rid
pub fn map_get_links(&self, map: Rid) -> Array<Rid>
pub fn map_get_regions(&self, map: Rid) -> Array<Rid>
pub fn map_get_agents(&self, map: Rid) -> Array<Rid>
pub fn map_get_obstacles(&self, map: Rid) -> Array<Rid>
pub fn map_force_update(&mut self, map: Rid)
pub fn map_get_iteration_id(&self, map: Rid) -> u32
pub fn map_get_random_point( &self, map: Rid, navigation_layers: u32, uniformly: bool, ) -> Vector2
pub fn query_path( &self, parameters: impl AsObjectArg<NavigationPathQueryParameters2D>, result: impl AsObjectArg<NavigationPathQueryResult2D>, )
pub fn region_create(&mut self) -> Rid
pub fn region_set_enabled(&mut self, region: Rid, enabled: bool)
pub fn region_get_enabled(&self, region: Rid) -> bool
pub fn region_set_use_edge_connections(&mut self, region: Rid, enabled: bool)
pub fn region_get_use_edge_connections(&self, region: Rid) -> bool
pub fn region_set_enter_cost(&mut self, region: Rid, enter_cost: f32)
pub fn region_get_enter_cost(&self, region: Rid) -> f32
pub fn region_set_travel_cost(&mut self, region: Rid, travel_cost: f32)
pub fn region_get_travel_cost(&self, region: Rid) -> f32
pub fn region_set_owner_id(&mut self, region: Rid, owner_id: u64)
pub fn region_get_owner_id(&self, region: Rid) -> u64
pub fn region_owns_point(&self, region: Rid, point: Vector2) -> bool
pub fn region_set_map(&mut self, region: Rid, map: Rid)
pub fn region_get_map(&self, region: Rid) -> Rid
pub fn region_set_transform(&mut self, region: Rid, transform: Transform2D)
pub fn region_get_transform(&self, region: Rid) -> Transform2D
pub fn region_get_connections_count(&self, region: Rid) -> i32
pub fn region_get_connection_pathway_start( &self, region: Rid, connection: i32, ) -> Vector2
pub fn region_get_connection_pathway_end( &self, region: Rid, connection: i32, ) -> Vector2
pub fn region_get_random_point( &self, region: Rid, navigation_layers: u32, uniformly: bool, ) -> Vector2
pub fn link_create(&mut self) -> Rid
pub fn link_set_map(&mut self, link: Rid, map: Rid)
pub fn link_get_map(&self, link: Rid) -> Rid
pub fn link_set_enabled(&mut self, link: Rid, enabled: bool)
pub fn link_get_enabled(&self, link: Rid) -> bool
pub fn link_set_bidirectional(&mut self, link: Rid, bidirectional: bool)
pub fn link_is_bidirectional(&self, link: Rid) -> bool
pub fn link_set_start_position(&mut self, link: Rid, position: Vector2)
pub fn link_get_start_position(&self, link: Rid) -> Vector2
pub fn link_set_end_position(&mut self, link: Rid, position: Vector2)
pub fn link_get_end_position(&self, link: Rid) -> Vector2
pub fn link_set_enter_cost(&mut self, link: Rid, enter_cost: f32)
pub fn link_get_enter_cost(&self, link: Rid) -> f32
pub fn link_set_travel_cost(&mut self, link: Rid, travel_cost: f32)
pub fn link_get_travel_cost(&self, link: Rid) -> f32
pub fn link_set_owner_id(&mut self, link: Rid, owner_id: u64)
pub fn link_get_owner_id(&self, link: Rid) -> u64
pub fn agent_create(&mut self) -> Rid
pub fn agent_set_avoidance_enabled(&mut self, agent: Rid, enabled: bool)
pub fn agent_get_avoidance_enabled(&self, agent: Rid) -> bool
pub fn agent_set_map(&mut self, agent: Rid, map: Rid)
pub fn agent_get_map(&self, agent: Rid) -> Rid
pub fn agent_set_paused(&mut self, agent: Rid, paused: bool)
pub fn agent_get_paused(&self, agent: Rid) -> bool
pub fn agent_set_neighbor_distance(&mut self, agent: Rid, distance: f32)
pub fn agent_get_neighbor_distance(&self, agent: Rid) -> f32
pub fn agent_set_max_neighbors(&mut self, agent: Rid, count: i32)
pub fn agent_get_max_neighbors(&self, agent: Rid) -> i32
pub fn agent_set_time_horizon_agents(&mut self, agent: Rid, time_horizon: f32)
pub fn agent_get_time_horizon_agents(&self, agent: Rid) -> f32
pub fn agent_set_time_horizon_obstacles( &mut self, agent: Rid, time_horizon: f32, )
pub fn agent_get_time_horizon_obstacles(&self, agent: Rid) -> f32
pub fn agent_set_radius(&mut self, agent: Rid, radius: f32)
pub fn agent_get_radius(&self, agent: Rid) -> f32
pub fn agent_set_max_speed(&mut self, agent: Rid, max_speed: f32)
pub fn agent_get_max_speed(&self, agent: Rid) -> f32
pub fn agent_set_velocity_forced(&mut self, agent: Rid, velocity: Vector2)
pub fn agent_set_velocity(&mut self, agent: Rid, velocity: Vector2)
pub fn agent_get_velocity(&self, agent: Rid) -> Vector2
pub fn agent_set_position(&mut self, agent: Rid, position: Vector2)
pub fn agent_get_position(&self, agent: Rid) -> Vector2
pub fn agent_is_map_changed(&self, agent: Rid) -> bool
pub fn agent_set_avoidance_callback(&mut self, agent: Rid, callback: &Callable)
pub fn agent_has_avoidance_callback(&self, agent: Rid) -> bool
pub fn agent_set_avoidance_layers(&mut self, agent: Rid, layers: u32)
pub fn agent_get_avoidance_layers(&self, agent: Rid) -> u32
pub fn agent_set_avoidance_mask(&mut self, agent: Rid, mask: u32)
pub fn agent_get_avoidance_mask(&self, agent: Rid) -> u32
pub fn agent_set_avoidance_priority(&mut self, agent: Rid, priority: f32)
pub fn agent_get_avoidance_priority(&self, agent: Rid) -> f32
pub fn obstacle_create(&mut self) -> Rid
pub fn obstacle_set_avoidance_enabled(&mut self, obstacle: Rid, enabled: bool)
pub fn obstacle_get_avoidance_enabled(&self, obstacle: Rid) -> bool
pub fn obstacle_set_map(&mut self, obstacle: Rid, map: Rid)
pub fn obstacle_get_map(&self, obstacle: Rid) -> Rid
pub fn obstacle_set_paused(&mut self, obstacle: Rid, paused: bool)
pub fn obstacle_get_paused(&self, obstacle: Rid) -> bool
pub fn obstacle_set_radius(&mut self, obstacle: Rid, radius: f32)
pub fn obstacle_get_radius(&self, obstacle: Rid) -> f32
pub fn obstacle_set_velocity(&mut self, obstacle: Rid, velocity: Vector2)
pub fn obstacle_get_velocity(&self, obstacle: Rid) -> Vector2
pub fn obstacle_set_position(&mut self, obstacle: Rid, position: Vector2)
pub fn obstacle_get_position(&self, obstacle: Rid) -> Vector2
pub fn obstacle_set_vertices( &mut self, obstacle: Rid, vertices: &PackedVector2Array, )
pub fn obstacle_get_vertices(&self, obstacle: Rid) -> PackedVector2Array
pub fn obstacle_set_avoidance_layers(&mut self, obstacle: Rid, layers: u32)
pub fn obstacle_get_avoidance_layers(&self, obstacle: Rid) -> u32
pub fn parse_source_geometry_data(
&mut self,
navigation_polygon: impl AsObjectArg<NavigationPolygon>,
source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>,
root_node: impl AsObjectArg<Node>,
)
pub fn parse_source_geometry_data( &mut self, navigation_polygon: impl AsObjectArg<NavigationPolygon>, source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>, root_node: impl AsObjectArg<Node>, )
To set the default parameters, use Self::parse_source_geometry_data_ex
and its builder methods. See the book for detailed usage instructions.
pub fn parse_source_geometry_data_ex<'a>( &'a mut self, navigation_polygon: impl AsObjectArg<NavigationPolygon>, source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>, root_node: impl AsObjectArg<Node>, ) -> ExParseSourceGeometryData<'a>
pub fn bake_from_source_geometry_data(
&mut self,
navigation_polygon: impl AsObjectArg<NavigationPolygon>,
source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>,
)
pub fn bake_from_source_geometry_data( &mut self, navigation_polygon: impl AsObjectArg<NavigationPolygon>, source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>, )
To set the default parameters, use Self::bake_from_source_geometry_data_ex
and its builder methods. See the book for detailed usage instructions.
pub fn bake_from_source_geometry_data_ex<'a>( &'a mut self, navigation_polygon: impl AsObjectArg<NavigationPolygon>, source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>, ) -> ExBakeFromSourceGeometryData<'a>
pub fn bake_from_source_geometry_data_async(
&mut self,
navigation_polygon: impl AsObjectArg<NavigationPolygon>,
source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>,
)
pub fn bake_from_source_geometry_data_async( &mut self, navigation_polygon: impl AsObjectArg<NavigationPolygon>, source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>, )
To set the default parameters, use Self::bake_from_source_geometry_data_async_ex
and its builder methods. See the book for detailed usage instructions.
pub fn bake_from_source_geometry_data_async_ex<'a>( &'a mut self, navigation_polygon: impl AsObjectArg<NavigationPolygon>, source_geometry_data: impl AsObjectArg<NavigationMeshSourceGeometryData2D>, ) -> ExBakeFromSourceGeometryDataAsync<'a>
pub fn source_geometry_parser_create(&mut self) -> Rid
pub fn source_geometry_parser_set_callback( &mut self, parser: Rid, callback: &Callable, )
pub fn simplify_path( &mut self, path: &PackedVector2Array, epsilon: f32, ) -> PackedVector2Array
pub fn free_rid(&mut self, rid: Rid)
pub fn set_debug_enabled(&mut self, enabled: bool)
pub fn get_debug_enabled(&self) -> bool
Methods from Deref<Target = Object>§
pub fn get_class(&self) -> GString
pub fn is_class(&self, class: impl AsArg<GString>) -> bool
pub fn set(&mut self, property: impl AsArg<StringName>, value: &Variant)
pub fn get(&self, property: impl AsArg<StringName>) -> Variant
pub fn set_indexed( &mut self, property_path: impl AsArg<NodePath>, value: &Variant, )
pub fn get_indexed(&self, property_path: impl AsArg<NodePath>) -> Variant
pub fn get_property_list(&self) -> Array<Dictionary>
pub fn get_method_list(&self) -> Array<Dictionary>
pub fn property_can_revert(&self, property: impl AsArg<StringName>) -> bool
pub fn property_get_revert(&self, property: impl AsArg<StringName>) -> Variant
pub fn set_script(&mut self, script: &Variant)
pub fn get_script(&self) -> Variant
pub fn set_meta(&mut self, name: impl AsArg<StringName>, value: &Variant)
pub fn remove_meta(&mut self, name: impl AsArg<StringName>)
pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant
pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant
To set the default parameters, use Self::get_meta_ex
and its builder methods. See the book for detailed usage instructions.
pub fn get_meta_ex<'a>( &'a self, name: impl AsArg<StringName> + 'a, ) -> ExGetMeta<'a>
pub fn has_meta(&self, name: impl AsArg<StringName>) -> bool
pub fn get_meta_list(&self) -> Array<StringName>
pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)
pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)
To set the default parameters, use Self::add_user_signal_ex
and its builder methods. See the book for detailed usage instructions.
pub fn add_user_signal_ex<'a>( &'a mut self, signal: impl AsArg<GString> + 'a, ) -> ExAddUserSignal<'a>
pub fn has_user_signal(&self, signal: impl AsArg<StringName>) -> bool
pub fn remove_user_signal(&mut self, signal: impl AsArg<StringName>)
pub fn emit_signal(
&mut self,
signal: impl AsArg<StringName>,
varargs: &[Variant],
) -> Error
pub fn emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Error
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant
.
It can detect call failures and will panic in such a case.
pub fn try_emit_signal(
&mut self,
signal: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Error, CallError>
pub fn try_emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant
.
It can detect call failures and will return Err
in such a case.
pub fn call(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Variant
pub fn call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant
.
It can detect call failures and will panic in such a case.
pub fn try_call(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Variant, CallError>
pub fn try_call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant
.
It can detect call failures and will return Err
in such a case.
pub fn call_deferred(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Variant
pub fn call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant
.
It can detect call failures and will panic in such a case.
pub fn try_call_deferred(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Variant, CallError>
pub fn try_call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant
.
It can detect call failures and will return Err
in such a case.
pub fn set_deferred( &mut self, property: impl AsArg<StringName>, value: &Variant, )
pub fn callv( &mut self, method: impl AsArg<StringName>, arg_array: &Array<Variant>, ) -> Variant
pub fn has_method(&self, method: impl AsArg<StringName>) -> bool
pub fn get_method_argument_count(&self, method: impl AsArg<StringName>) -> i32
pub fn has_signal(&self, signal: impl AsArg<StringName>) -> bool
pub fn get_signal_list(&self) -> Array<Dictionary>
pub fn get_signal_connection_list( &self, signal: impl AsArg<StringName>, ) -> Array<Dictionary>
pub fn get_incoming_connections(&self) -> Array<Dictionary>
pub fn connect(
&mut self,
signal: impl AsArg<StringName>,
callable: &Callable,
) -> Error
pub fn connect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, ) -> Error
To set the default parameters, use Self::connect_ex
and its builder methods. See the book for detailed usage instructions.
pub fn connect_ex<'a>( &'a mut self, signal: impl AsArg<StringName> + 'a, callable: &'a Callable, ) -> ExConnect<'a>
pub fn disconnect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, )
pub fn is_connected( &self, signal: impl AsArg<StringName>, callable: &Callable, ) -> bool
pub fn set_block_signals(&mut self, enable: bool)
pub fn is_blocking_signals(&self) -> bool
pub fn notify_property_list_changed(&mut self)
pub fn set_message_translation(&mut self, enable: bool)
pub fn can_translate_messages(&self) -> bool
pub fn tr(&self, message: impl AsArg<StringName>) -> GString
pub fn tr(&self, message: impl AsArg<StringName>) -> GString
To set the default parameters, use Self::tr_ex
and its builder methods. See the book for detailed usage instructions.
pub fn tr_ex<'a>(&'a self, message: impl AsArg<StringName> + 'a) -> ExTr<'a>
pub fn tr_n(
&self,
message: impl AsArg<StringName>,
plural_message: impl AsArg<StringName>,
n: i32,
) -> GString
pub fn tr_n( &self, message: impl AsArg<StringName>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString
To set the default parameters, use Self::tr_n_ex
and its builder methods. See the book for detailed usage instructions.
pub fn tr_n_ex<'a>( &'a self, message: impl AsArg<StringName> + 'a, plural_message: impl AsArg<StringName> + 'a, n: i32, ) -> ExTrN<'a>
pub fn is_queued_for_deletion(&self) -> bool
pub fn cancel_free(&mut self)
pub fn notify(&mut self, what: ObjectNotification)
pub fn notify(&mut self, what: ObjectNotification)
⚠️ Sends a Godot notification to all classes inherited by the object.
Triggers calls to on_notification()
, and depending on the notification, also to Godot’s lifecycle callbacks such as ready()
.
Starts from the highest ancestor (the Object
class) and goes down the hierarchy.
See also Godot docs for Object::notification()
.
§Panics
If you call this method on a user-defined object while holding a GdRef
or GdMut
guard on the instance, you will encounter
a panic. The reason is that the receiving virtual method on_notification()
acquires a GdMut
lock dynamically, which must
be exclusive.
pub fn notify_reversed(&mut self, what: ObjectNotification)
pub fn notify_reversed(&mut self, what: ObjectNotification)
⚠️ Like Self::notify()
, but starts at the most-derived class and goes up the hierarchy.
See docs of that method, including the panics.