]> git.localhorst.tv Git - gong.git/blobdiff - src/physics/Sphere.hpp
half-{complete,assed} sphere collision detection
[gong.git] / src / physics / Sphere.hpp
diff --git a/src/physics/Sphere.hpp b/src/physics/Sphere.hpp
new file mode 100644 (file)
index 0000000..0acbc0b
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef GONG_PHYSICS_SPHERE_HPP_
+#define GONG_PHYSICS_SPHERE_HPP_
+
+#include "Object.hpp"
+#include "../geometry/primitive.hpp"
+
+
+namespace gong {
+namespace physics {
+
+class Sphere
+: public Object {
+
+public:
+       explicit Sphere(float radius);
+
+       /// Get geometric description of shape in world coordinates
+       geometry::Sphere Shape() {
+               return geometry::Sphere{ state.pos, radius };
+       }
+
+private:
+       void ReverseCollisionTest(Object &, std::vector<Contact> &) override;
+       void ActualCollisionTest(Sphere &, std::vector<Contact> &) override;
+
+private:
+       float radius;
+
+};
+
+}
+}
+
+#endif