1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
//! Navigation mesh pathfinding.
//!
//! Provides AI navigation using pre-computed walkable surfaces:
//!
//! - [`NavMeshAgent`]: Component for entities that navigate via navmesh
//! - [`NavMeshAgentState`]: Agent state machine (Idle, Moving, Arrived, etc.)
//! - [`PathRequest`]: Async pathfinding request
//! - [`find_path_with_algorithm`]: Compute a path between two points
//! - `generate_navmesh_recast`: Generate navmesh from geometry (requires `navmesh` feature)
//!
//! Navigation meshes are triangle meshes representing walkable areas. Pathfinding
//! uses A* with funnel smoothing for natural-looking paths.
//!
//! # Generating a NavMesh (Recast)
//!
//! Generate a navmesh from terrain or level geometry (requires `navmesh` feature):
//!
//! ```ignore
//! let config = RecastNavMeshConfig {
//! cell_size: 0.3, // XZ voxel size (smaller = more precise)
//! cell_height: 0.2, // Y voxel size
//! agent_height: 2.0, // Character height
//! agent_radius: 0.5, // Character radius
//! agent_max_climb: 0.5, // Max step height
//! agent_max_slope: 45.0, // Max walkable slope (degrees)
//! ..Default::default()
//! };
//!
//! generate_navmesh_recast(world, terrain_entity, config);
//! ```
//!
//! # Spawning NavMesh Agents
//!
//! ```ignore
//! let agent = spawn_navmesh_agent(world, Vec3::new(0.0, 0.0, 0.0), "Enemy".to_string());
//! set_agent_speed(world, agent, 3.0); // Units per second
//! ```
//!
//! # Setting Destinations
//!
//! ```ignore
//! // Move agent to target position
//! set_agent_destination(world, agent, Vec3::new(10.0, 0.0, 5.0));
//!
//! // Stop agent
//! stop_agent(world, agent);
//! ```
//!
//! # Checking Agent State
//!
//! ```ignore
//! match get_agent_state(world, agent) {
//! NavMeshAgentState::Idle => { /* Standing still */ }
//! NavMeshAgentState::Moving => { /* Walking to destination */ }
//! NavMeshAgentState::Arrived => { /* Reached destination */ }
//! NavMeshAgentState::NoPath => { /* No valid path found */ }
//! }
//! ```
//!
//! # Running the System
//!
//! Call each frame to update agent movement:
//!
//! ```ignore
//! fn run_systems(&mut self, world: &mut World) {
//! run_navmesh_systems(world);
//! }
//! ```
//!
//! # Debug Visualization
//!
//! ```ignore
//! set_navmesh_debug_draw(world, true); // Show navmesh triangles and agent paths
//! ```
//!
//! # Sampling Navmesh Height
//!
//! Get the walkable height at a world position:
//!
//! ```ignore
//! if let Some(height) = sample_navmesh_height(world, x, z) {
//! let ground_pos = Vec3::new(x, height, z);
//! }
//! ```
//!
//! # RecastNavMeshConfig Parameters
//!
//! | Parameter | Description |
//! |-----------|-------------|
//! | `cell_size` | XZ resolution (0.1-0.5, smaller = more accurate) |
//! | `cell_height` | Y resolution (0.1-0.3) |
//! | `agent_height` | Character height for clearance |
//! | `agent_radius` | Character radius for obstacle avoidance |
//! | `agent_max_climb` | Maximum step height |
//! | `agent_max_slope` | Maximum walkable slope in degrees |
//! | `region_min_size` | Minimum region area (filters noise) |
//! | `region_merge_size` | Region merge threshold |
//!
//! [`NavMeshAgent`]: components::NavMeshAgent
//! [`NavMeshAgentState`]: components::NavMeshAgentState
//! [`PathRequest`]: pathfinding::PathRequest
//! [`find_path_with_algorithm`]: pathfinding::find_path_with_algorithm
pub use *;
pub use *;
pub use ;
pub use ;
pub use *;
pub use run_navmesh_systems;