Skip to content

Commit

Permalink
remove navmesh
Browse files Browse the repository at this point in the history
  • Loading branch information
aratama committed Feb 11, 2025
1 parent 26bd740 commit 93f195c
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 363 deletions.
177 changes: 0 additions & 177 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ serde_json = "1.0.138"
strum = "0.26.3"
thiserror = "2.0.11"
uuid = { version = "1.12.1", features = ["js"] }
vleue_navigator = "0.11.1"

[target.'cfg(target_arch = "x86_64")'.dependencies]
bevy_remote_inspector = "0.1.0"
Expand Down
18 changes: 0 additions & 18 deletions src/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ use serde::Deserialize;
use serde::Serialize;
use std::f32::consts::PI;
use uuid::Uuid;
use vleue_navigator::prelude::PrimitiveObstacle;
use witch::WitchWandSprite;

/// アクターの種類を表します
Expand Down Expand Up @@ -327,8 +326,6 @@ impl Actor {
pub fn get_total_scale_factor(&self) -> f32 {
let mut scale_factor: f32 = -1.0;

// todo

for wand in self.wands.iter() {
for slot in &wand.slots {
scale_factor += match slot {
Expand Down Expand Up @@ -1290,21 +1287,6 @@ pub fn spawn_actor(
},
));

// ナビメッシュの再構築は重いため、本棚のような固定のアクターのみ PrimitiveObstacle を設定します
// アクターが破壊されるとナビメッシュを再計算します
if actor_group == ActorGroup::Entity && props.body_type == BodyType::Fixed {
let scale = 1.0;
builder.insert(match props.collider {
ActorCollider::Ball(radius) => {
(PrimitiveObstacle::Circle(Circle::new(radius * scale)),)
}
ActorCollider::Cuboid(width, height) => (PrimitiveObstacle::Rectangle(Rectangle::new(
width * 2.0 * scale,
height * 2.0 * scale,
)),),
});
}

builder.with_children(|mut parent| {
// 影
if let Some(shadow) = &props.shadow {
Expand Down
5 changes: 0 additions & 5 deletions src/game.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ use bevy_rapier2d::prelude::*;
use bevy_simple_text_input::TextInputPlugin;
use bevy_simple_websocket::WebSocketPlugin;
use std::num::NonZero;
use vleue_navigator::prelude::NavmeshUpdaterPlugin;
use vleue_navigator::prelude::PrimitiveObstacle;
use vleue_navigator::VleueNavigatorPlugin;

pub fn run_game() {
let mut app = App::new();
Expand Down Expand Up @@ -194,8 +191,6 @@ pub fn run_game() {
.add_systems(Startup, setup_rapier_context)
.add_plugins(Light2dPlugin)
.add_plugins(TextInputPlugin)
.add_plugins(VleueNavigatorPlugin)
.add_plugins(NavmeshUpdaterPlugin::<PrimitiveObstacle>::default())
.add_plugins(EguiPlugin)
//
// 以下はこのゲーム本体で定義されたプラグイン
Expand Down
1 change: 0 additions & 1 deletion src/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ pub mod ceil;
pub mod chunk;
pub mod collision;
pub mod entities;
pub mod navigation;
pub mod spawn;
pub mod tile;
pub mod world;
2 changes: 0 additions & 2 deletions src/level/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ pub struct LevelChunk {
pub entities: Vec<SpawnEvent>,
pub bounds: Bounds,
pub dirty_scriptes: Option<Bounds>,
pub dirty_navmesh: bool,
}

impl LevelChunk {
Expand Down Expand Up @@ -157,7 +156,6 @@ impl LevelChunk {
max_y,
})
},
dirty_navmesh: true,
};
}

Expand Down
3 changes: 0 additions & 3 deletions src/level/collision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use bevy_rapier2d::prelude::Collider;
use bevy_rapier2d::prelude::Friction;
use bevy_rapier2d::prelude::RigidBody;
use std::collections::HashMap;
use vleue_navigator::prelude::PrimitiveObstacle;

/// 壁タイルから衝突矩形を計算します
/// チェストや本棚なども侵入不可能ですが、それらは個別に衝突形状を持つため、ここでは壁のみを扱います
Expand Down Expand Up @@ -115,7 +114,6 @@ pub fn spawn_wall_collisions(commands: &mut Commands, registry: &Registry, chunk
StateScoped(GameState::InGame),
Transform::from_translation(Vec3::new(x, y, 0.0)),
GlobalTransform::default(),
PrimitiveObstacle::Rectangle(Rectangle::new(w * 2.0, h * 2.0)),
Collider::cuboid(w, h),
RigidBody::Fixed,
Friction {
Expand All @@ -140,7 +138,6 @@ pub fn spawn_wall_collisions(commands: &mut Commands, registry: &Registry, chunk
StateScoped(GameState::InGame),
Transform::from_translation(Vec3::new(x, y, 0.0)),
GlobalTransform::default(),
PrimitiveObstacle::Rectangle(Rectangle::new(w * 2.0, h * 2.0)),
// todo: merge colliders
Collider::cuboid(w, h),
RigidBody::Fixed,
Expand Down
Loading

0 comments on commit 93f195c

Please sign in to comment.