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 --- godot/scenes/objects/Player.tscn | 2 +- .../libcode_with_your_friends2022.so | Bin 29349872 -> 29349984 bytes rust/src/basic_die.rs | 3 ++- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/godot/scenes/objects/Player.tscn b/godot/scenes/objects/Player.tscn index 9730147..aeb8f51 100644 --- a/godot/scenes/objects/Player.tscn +++ b/godot/scenes/objects/Player.tscn @@ -8,7 +8,7 @@ script = ExtResource( 3 ) camera/camera_clamp = Vector2( 0, -1.3 ) shooting/max_force = 30.0 -shooting/up_angle = 1.0 +shooting/up_angle = 0.3 shooting/stopping_velocity = 0.003 input/camera_mouse_sensitivity = Vector2( 0.003, 0.002 ) input/shoot_sensitivity = 0.1 diff --git a/lib/x86_64-unknown-linux-gnu/libcode_with_your_friends2022.so b/lib/x86_64-unknown-linux-gnu/libcode_with_your_friends2022.so index 97b6350..03ade02 100755 Binary files a/lib/x86_64-unknown-linux-gnu/libcode_with_your_friends2022.so and b/lib/x86_64-unknown-linux-gnu/libcode_with_your_friends2022.so differ 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