diff --git a/crates/bevy_landmass/README.md b/crates/bevy_landmass/README.md index 2680dc9..fecf3a9 100644 --- a/crates/bevy_landmass/README.md +++ b/crates/bevy_landmass/README.md @@ -45,8 +45,9 @@ fn set_up_scene( mut commands: Commands, mut nav_meshes: ResMut>, ) { - let archipelago_id = - commands.spawn(Archipelago2d::new(AgentOptions::default())).id(); + let archipelago_id = commands + .spawn(Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh_handle = nav_meshes.reserve_handle(); diff --git a/crates/bevy_landmass/example/main.rs b/crates/bevy_landmass/example/main.rs index 3087710..a70707f 100644 --- a/crates/bevy_landmass/example/main.rs +++ b/crates/bevy_landmass/example/main.rs @@ -120,7 +120,8 @@ fn setup( })), )); - let mut archipelago = Archipelago2d::new(AgentOptions::default()); + let mut archipelago = + Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5)); let slow_node_type = archipelago.add_node_type(1000.0).unwrap(); let archipelago_entity = commands.spawn(archipelago).id(); diff --git a/crates/bevy_landmass/src/lib_test.rs b/crates/bevy_landmass/src/lib_test.rs index 2a95983..92ca4d4 100644 --- a/crates/bevy_landmass/src/lib_test.rs +++ b/crates/bevy_landmass/src/lib_test.rs @@ -22,8 +22,10 @@ fn computes_path_for_agent_and_updates_desired_velocity() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass3dPlugin::default()); - let archipelago_id = - app.world_mut().spawn(Archipelago3d::new(AgentOptions::default())).id(); + let archipelago_id = app + .world_mut() + .spawn(Archipelago3d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh = Arc::new( NavigationMesh3d { @@ -109,8 +111,10 @@ fn adds_and_removes_agents() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass3dPlugin::default()); - let archipelago_id = - app.world_mut().spawn(Archipelago3d::new(AgentOptions::default())).id(); + let archipelago_id = app + .world_mut() + .spawn(Archipelago3d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let agent_id_1 = app .world_mut() @@ -220,8 +224,10 @@ fn adds_and_removes_characters() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass3dPlugin::default()); - let archipelago_id = - app.world_mut().spawn(Archipelago3d::new(AgentOptions::default())).id(); + let archipelago_id = app + .world_mut() + .spawn(Archipelago3d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let character_id_1 = app .world_mut() @@ -319,8 +325,10 @@ fn adds_and_removes_islands() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass3dPlugin::default()); - let archipelago_id = - app.world_mut().spawn(Archipelago3d::new(AgentOptions::default())).id(); + let archipelago_id = app + .world_mut() + .spawn(Archipelago3d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh = app.world_mut().resource_mut::>().add(NavMesh3d { @@ -449,8 +457,10 @@ fn changing_agent_fields_changes_landmass_agent() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass3dPlugin::default()); - let archipelago = - app.world_mut().spawn(Archipelago3d::new(AgentOptions::default())).id(); + let archipelago = app + .world_mut() + .spawn(Archipelago3d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let agent = app .world_mut() @@ -535,8 +545,10 @@ fn changing_character_fields_changes_landmass_character() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass3dPlugin::default()); - let archipelago = - app.world_mut().spawn(Archipelago3d::new(AgentOptions::default())).id(); + let archipelago = app + .world_mut() + .spawn(Archipelago3d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let character = app .world_mut() @@ -596,7 +608,8 @@ fn node_type_costs_are_used() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass2dPlugin::default()); - let mut archipelago = Archipelago2d::new(AgentOptions::default()); + let mut archipelago = + Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5)); let slow_node_type = archipelago.add_node_type(10.0).unwrap(); let archipelago_id = app.world_mut().spawn(archipelago).id(); @@ -714,7 +727,8 @@ fn overridden_node_type_costs_are_used() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass2dPlugin::default()); - let mut archipelago = Archipelago2d::new(AgentOptions::default()); + let mut archipelago = + Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5)); let slow_node_type = archipelago.add_node_type(1.0).unwrap(); let archipelago_id = app.world_mut().spawn(archipelago).id(); @@ -837,8 +851,10 @@ fn sample_point_error_on_out_of_range() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass2dPlugin::default()); - let archipelago_entity = - app.world_mut().spawn(Archipelago2d::new(AgentOptions::default())).id(); + let archipelago_entity = app + .world_mut() + .spawn(Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh = Arc::new( NavigationMesh { @@ -890,8 +906,10 @@ fn samples_point_on_nav_mesh_or_near_nav_mesh() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass2dPlugin::default()); - let archipelago_entity = - app.world_mut().spawn(Archipelago2d::new(AgentOptions::default())).id(); + let archipelago_entity = app + .world_mut() + .spawn(Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh = Arc::new( NavigationMesh { @@ -973,7 +991,8 @@ fn samples_node_types() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass2dPlugin::default()); - let mut archipelago = Archipelago2d::new(AgentOptions::default()); + let mut archipelago = + Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5)); let node_type = archipelago.add_node_type(2.0).unwrap(); let archipelago_entity = app.world_mut().spawn(archipelago).id(); @@ -1048,8 +1067,10 @@ fn finds_path() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass2dPlugin::default()); - let archipelago_entity = - app.world_mut().spawn(Archipelago2d::new(AgentOptions::default())).id(); + let archipelago_entity = app + .world_mut() + .spawn(Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh = Arc::new( NavigationMesh { @@ -1125,8 +1146,10 @@ fn island_matches_rotation_3d() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass3dPlugin::default()); - let archipelago_entity = - app.world_mut().spawn(Archipelago3d::new(AgentOptions::default())).id(); + let archipelago_entity = app + .world_mut() + .spawn(Archipelago3d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh = Arc::new( NavigationMesh { @@ -1184,8 +1207,10 @@ fn island_matches_rotation_2d() { .add_plugins(AssetPlugin::default()) .add_plugins(Landmass2dPlugin::default()); - let archipelago_entity = - app.world_mut().spawn(Archipelago2d::new(AgentOptions::default())).id(); + let archipelago_entity = app + .world_mut() + .spawn(Archipelago2d::new(AgentOptions::default_for_agent_radius(0.5))) + .id(); let nav_mesh = Arc::new( NavigationMesh { diff --git a/crates/landmass/README.md b/crates/landmass/README.md index bb84601..06134f2 100644 --- a/crates/landmass/README.md +++ b/crates/landmass/README.md @@ -54,7 +54,8 @@ use glam::Vec3; use landmass::*; use std::{sync::Arc, collections::HashMap}; -let mut archipelago = Archipelago::::new(AgentOptions::default()); +let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = NavigationMesh { vertices: vec![ diff --git a/crates/landmass/src/agent_test.rs b/crates/landmass/src/agent_test.rs index 430d427..5b7de9a 100644 --- a/crates/landmass/src/agent_test.rs +++ b/crates/landmass/src/agent_test.rs @@ -93,7 +93,8 @@ fn has_reached_target_at_end_node() { .expect("nav mesh is valid"); let transform = Transform { translation: Vec3::new(2.0, 3.0, 4.0), rotation: PI * 0.85 }; - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id = archipelago.add_island(Island::new( transform.clone(), Arc::new(nav_mesh), @@ -170,7 +171,8 @@ fn long_detour_reaches_target_in_different_ways() { let transform = Transform { translation: Vec3::new(2.0, 4.0, 3.0), rotation: PI * -0.85 }; - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id = archipelago.add_island(Island::new( transform.clone(), Arc::new(nav_mesh), diff --git a/crates/landmass/src/avoidance_test.rs b/crates/landmass/src/avoidance_test.rs index 048e503..0e0d247 100644 --- a/crates/landmass/src/avoidance_test.rs +++ b/crates/landmass/src/avoidance_test.rs @@ -467,7 +467,10 @@ fn applies_no_avoidance_for_far_agents() { /* characters= */ &HopSlotMap::with_key(), /* character_id_to_nav_mesh_point= */ &HashMap::new(), &nav_data, - &AgentOptions { neighbourhood: 5.0, ..Default::default() }, + &AgentOptions { + neighbourhood: 5.0, + ..AgentOptions::default_for_agent_radius(0.5) + }, /* delta_time= */ 0.01, ); @@ -556,7 +559,7 @@ fn applies_avoidance_for_two_agents() { &AgentOptions { neighbourhood: 15.0, avoidance_time_horizon: 15.0, - ..Default::default() + ..AgentOptions::default_for_agent_radius(0.5) }, /* delta_time= */ 0.01, ); @@ -642,7 +645,7 @@ fn agent_avoids_character() { &AgentOptions { neighbourhood: 15.0, avoidance_time_horizon: 15.0, - ..Default::default() + ..AgentOptions::default_for_agent_radius(0.5) }, /* delta_time= */ 0.01, ); @@ -715,7 +718,7 @@ fn agent_speeds_up_to_avoid_character() { &AgentOptions { neighbourhood: 15.0, avoidance_time_horizon: 15.0, - ..Default::default() + ..AgentOptions::default_for_agent_radius(0.5) }, /* delta_time= */ 0.01, ); @@ -745,7 +748,7 @@ fn agent_speeds_up_to_avoid_character() { &AgentOptions { neighbourhood: 15.0, avoidance_time_horizon: 15.0, - ..Default::default() + ..AgentOptions::default_for_agent_radius(0.5) }, /* delta_time= */ 0.01, ); @@ -762,7 +765,8 @@ fn agent_speeds_up_to_avoid_character() { #[test] fn reached_target_agent_has_different_avoidance() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { diff --git a/crates/landmass/src/debug_test.rs b/crates/landmass/src/debug_test.rs index d217b90..e3b29da 100644 --- a/crates/landmass/src/debug_test.rs +++ b/crates/landmass/src/debug_test.rs @@ -94,7 +94,8 @@ fn draws_island_meshes_and_agents() { .validate() .expect("Mesh is valid."); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); const TRANSLATION: Vec3 = Vec3::ONE; archipelago.add_island(Island::new( Transform { translation: TRANSLATION, rotation: 0.0 }, @@ -429,7 +430,8 @@ fn draws_boundary_links() { .expect("The mesh is valid."), ); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); archipelago.add_island(Island::new( Transform::default(), nav_mesh.clone(), @@ -479,7 +481,8 @@ fn fails_to_draw_dirty_archipelago() { let mut fake_drawer = FakeDrawer::new(); // A brand new archipelago is considered clean. - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); assert_eq!(draw_archipelago_debug(&archipelago, &mut fake_drawer), Ok(())); // Creating an island marks the nav data as dirty. diff --git a/crates/landmass/src/lib.rs b/crates/landmass/src/lib.rs index 8d0b86c..5aa313d 100644 --- a/crates/landmass/src/lib.rs +++ b/crates/landmass/src/lib.rs @@ -65,11 +65,13 @@ pub struct AgentOptions { pub reached_destination_avoidance_responsibility: f32, } -impl Default for AgentOptions { - fn default() -> Self { +impl AgentOptions { + /// Creates a default set of options for a given agent radius. This is an easy + /// starting point for settings that can be overridden as needed. + pub fn default_for_agent_radius(radius: f32) -> Self { Self { - node_sample_distance: 0.1, - neighbourhood: 5.0, + node_sample_distance: 0.2 * radius, + neighbourhood: 10.0 * radius, avoidance_time_horizon: 1.0, obstacle_avoidance_time_horizon: 0.5, reached_destination_avoidance_responsibility: 0.1, diff --git a/crates/landmass/src/lib_test.rs b/crates/landmass/src/lib_test.rs index 6c0f3d6..e10ff40 100644 --- a/crates/landmass/src/lib_test.rs +++ b/crates/landmass/src/lib_test.rs @@ -10,7 +10,8 @@ use crate::{ #[test] fn add_and_remove_agents() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let agent_1 = archipelago.add_agent(Agent::create( /* position= */ Vec3::ZERO, @@ -83,7 +84,8 @@ fn add_and_remove_agents() { #[test] fn add_and_remove_characters() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let character_1 = archipelago.add_character(Character { radius: 1.0, ..Default::default() }); @@ -141,7 +143,8 @@ fn add_and_remove_characters() { #[test] fn computes_and_follows_path() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = NavigationMesh { vertices: vec![ Vec3::new(1.0, 1.0, 1.0), @@ -392,7 +395,8 @@ fn computes_and_follows_path() { #[test] fn agent_speeds_up_to_avoid_character() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); archipelago.agent_options.avoidance_time_horizon = 100.0; archipelago.agent_options.neighbourhood = 10.0; @@ -457,7 +461,8 @@ fn agent_speeds_up_to_avoid_character() { #[test] fn add_and_remove_islands() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { vertices: vec![], @@ -504,7 +509,8 @@ fn add_and_remove_islands() { #[test] fn changed_island_is_not_dirty_after_update() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id = archipelago.add_island(Island::new( Transform::default(), @@ -540,7 +546,8 @@ fn changed_island_is_not_dirty_after_update() { #[test] fn samples_point() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -596,7 +603,8 @@ fn samples_point() { #[test] fn finds_path() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -649,7 +657,8 @@ fn finds_path() { #[test] fn agent_overrides_node_costs() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { diff --git a/crates/landmass/src/nav_data_test.rs b/crates/landmass/src/nav_data_test.rs index 8bb1d18..5ac9feb 100644 --- a/crates/landmass/src/nav_data_test.rs +++ b/crates/landmass/src/nav_data_test.rs @@ -964,7 +964,8 @@ fn empty_navigation_mesh_is_safe() { #[test] fn error_on_create_zero_or_negative_node_type() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); assert_eq!( archipelago.add_node_type(0.0), Err(NewNodeTypeError::NonPositiveCost(0.0)) @@ -977,7 +978,8 @@ fn error_on_create_zero_or_negative_node_type() { #[test] fn false_on_setting_zero_or_negative_node_type() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let node_type = archipelago.add_node_type(1.0).unwrap(); @@ -993,7 +995,8 @@ fn false_on_setting_zero_or_negative_node_type() { #[test] fn cannot_remove_used_node_type() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let node_type_1 = archipelago.add_node_type(2.0).unwrap(); let node_type_2 = archipelago.add_node_type(3.0).unwrap(); @@ -1068,7 +1071,8 @@ fn cannot_remove_used_node_type() { #[test] #[should_panic] fn panics_on_invalid_node_type() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let deleted_node_type = archipelago.add_node_type(2.0).unwrap(); assert!(archipelago.remove_node_type(deleted_node_type)); diff --git a/crates/landmass/src/path_test.rs b/crates/landmass/src/path_test.rs index 8c14d9c..5c20892 100644 --- a/crates/landmass/src/path_test.rs +++ b/crates/landmass/src/path_test.rs @@ -72,7 +72,8 @@ fn finds_next_point_for_organic_map() { let transform = Transform { translation: Vec3::new(5.0, 9.0, 7.0), rotation: PI * -0.35 }; - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id = archipelago.add_island(Island::new( transform.clone(), Arc::new(nav_mesh), @@ -178,7 +179,8 @@ fn finds_next_point_in_zig_zag() { let transform = Transform { translation: Vec2::new(-1.0, -3.0), rotation: PI * -1.8 }; - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id = archipelago.add_island(Island::new( transform.clone(), Arc::new(nav_mesh), @@ -252,7 +254,8 @@ fn starts_at_end_index_goes_to_end_point() { .validate() .expect("Mesh is valid."); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id = archipelago.add_island(Island::new( Transform { translation: Vec3::ZERO, rotation: 0.0 }, Arc::new(nav_mesh), diff --git a/crates/landmass/src/pathfinding_test.rs b/crates/landmass/src/pathfinding_test.rs index 1dd7bbc..70da0f0 100644 --- a/crates/landmass/src/pathfinding_test.rs +++ b/crates/landmass/src/pathfinding_test.rs @@ -43,7 +43,8 @@ fn finds_path_in_archipelago() { .validate() .expect("Mesh is valid."); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id = archipelago.add_island(Island::new( Transform { translation: Vec3::ZERO, rotation: 0.0 }, Arc::new(nav_mesh), @@ -142,7 +143,8 @@ fn finds_paths_on_two_islands() { .expect("Mesh is valid."); let nav_mesh = Arc::new(nav_mesh); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id_1 = archipelago.add_island(Island::new( Transform { translation: Vec3::ZERO, rotation: 0.0 }, Arc::clone(&nav_mesh), @@ -228,7 +230,8 @@ fn no_path_between_disconnected_islands() { .expect("Mesh is valid."); let nav_mesh = Arc::new(nav_mesh); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id_1 = archipelago.add_island(Island::new( Transform { translation: Vec3::ZERO, rotation: 0.0 }, Arc::clone(&nav_mesh), @@ -279,7 +282,8 @@ fn find_path_across_connected_islands() { .expect("Mesh is valid."), ); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id_1 = archipelago.add_island(Island::new( Transform { rotation: 0.0, translation: Vec3::ZERO }, @@ -405,7 +409,8 @@ fn finds_path_across_different_islands() { .expect("Mesh is valid."), ); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id_1 = archipelago.add_island(Island::new( Transform { rotation: 0.0, translation: Vec3::ZERO }, @@ -479,7 +484,8 @@ fn aborts_early_for_unconnected_regions() { .expect("Mesh is valid."), ); - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let island_id_1 = archipelago.add_island(Island::new( Transform { translation: Vec3::ZERO, rotation: 0.0 }, @@ -527,7 +533,8 @@ fn aborts_early_for_unconnected_regions() { #[test] fn detour_for_high_cost_path() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -605,7 +612,8 @@ fn detour_for_high_cost_path() { #[test] fn detour_for_high_cost_path_across_boundary_links() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh_1 = Arc::new( NavigationMesh { @@ -713,7 +721,8 @@ fn detour_for_high_cost_path_across_boundary_links() { #[test] fn fast_path_not_ignored_by_heuristic() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -793,7 +802,8 @@ fn fast_path_not_ignored_by_heuristic() { #[test] fn infinite_or_nan_cost_cannot_find_path() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -847,7 +857,8 @@ fn infinite_or_nan_cost_cannot_find_path() { #[test] fn detour_for_overridden_high_cost_path() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { diff --git a/crates/landmass/src/query_test.rs b/crates/landmass/src/query_test.rs index 9d8ee51..c9a260f 100644 --- a/crates/landmass/src/query_test.rs +++ b/crates/landmass/src/query_test.rs @@ -11,7 +11,8 @@ use super::{find_path, sample_point}; #[test] fn error_on_dirty_nav_mesh() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -46,7 +47,8 @@ fn error_on_dirty_nav_mesh() { #[test] fn error_on_out_of_range() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -83,7 +85,8 @@ fn error_on_out_of_range() { #[test] fn samples_point_on_nav_mesh_or_near_nav_mesh() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -139,7 +142,8 @@ fn samples_point_on_nav_mesh_or_near_nav_mesh() { #[test] fn samples_node_types() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let node_type_1 = archipelago.add_node_type(1.0).unwrap(); let node_type_2 = archipelago.add_node_type(2.0).unwrap(); @@ -219,7 +223,8 @@ fn samples_node_types() { #[test] fn no_path() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -263,7 +268,8 @@ fn no_path() { #[test] fn finds_path() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -316,7 +322,8 @@ fn finds_path() { #[test] fn finds_path_with_override_node_types() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh { @@ -407,7 +414,8 @@ fn finds_path_with_override_node_types() { #[test] fn find_path_returns_error_on_invalid_node_cost() { - let mut archipelago = Archipelago::::new(AgentOptions::default()); + let mut archipelago = + Archipelago::::new(AgentOptions::default_for_agent_radius(0.5)); let nav_mesh = Arc::new( NavigationMesh {