TheGrimsey / oxidized_navigation

A runtime Nav-Mesh generation plugin for Bevy Engine in Rust.
Apache License 2.0
176 stars 13 forks source link

XPBD Scene Colliders #22

Closed 0xh007 closed 8 months ago

0xh007 commented 8 months ago

I'm encountering an issue integrating AsyncSceneCollider from the Bevy XPBD crate with the oxidized_navigation project. Specifically, it appears that no navigation mesh (navmesh) is generated when using AsyncSceneCollider.

Does oxidized_navigation support AsyncSceneColliders as part of its integration with the Bevy XPBD crate? While oxidized_navigation seems to work seamlessly with AsyncCollider(ComputedCollider::Trimesh) derived from a Bevy mesh, attempting to use AsyncSceneCollider::new(Some(ComputedCollider::TriMesh)) results in no navmesh being generated.

To reproduce this issue, I modified the XPBD example setup function within oxidized_navigation as follows. It's worth noting that I enabled bevy_xpbd_3d's default features in the Oxidized Cargo.toml and used navmeshtest_2.glb, a simple cube created in Blender, for testing.

    commands.spawn((
        SceneBundle {
            scene: asset_server.load("navmeshtest_2.glb#Scene0"),
            visibility: Visibility::Visible,
            ..default()
        },
        AsyncSceneCollider::new(Some(ComputedCollider::TriMesh)),
        RigidBody::Static,
        NavMeshAffector,
    ));

I'm looking for insights on whether this issue stems from a lack of support or if there's a workaround to achieve compatibility.

TheGrimsey commented 8 months ago

The child entities spawned by the scene won't have the NavMeshAffector component and then aren't considered for the NavMesh.

0xh007 commented 8 months ago

Thanks for the info. For future reference to anyone else who runs into this, the bevy_foxtrot project template has a good example of handling this situation using blender_bevy_components to add components to objects in blender and then dynamically add the navmeshaffectors and colliders once the app is running.