From 1f9493efb5d3dba3cc006f115c6b609eababfe37 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Sun, 10 Jan 2021 19:47:53 +0100 Subject: [PATCH] Add very basic projectile --- src/weapon.rs | 70 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) diff --git a/src/weapon.rs b/src/weapon.rs index c6820ef..fc120f4 100644 --- a/src/weapon.rs +++ b/src/weapon.rs @@ -1,7 +1,16 @@ +use crate::player::PlayerMarker; use bevy::{ input::{mouse::MouseButtonInput, ElementState}, prelude::*, }; +use bevy_rapier3d::{ + na::Matrix3x1, + physics::RigidBodyHandleComponent, + rapier::{ + dynamics::{RigidBody, RigidBodyBuilder, RigidBodySet}, + geometry::ColliderBuilder, + }, +}; use std::time::Duration; pub struct WeaponPlugin; @@ -10,7 +19,8 @@ impl Plugin for WeaponPlugin { fn build(&self, app: &mut AppBuilder) { app .add_resource(WeaponData::default()) - .add_system(shoot_system.system()); + .add_system(shoot_system.system()) + .add_system(projectile_system.system()); } } @@ -33,6 +43,10 @@ fn shoot_system( mouse_button_events: Res>, time: Res