aboutsummaryrefslogtreecommitdiff
path: root/plugins/gravity/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gravity/src')
-rw-r--r--plugins/gravity/src/gravity.rs12
-rw-r--r--plugins/gravity/src/lib.rs19
2 files changed, 31 insertions, 0 deletions
diff --git a/plugins/gravity/src/gravity.rs b/plugins/gravity/src/gravity.rs
new file mode 100644
index 0000000..6d7030c
--- /dev/null
+++ b/plugins/gravity/src/gravity.rs
@@ -0,0 +1,12 @@
+use bevy::{
+ ecs::resource::Resource,
+ math::Vec3,
+ prelude::{Deref, DerefMut},
+};
+
+/// Represents the global gravity
+#[derive(Resource, Deref, DerefMut, PartialEq, Default, Clone)]
+pub struct Gravity {
+ #[deref]
+ pub(crate) gravity: Vec3,
+}
diff --git a/plugins/gravity/src/lib.rs b/plugins/gravity/src/lib.rs
new file mode 100644
index 0000000..4282256
--- /dev/null
+++ b/plugins/gravity/src/lib.rs
@@ -0,0 +1,19 @@
+//! CH Modules - Gravity
+//!
+//! CH Gravity provides the basic in-game representation of gravity
+
+use bevy::{app::Plugin, math::Vec3};
+use ch_macro_rules::import;
+
+import!(gravity);
+
+/// Cigarette Hacker gravity plugin
+pub struct CHGravityPlugin;
+
+impl Plugin for CHGravityPlugin {
+ fn build(&self, app: &mut bevy::app::App) {
+ app.insert_resource(Gravity {
+ gravity: Vec3::new(0., 1., 0.) * -9.8,
+ });
+ }
+}