diff --git a/simulation/src/wildlife/bird.rs b/simulation/src/wildlife/bird.rs index b3107098..878e71fa 100644 --- a/simulation/src/wildlife/bird.rs +++ b/simulation/src/wildlife/bird.rs @@ -9,6 +9,7 @@ use geom::angle_lerpxy; use geom::AABB; use geom::{Transform, Vec3}; +/// spawns a bird in the world pub fn spawn_bird(sim: &mut Simulation, spawn_pos: Vec3) -> Option { profiling::scope!("spawn_bird"); @@ -22,8 +23,9 @@ pub fn spawn_bird(sim: &mut Simulation, spawn_pos: Vec3) -> Option { Some(id) } +/// Update the movement of each bird in the world pub fn bird_decision_system(world: &mut World, resources: &mut Resources) { - profiling::scope!("wildlife::animal_decision_system"); + profiling::scope!("wildlife::bird_decision_system"); let ra = &*resources.read::(); let map = &*resources.read::(); @@ -60,7 +62,7 @@ pub fn bird_decision_system(world: &mut World, resources: &mut Resources) { }); } -/// Update the speed, position, and direction of a bird +/// Update the speed, position, and direction of a bird using the boids algorithm pub fn bird_decision( time: &GameTime, trans: &mut Transform, @@ -141,7 +143,7 @@ fn bounds_adjustment(trans: &Transform, aabb: AABB) -> Vec3 { const MAX_Z: f32 = 200.0; const TURN_AMOUNT: f32 = 1.0; let mut v = Vec3::new(0.0, 0.0, 0.0); - // TODO: the ground might not be at 0 + // TODO: the ground might not be at z: 0 if trans.position.z < MARGIN { v.z += TURN_AMOUNT; } diff --git a/simulation/src/wildlife/mod.rs b/simulation/src/wildlife/mod.rs index b83759c7..67725f34 100644 --- a/simulation/src/wildlife/mod.rs +++ b/simulation/src/wildlife/mod.rs @@ -32,7 +32,7 @@ const NUM_FLOCKS: u32 = 20; const BIRDS_PER_FLOCK: u32 = 50; const SPAWN_RANGE: f32 = 5.0; // how spread out birds in the flock should be initially -/// HACK (for now): spawns birds in random clusters around the map +/// spawns birds in random clusters around the map pub(crate) fn add_flocks_randomly(sim: &mut Simulation) { profiling::scope!("wildlife::add_flocks_randomly");