+#include "Contact.hpp"
+#include "Sphere.hpp"
+
+
+namespace gong {
+namespace physics {
+
+Sphere::Sphere(float r)
+: radius(r) {
+ bounds.min = glm::vec3(-r);
+ bounds.max = glm::vec3(r);
+}
+
+void Sphere::ReverseCollisionTest(Object &other, std::vector<Contact> &contacts) {
+ other.ActualCollisionTest(*this, contacts);
+}
+
+void Sphere::ActualCollisionTest(Sphere &other, std::vector<Contact> &contacts) {
+ float dist;
+ glm::vec3 norm;
+ if (Intersection(Shape(), other.Shape(), dist, norm)) {
+ glm::vec3 point(state.pos + ((dist - radius) * norm));
+ contacts.emplace_back(point, norm, this, &other);
+ }
+}
+
+}
+}