From 861d505606d612bc328534dba3257e9ef9a1c269 Mon Sep 17 00:00:00 2001 From: ccolin Date: Sat, 2 Jan 2021 01:10:54 +0100 Subject: add basic collision detection --- src/drone_controller.hh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/drone_controller.hh') diff --git a/src/drone_controller.hh b/src/drone_controller.hh index 18fc722..93930a1 100644 --- a/src/drone_controller.hh +++ b/src/drone_controller.hh @@ -29,12 +29,16 @@ class Drone { QVector waypoints; int mesh_id; + QVector3D pos; + int id; public: - Drone(); + Drone(int id); Drone(const QJsonObject &json); const QVector getWaypoints() const; void setTo(int frame); + QVector3D getPos() const; + int getId() const; }; @@ -48,6 +52,8 @@ class DroneController : public QObject { QTimer timer; bool paused = true; + static bool collides(const Drone &a, const Drone &b, double radius); + public: DroneController(const QJsonObject &json); int getDuration() const; @@ -56,6 +62,7 @@ signals: void frameChanged(int frame); void playing(); void pausing(); + void collision(int idA, int idB, int frame); private slots: void step(); @@ -66,6 +73,7 @@ public slots: void suspend(); void resume(); void seek(int frame); + void computeCollisions(double sphere_radius); }; -- cgit v1.2.3-70-g09d2