From bdf6f0328e870c308299f37155b9e89d91a2859c Mon Sep 17 00:00:00 2001 From: David Date: Sat, 16 Jul 2022 16:01:31 +0200 Subject: fix up angle and force --- rust/src/basic_die.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'rust/src/basic_die.rs') diff --git a/rust/src/basic_die.rs b/rust/src/basic_die.rs index ab53720..2a61197 100644 --- a/rust/src/basic_die.rs +++ b/rust/src/basic_die.rs @@ -219,6 +219,7 @@ impl BasicDie { if save_event.is_action_released(GodotString::from_str(&self.action_shooting), false) { self.input_state = InputState::Moving; self.shoot(); + self.current_force = 0.0; return; } @@ -294,7 +295,7 @@ impl BasicDie { None => { godot_warn!("No camera assigned!"); return; }, Some(cam) => { // get the forward vector of the camera setting the up angle to the defined value in the editor - let mut forward_vector = -cam.assume_safe().global_transform().basis.c(); + let mut forward_vector = -cam.assume_safe().global_transform().basis.c().normalized(); forward_vector.y = self.up_angle; // calculate the impulse force -- cgit