1 #ifndef BLOBS_WORLD_CREATURECREATURECOLLISION_HPP_
2 #define BLOBS_WORLD_CREATURECREATURECOLLISION_HPP_
4 #include "../math/glm.hpp"
13 class CreatureCreatureCollision {
16 CreatureCreatureCollision(
17 creature::Creature &a,
18 creature::Creature &b,
21 ) : a(&a), b(&b), normal(n), depth(depth) {
22 if (glm::dot(normal, BPos() - APos()) < 0.0) {
23 // make sure normal always is in direction from A to B
27 ~CreatureCreatureCollision();
30 creature::Creature &A() noexcept { return *a; }
31 const creature::Creature &A() const noexcept { return *a; }
32 const glm::dvec3 &APos() const noexcept;
33 const glm::dvec3 &AVel() const noexcept;
35 creature::Creature &B() noexcept { return *b; }
36 const creature::Creature &B() const noexcept { return *b; }
37 const glm::dvec3 &BPos() const noexcept;
38 const glm::dvec3 &BVel() const noexcept;
40 const glm::dvec3 &Normal() const noexcept { return normal; }
41 double Depth() const noexcept { return depth; }
44 creature::Creature *a;
45 creature::Creature *b;