Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Failed to find merge points" when tile_width is too large. #32

Open
andriyDev opened this issue Jul 25, 2024 · 0 comments
Open

"Failed to find merge points" when tile_width is too large. #32

andriyDev opened this issue Jul 25, 2024 · 0 comments

Comments

@andriyDev
Copy link

Here is my example:

fn main() {
  App::new()
    .add_plugins(DefaultPlugins)
    .add_plugins(RapierPhysicsPlugin::<NoUserData>::default())
    .add_plugins(OxidizedNavigationPlugin::<Collider>::new(NavMeshSettings {
      tile_width: 65,
      ..NavMeshSettings::from_agent_and_bounds(0.5, 2.0, 10.0, -5.0)
    }))
    .add_plugins(OxidizedNavigationDebugDrawPlugin)
    .add_systems(Startup, setup)
    .run();
}

fn setup(
  mut commands: Commands,
  mut materials: ResMut<Assets<StandardMaterial>>,
  asset_server: Res<AssetServer>,
) {
  commands.spawn(Camera3dBundle {
    transform: Transform::from_xyz(0.0, 1.0, -1.0)
      .looking_to(Vec3::new(0.0, -1.0, 0.0), Vec3::new(0.0, 0.0, -1.0)),
    projection: Projection::Orthographic(OrthographicProjection {
      scaling_mode: bevy::render::camera::ScalingMode::FixedVertical(12.0),
      ..Default::default()
    }),
    ..Default::default()
  });

  // Spawn the floors.
  commands.spawn((
    MaterialMeshBundle {
      mesh: asset_server.load("floor.glb#Mesh0/Primitive0"),
      material: materials.add(StandardMaterial {
        unlit: true,
        base_color: ANTIQUE_WHITE.into(),
        ..Default::default()
      }),
      ..Default::default()
    },
    AsyncCollider(ComputedColliderShape::TriMesh),
    NavMeshAffector,
  ));
}

Here is the mesh I'm spawning: floor.zip I've had to zip it because Github doesn't allow uploading GLBs, sorry.

Setting the tile_width to anything >= 65 results in the error messages

2024-07-25T03:23:53.509660Z  WARN oxidized_navigation::contour: Failed to find merge points.
2024-07-25T03:23:53.510214Z  INFO oxidized_navigation::mesher: Triangulation failed for contour.

Setting the tile_width to <= 64 "resolves" this error, but that's kind of a bad solution. It adds a bunch of overhead for larger worlds. Not to mention 120 is the default tile_width for NavMeshSettings::from_agent_and_bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant