Skip to content

Commit 8886a5a

Browse files
committed
fix: remove unused function
1 parent 94c1ae5 commit 8886a5a

File tree

2 files changed

+6
-63
lines changed

2 files changed

+6
-63
lines changed

src/enemy/spawn/mod.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
use crate::{
22
character_controller::{
33
CHARACTER_CAPSULE_LENGTH, CHARACTER_CAPSULE_RADIUS, Grounded,
4-
<<<<<<< HEAD
54
LOCAL_FEET_CHARACTER, RUN_VELOCITY, WALK_VELOCITY,
6-
=======
7-
RUN_VELOCITY, WALK_VELOCITY,
8-
>>>>>>> master
95
},
106
enemy::{
117
animate::ENEMY_MODEL_PATH,
@@ -194,7 +190,7 @@ fn handle_spawn_enemies_at_enemy_spawn_locations_message(
194190
settings: AgentSettings {
195191
desired_speed: WALK_VELOCITY,
196192
max_speed: RUN_VELOCITY,
197-
radius: 2.0,
193+
radius: ENEMY_AGENT_RADIUS,
198194
},
199195
},
200196
AgentTarget3d::None,

src/nav_mesh_pathfinding/mod.rs

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
use avian_rerecast::AvianBackendPlugin;
2-
use avian3d::prelude::*;
32
use bevy::prelude::*;
4-
use bevy_landmass::{Agent3d, debug::Landmass3dDebugPlugin, prelude::*};
3+
use bevy_landmass::{debug::Landmass3dDebugPlugin, prelude::*};
54
use bevy_rerecast::{debug::DetailNavmeshGizmo, prelude::*};
65
use landmass_rerecast::{
76
Island3dBundle, LandmassRerecastPlugin, NavMeshHandle3d,
87
};
98

109
use crate::{
11-
character_controller::MAX_SLOPE_ANGLE,
12-
character_controller::MAX_SLOPE_ANGLE,
13-
enemy::{Enemy, spawn::AgentEnemyEntityPointer},
14-
game_flow::states::GameLoadingState,
15-
game_flow::states::GameLoadingState,
10+
character_controller::MAX_SLOPE_ANGLE, game_flow::states::GameLoadingState,
1611
};
1712

18-
pub const ENEMY_AGENT_RADIUS: f32 = 0.3;
13+
pub const ENEMY_AGENT_RADIUS: f32 = 0.4;
1914

2015
pub struct NavMeshPathfindingPlugin;
2116

@@ -30,7 +25,7 @@ impl Plugin for NavMeshPathfindingPlugin {
3025
OnEnter(GameLoadingState::CollidersReady),
3126
generate_navmesh_when_map_colliders_ready,
3227
);
33-
app.add_systems(Update, (update_agent_velocity, snap_agent_to_floor));
28+
app.add_systems(Update, update_agent_velocity);
3429
}
3530
}
3631

@@ -62,7 +57,7 @@ fn generate_navmesh_when_map_colliders_ready(
6257
commands.insert_resource(ArchipelagoRef(archipelago_id));
6358

6459
let navmesh = generator.generate(NavmeshSettings {
65-
agent_radius: ENEMY_AGENT_RADIUS,
60+
agent_radius: 0.3,
6661
// this is pretty important, so the agent doesnt try to climb some very high ledge
6762
walkable_climb: 0.25,
6863
walkable_slope_angle: MAX_SLOPE_ANGLE,
@@ -96,51 +91,3 @@ fn update_agent_velocity(
9691
agent_velocity.velocity = desired_velocity.velocity();
9792
}
9893
}
99-
100-
// FIXME: dont need this anymore
101-
fn snap_agent_to_floor(
102-
query: Query<
103-
(Entity, &Transform, &mut LinearVelocity, &ShapeHits),
104-
With<Enemy>,
105-
>,
106-
time: Res<Time>,
107-
spatial_query: SpatialQuery,
108-
) {
109-
for (enemy_entity, enemy_transform, mut enemy_velocity, shape_hits) in query
110-
{
111-
let Some(first_hit) = shape_hits.0.get(0) else {
112-
info!("snap_agent_to_floor: No hits down found");
113-
continue;
114-
};
115-
info!("first_hit: {:?}", first_hit);
116-
117-
// let hit_down_point =
118-
// ray_down_origin + ray_down_direction * hit_down.distance;
119-
// let hit_down_y = hit_down_point.y;
120-
// let enemy_y = enemy_transform.translation.y;
121-
// let difference_y = hit_down_y - enemy_y;
122-
// if difference_y.abs() < 0.3 {
123-
// info!("Snapping enemy to slope");
124-
// enemy_velocity.y = difference_y / time.delta_secs();
125-
// } else {
126-
// info!(
127-
// "Not snapping enemy, difference between hit down and player \
128-
// too large"
129-
// );
130-
// }
131-
// let ray_down_origin = enemy_transform.translation + Vec3::Y * 0.5;
132-
// let ray_down_direction = Dir3::NEG_Y;
133-
// let max_down_distance = 1.0;
134-
//
135-
// if let Some(hit_down) = spatial_query.cast_ray(
136-
// ray_down_origin,
137-
// ray_down_direction,
138-
// max_down_distance,
139-
// true,
140-
// &SpatialQueryFilter::default()
141-
// .with_excluded_entities([enemy_entity]),
142-
// ) {
143-
// } else {
144-
// }
145-
}
146-
}

0 commit comments

Comments
 (0)