Add and initialize Rapier.
This commit is contained in:
parent
c41f5470c9
commit
cc249ad4fb
|
@ -23,6 +23,7 @@ features = [
|
|||
backtrace = "0.3"
|
||||
bevy_input_actionmap = { path = "../bevy_input_actionmap" }
|
||||
bevy_openal = { path = "../bevy_openal" }
|
||||
bevy_rapier2d = "0.10"
|
||||
bevy_tts = { path = "../bevy_tts" }
|
||||
coord_2d = "0.3"
|
||||
crossbeam-channel = "0.5"
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::{
|
|||
};
|
||||
|
||||
use bevy::{core::FloatOrd, prelude::*, transform::TransformSystem};
|
||||
use bevy_rapier2d::prelude::*;
|
||||
use derive_more::{Deref, DerefMut};
|
||||
use rand::prelude::*;
|
||||
|
||||
|
@ -480,6 +481,10 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
fn setup(core_config: Res<CoreConfig>, mut rapier_config: ResMut<RapierConfiguration>) {
|
||||
rapier_config.scale = core_config.pixels_per_unit as f32;
|
||||
}
|
||||
|
||||
fn copy_coordinates_to_transform(
|
||||
config: Res<CoreConfig>,
|
||||
mut query: Query<(&Coordinates, &mut Transform)>,
|
||||
|
@ -509,6 +514,7 @@ impl Plugin for CorePlugin {
|
|||
app.insert_resource(CoreConfig::default());
|
||||
}
|
||||
app.register_type::<Coordinates>()
|
||||
.add_startup_system(setup.system())
|
||||
.add_system(copy_coordinates_to_transform.system())
|
||||
.add_system_to_stage(
|
||||
CoreStage::PostUpdate,
|
||||
|
@ -526,6 +532,7 @@ impl PluginGroup for CorePlugins {
|
|||
group
|
||||
.add(crate::bevy_tts::TtsPlugin)
|
||||
.add(crate::bevy_openal::OpenAlPlugin)
|
||||
.add(CorePlugin);
|
||||
.add(CorePlugin)
|
||||
.add(RapierPhysicsPlugin::<NoUserData>::default());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user