diff options
author | Baitinq <you@example.com> | 2022-02-11 21:23:06 +0000 |
---|---|---|
committer | Baitinq <you@example.com> | 2022-02-11 21:39:49 +0000 |
commit | f4ac6cf687e5f66305de1b201f3948650ece35fb (patch) | |
tree | 71fbeec8431ee24768c1f63a8c273d5d0161c559 /src/simulation.py | |
parent | Implemented proper attitude calculation (instead of just y value) (diff) | |
download | OSLS-f4ac6cf687e5f66305de1b201f3948650ece35fb.tar.gz OSLS-f4ac6cf687e5f66305de1b201f3948650ece35fb.tar.bz2 OSLS-f4ac6cf687e5f66305de1b201f3948650ece35fb.zip |
Added first basic sprites
Diffstat (limited to 'src/simulation.py')
-rw-r--r-- | src/simulation.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/simulation.py b/src/simulation.py index ffcdaeb..9f6c389 100644 --- a/src/simulation.py +++ b/src/simulation.py @@ -91,17 +91,6 @@ class Simulation(): self.speed_x = self.speed_x + (self.acceleration_x * delta) self.speed_y = self.speed_y + (self.acceleration_y * delta) - - print("Speed x: " + str(self.speed_x)) - print("Speed y: " + str(self.speed_y)) - - #TODO: WELL CALCULATED? (angle well?) - ref_vec = (0, 1) - acc_vec = (self.speed_x, self.speed_y) - dot = (acc_vec[0] * ref_vec[0]) + (acc_vec[1] * ref_vec[1]) - det = (acc_vec[0] * ref_vec[1]) - (acc_vec[1] * ref_vec[0]) - self.heading = math.degrees(math.atan2(det, dot)) - print("Heading: " + str(self.heading)) #update position based on velocity and delta self.x += self.speed_x * delta @@ -112,10 +101,20 @@ class Simulation(): self.y -= self.speed_y * delta self.speed_x = 0 self.speed_y = 0 + + print("Speed x: " + str(self.speed_x)) + print("Speed y: " + str(self.speed_y)) print("X: " + str(self.x)) print("Y: " + str(self.y)) + ref_vec = (0, 1) + acc_vec = (self.speed_x, self.speed_y) + dot = (acc_vec[0] * ref_vec[0]) + (acc_vec[1] * ref_vec[1]) + det = (acc_vec[0] * ref_vec[1]) - (acc_vec[1] * ref_vec[0]) + self.heading = math.degrees(math.atan2(det, dot)) + print("Heading: " + str(self.heading)) + print("Total Simulation Time: " + str(self.time)) print("") |