aboutsummaryrefslogtreecommitdiff
path: root/src/drone_controller.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/drone_controller.cc')
-rw-r--r--src/drone_controller.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/drone_controller.cc b/src/drone_controller.cc
index 588ac23..f6edfb6 100644
--- a/src/drone_controller.cc
+++ b/src/drone_controller.cc
@@ -2,6 +2,7 @@
#include "opengl_widget.hh"
#include <QJsonArray>
+#include <QDebug>
DroneController::DroneController(const QJsonObject &json)
@@ -99,15 +100,18 @@ void DroneController::seek(int frame) {
void DroneController::computeCollisions(double sphere_radius) {
double sqDist = sphere_radius * sphere_radius * 2;
for (int i = 0; i < duration; i++) {
- for (const Drone &a : drones) {
- for (const Drone &b : drones) {
+ for (Drone &a : drones) {
+ a.setTo(i);
+ for (Drone &b : drones) {
+ b.setTo(i);
if (&a == &b) continue;
if (collides(a, b, sqDist)) {
- emit collision(a.getId(), b.getId(), frame);
+ emit collision(a.getId(), b.getId(), i);
}
}
}
}
+ seek(frame);
}