aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
authorLibravatar David <david003@gmx.net>2022-07-16 16:01:31 +0200
committerLibravatar David <david003@gmx.net>2022-07-16 16:01:31 +0200
commitbdf6f0328e870c308299f37155b9e89d91a2859c (patch)
tree620e5ef2a2843bf140346f0171e955cbde8b9622 /rust
parentea7596edf57149b3c3f84378276c9d0558aed050 (diff)
download2022-bdf6f0328e870c308299f37155b9e89d91a2859c.tar.gz
2022-bdf6f0328e870c308299f37155b9e89d91a2859c.tar.bz2
2022-bdf6f0328e870c308299f37155b9e89d91a2859c.zip
fix up angle and force
Diffstat (limited to 'rust')
-rw-r--r--rust/src/basic_die.rs3
1 files changed, 2 insertions, 1 deletions
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