mirror of
https://github.com/kaosat-dev/Blender_bevy_components_workflow.git
synced 2024-12-22 07:34:10 +00:00
Clean common physics code up (#159)
This commit is contained in:
parent
5ad5b64dc9
commit
906318b51e
@ -1,7 +1,7 @@
|
||||
[workspace]
|
||||
members = [
|
||||
"crates/*",
|
||||
"examples/common",
|
||||
"examples/common*",
|
||||
"examples/bevy_gltf_components/*",
|
||||
"examples/bevy_gltf_blueprints/*",
|
||||
"examples/bevy_gltf_save_load/*",
|
||||
|
@ -7,6 +7,6 @@ license = "MIT OR Apache-2.0"
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
|
||||
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||
rand = "0.8.5"
|
||||
|
@ -1,4 +1,6 @@
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning, Player};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{
|
||||
assets::GameAssets, GameState, InAppRunning, Player,
|
||||
};
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
use rand::Rng;
|
||||
use std::time::Duration;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
|
||||
|
||||
pub fn setup_main_menu(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -5,7 +5,7 @@ pub mod in_main_menu;
|
||||
pub use in_main_menu::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
#[reflect(Component)]
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
@ -7,6 +7,6 @@ license = "MIT OR Apache-2.0"
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
|
||||
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||
rand = "0.8.5"
|
||||
|
@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
use rand::Rng;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
|
||||
|
||||
pub fn setup_main_menu(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -5,7 +5,7 @@ pub mod in_main_menu;
|
||||
pub use in_main_menu::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
|
||||
|
||||
pub struct GamePlugin;
|
||||
impl Plugin for GamePlugin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
@ -7,6 +7,6 @@ license = "MIT OR Apache-2.0"
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common", default-features = false, features = ["blueprints", "physics_xpbd"] }
|
||||
bevy_gltf_worlflow_examples_common_xpbd = { path = "../../common_xpbd" }
|
||||
bevy_xpbd_3d = "0.4"
|
||||
rand = "0.8.5"
|
@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_gltf_worlflow_examples_common_xpbd::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_xpbd_3d::prelude::*;
|
||||
use rand::Rng;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
|
||||
use bevy_gltf_worlflow_examples_common_xpbd::{AppState, InMainMenu};
|
||||
|
||||
pub fn setup_main_menu(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -5,7 +5,7 @@ pub mod in_main_menu;
|
||||
pub use in_main_menu::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_xpbd::{AppState, GameState};
|
||||
|
||||
pub struct GamePlugin;
|
||||
impl Plugin for GamePlugin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_xpbd::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
@ -7,6 +7,6 @@ license = "MIT OR Apache-2.0"
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
|
||||
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||
rand = "0.8.5"
|
@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
||||
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
use rand::Rng;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
|
||||
|
||||
pub fn setup_main_menu(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -5,7 +5,7 @@ pub mod in_main_menu;
|
||||
pub use in_main_menu::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
|
||||
|
||||
pub struct GamePlugin;
|
||||
impl Plugin for GamePlugin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
@ -7,6 +7,6 @@ license = "MIT OR Apache-2.0"
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
|
||||
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||
rand = "0.8.5"
|
@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
||||
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
use rand::Rng;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
|
||||
|
||||
pub fn setup_main_menu(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -1,6 +1,8 @@
|
||||
use bevy::{gltf::Gltf, prelude::*};
|
||||
use bevy_gltf_blueprints::GameWorldTag;
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning, Player};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{
|
||||
assets::GameAssets, GameState, InAppRunning, Player,
|
||||
};
|
||||
use bevy_rapier3d::prelude::*;
|
||||
|
||||
#[derive(Component, Reflect, Default, Debug)]
|
||||
|
@ -8,7 +8,7 @@ pub mod level_transitions;
|
||||
pub use level_transitions::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
|
||||
|
||||
pub struct GamePlugin;
|
||||
impl Plugin for GamePlugin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
@ -7,4 +7,4 @@ license = "MIT OR Apache-2.0"
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
|
||||
|
@ -1,6 +1,6 @@
|
||||
use bevy::{gltf::Gltf, prelude::*};
|
||||
use bevy_gltf_components::ComponentsFromGltfPlugin;
|
||||
use bevy_gltf_worlflow_examples_common::CorePlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CorePlugin;
|
||||
|
||||
mod test_components;
|
||||
use test_components::*;
|
||||
|
@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||
bevy_gltf_save_load = { path = "../../../crates/bevy_gltf_save_load" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
|
||||
|
||||
serde_json = "1.0.108"
|
||||
serde = "1.0.193"
|
||||
|
@ -6,7 +6,7 @@ use bevy::{
|
||||
};
|
||||
use bevy_gltf_blueprints::*;
|
||||
use bevy_gltf_save_load::*;
|
||||
use bevy_gltf_worlflow_examples_common::{CameraTrackingOffset, Pickable};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{CameraTrackingOffset, Pickable};
|
||||
use bevy_rapier3d::dynamics::Velocity;
|
||||
use std::any::TypeId;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag, Library, NoInBlueprint};
|
||||
use bevy_gltf_save_load::{Dynamic, DynamicEntitiesRoot, StaticEntitiesRoot};
|
||||
use bevy_gltf_worlflow_examples_common::{GameState, InAppRunning, Player};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{GameState, InAppRunning, Player};
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
use rand::Rng;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::InGameLoading;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::InGameLoading;
|
||||
|
||||
pub fn setup_loading_screen(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::InGameSaving;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::InGameSaving;
|
||||
|
||||
pub fn setup_saving_screen(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
|
||||
|
||||
pub fn setup_main_menu(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -1,5 +1,5 @@
|
||||
pub mod in_game;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
|
||||
pub use in_game::*;
|
||||
|
||||
pub mod in_main_menu;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
@ -8,6 +8,6 @@ license = "MIT OR Apache-2.0"
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" }
|
||||
bevy_registry_export = { path = "../../../crates/bevy_registry_export" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../common_rapier" }
|
||||
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||
rand = "0.8.5"
|
||||
|
@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
||||
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
use rand::Rng;
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, InMainMenu};
|
||||
|
||||
pub fn setup_main_menu(mut commands: Commands) {
|
||||
commands.spawn((
|
||||
|
@ -5,7 +5,7 @@ pub mod in_main_menu;
|
||||
pub use in_main_menu::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
|
||||
|
||||
pub struct GamePlugin;
|
||||
impl Plugin for GamePlugin {
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
@ -4,29 +4,11 @@ pub use camera::*;
|
||||
//pub mod relationships;
|
||||
//pub use relationships::*;
|
||||
|
||||
#[cfg(feature = "physics_rapier")]
|
||||
#[allow(ambiguous_glob_reexports)]
|
||||
pub mod physics_rapier;
|
||||
#[cfg(feature = "physics_rapier")]
|
||||
pub use physics_rapier::*;
|
||||
|
||||
#[cfg(feature = "physics_xpbd")]
|
||||
#[allow(ambiguous_glob_reexports)]
|
||||
pub mod physics_xpbd;
|
||||
#[cfg(feature = "physics_xpbd")]
|
||||
pub use physics_xpbd::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub struct CorePlugin;
|
||||
impl Plugin for CorePlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins(CameraPlugin);
|
||||
|
||||
#[cfg(feature = "physics_rapier")]
|
||||
app.add_plugins(PhysicsPlugin);
|
||||
|
||||
#[cfg(feature = "physics_xpbd")]
|
||||
app.add_plugins(PhysicsPluginXPBD);
|
||||
}
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
pub(crate) mod physics_replace_proxies;
|
||||
pub(crate) use physics_replace_proxies::*;
|
||||
|
||||
pub(crate) mod utils;
|
||||
|
||||
pub(crate) mod controls;
|
||||
pub(crate) use controls::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_xpbd_3d::prelude::*;
|
||||
|
||||
use crate::state::GameState;
|
||||
use bevy_gltf_blueprints::GltfBlueprintsSet;
|
||||
|
||||
pub struct PhysicsPluginXPBD;
|
||||
impl Plugin for PhysicsPluginXPBD {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins((PhysicsPlugins::default(), PhysicsDebugPlugin::default()))
|
||||
.register_type::<AutoAABBCollider>()
|
||||
.register_type::<physics_replace_proxies::Collider>()
|
||||
.add_systems(
|
||||
Update,
|
||||
physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn),
|
||||
)
|
||||
.add_systems(Update, toggle_physics_debug)
|
||||
.add_systems(OnEnter(GameState::InGame), resume_physics)
|
||||
.add_systems(OnExit(GameState::InGame), pause_physics);
|
||||
}
|
||||
}
|
19
examples/common_rapier/Cargo.toml
Normal file
19
examples/common_rapier/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "bevy_gltf_worlflow_examples_common_rapier"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[features]
|
||||
blueprints = ["dep:bevy_gltf_blueprints"]
|
||||
default = ["blueprints"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../common" }
|
||||
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints", optional = true }
|
||||
bevy_rapier3d = { version = "0.25", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||
bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets"] }
|
||||
bevy_editor_pls = { version = "0.8" }
|
||||
rand = "0.8.5"
|
13
examples/common_rapier/src/lib.rs
Normal file
13
examples/common_rapier/src/lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin as CommonBasePlugin;
|
||||
|
||||
pub use bevy_gltf_worlflow_examples_common::*;
|
||||
|
||||
mod physics;
|
||||
|
||||
pub struct CommonPlugin;
|
||||
impl Plugin for CommonPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins((physics::plugin, CommonBasePlugin));
|
||||
}
|
||||
}
|
31
examples/common_rapier/src/physics/mod.rs
Normal file
31
examples/common_rapier/src/physics/mod.rs
Normal file
@ -0,0 +1,31 @@
|
||||
pub(crate) mod physics_replace_proxies;
|
||||
pub(crate) use physics_replace_proxies::*;
|
||||
|
||||
pub(crate) mod utils;
|
||||
|
||||
pub(crate) mod controls;
|
||||
pub(crate) use controls::*;
|
||||
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::GltfBlueprintsSet;
|
||||
use bevy_gltf_worlflow_examples_common::state::GameState;
|
||||
use bevy_rapier3d::{
|
||||
prelude::{NoUserData, RapierPhysicsPlugin},
|
||||
render::RapierDebugRenderPlugin,
|
||||
};
|
||||
|
||||
pub(crate) fn plugin(app: &mut App) {
|
||||
app.add_plugins((
|
||||
RapierPhysicsPlugin::<NoUserData>::default(),
|
||||
RapierDebugRenderPlugin::default(),
|
||||
))
|
||||
.register_type::<AutoAABBCollider>()
|
||||
.register_type::<physics_replace_proxies::Collider>()
|
||||
.add_systems(
|
||||
Update,
|
||||
physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn),
|
||||
)
|
||||
.add_systems(Update, toggle_physics_debug)
|
||||
.add_systems(OnEnter(GameState::InGame), resume_physics)
|
||||
.add_systems(OnExit(GameState::InGame), pause_physics);
|
||||
}
|
19
examples/common_xpbd/Cargo.toml
Normal file
19
examples/common_xpbd/Cargo.toml
Normal file
@ -0,0 +1,19 @@
|
||||
[package]
|
||||
name = "bevy_gltf_worlflow_examples_common_xpbd"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
||||
[features]
|
||||
blueprints = ["dep:bevy_gltf_blueprints"]
|
||||
default = ["blueprints"]
|
||||
|
||||
|
||||
[dependencies]
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../common" }
|
||||
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints", optional = true }
|
||||
bevy_xpbd_3d = { version = "0.4" }
|
||||
bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets"] }
|
||||
bevy_editor_pls = { version = "0.8" }
|
||||
rand = "0.8.5"
|
13
examples/common_xpbd/src/lib.rs
Normal file
13
examples/common_xpbd/src/lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin as CommonBasePlugin;
|
||||
|
||||
pub use bevy_gltf_worlflow_examples_common::*;
|
||||
|
||||
mod physics;
|
||||
|
||||
pub struct CommonPlugin;
|
||||
impl Plugin for CommonPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins((physics::plugin, CommonBasePlugin));
|
||||
}
|
||||
}
|
@ -6,21 +6,14 @@ pub(crate) mod utils;
|
||||
pub(crate) mod controls;
|
||||
pub(crate) use controls::*;
|
||||
|
||||
use crate::state::GameState;
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::GltfBlueprintsSet;
|
||||
use bevy_rapier3d::{
|
||||
prelude::{NoUserData, RapierPhysicsPlugin},
|
||||
render::RapierDebugRenderPlugin,
|
||||
};
|
||||
use bevy_xpbd_3d::prelude::*;
|
||||
|
||||
pub struct PhysicsPlugin;
|
||||
impl Plugin for PhysicsPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins((
|
||||
RapierPhysicsPlugin::<NoUserData>::default(),
|
||||
RapierDebugRenderPlugin::default(),
|
||||
))
|
||||
use bevy_gltf_blueprints::GltfBlueprintsSet;
|
||||
use bevy_gltf_worlflow_examples_common::state::GameState;
|
||||
|
||||
pub(crate) fn plugin(app: &mut App) {
|
||||
app.add_plugins((PhysicsPlugins::default(), PhysicsDebugPlugin::default()))
|
||||
.register_type::<AutoAABBCollider>()
|
||||
.register_type::<physics_replace_proxies::Collider>()
|
||||
.add_systems(
|
||||
@ -30,5 +23,4 @@ impl Plugin for PhysicsPlugin {
|
||||
.add_systems(Update, toggle_physics_debug)
|
||||
.add_systems(OnEnter(GameState::InGame), resume_physics)
|
||||
.add_systems(OnExit(GameState::InGame), pause_physics);
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
|
||||
bevy = { version = "0.13", features = ["dynamic_linking"] }
|
||||
bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints" }
|
||||
bevy_registry_export = { path = "../../crates/bevy_registry_export" }
|
||||
bevy_gltf_worlflow_examples_common = { path = "../../examples/common" }
|
||||
bevy_gltf_worlflow_examples_common_rapier = { path = "../../examples/common_rapier" }
|
||||
|
||||
bevy_rapier3d = { version = "0.25.0", features = ["serde-serialize", "debug-render-3d", "enhanced-determinism"] }
|
||||
bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets"] }
|
||||
|
@ -1,6 +1,6 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag};
|
||||
use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{assets::GameAssets, GameState, InAppRunning};
|
||||
|
||||
use bevy_rapier3d::prelude::Velocity;
|
||||
use rand::Rng;
|
||||
|
@ -11,7 +11,7 @@ use bevy::{
|
||||
prelude::*, render::view::screenshot::ScreenshotManager, time::common_conditions::on_timer,
|
||||
window::PrimaryWindow,
|
||||
};
|
||||
use bevy_gltf_worlflow_examples_common::{AppState, GameState};
|
||||
use bevy_gltf_worlflow_examples_common_rapier::{AppState, GameState};
|
||||
|
||||
use crate::{TupleTestF32, UnitTest};
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_gltf_worlflow_examples_common::CommonPlugin;
|
||||
use bevy_gltf_worlflow_examples_common_rapier::CommonPlugin;
|
||||
|
||||
mod core;
|
||||
use crate::core::*;
|
||||
|
Loading…
Reference in New Issue
Block a user