bevy_xpbd icon indicating copy to clipboard operation
bevy_xpbd copied to clipboard

Panic with headless build

Open glklimmer opened this issue 1 year ago • 1 comments
trafficstars

Description:

Bevy provides a MinimalPlugins plugin bundle for headless bevy applications. Headless applications can be used to implement a game server for example. When trying to add the default Avian PhysicsPlugins Plugin Bundle Bevy a panics.

Minimal Example:

Here is a minimal example for a simple headless bevy application.

use avian3d::prelude::*;
use bevy::{app::ScheduleRunnerPlugin, prelude::*};
fn main() {
    App::new()
        .add_plugins(MinimalPlugins.set(ScheduleRunnerPlugin::run_once()))
        .add_systems(Update, hello_world_system)
        .add_plugins(PhysicsPlugins::default())
        .run();
}

fn hello_world_system() {
    println!("hello world");
}

Which results in the following error.

Resource requested by avian3d::collision::collider::backend::init_collider_constructor_hie
rarchies does not exist: bevy_asset::assets::Assets<bevy_render::mesh::mesh::Mesh>
Encountered a panic in system `hello world
avian3d::collision::collider::backend::init_collider_constructors`!
Encountered a panic in system `avian3d::collision::collider::backend::init_collider_constr
uctor_hierarchies`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

Is this a bug?

Does PhysicsPlugins::default() include plugins that can not be used without bevy_window::WindowPlugin maybe? If yes, would it make sense to also provide a MinimalPlugins bundle for avian physics? What plugins would I need to exclude?

Thanks!

glklimmer avatar Sep 02 '24 20:09 glklimmer