-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcollision_utils.hpp
More file actions
29 lines (20 loc) · 927 Bytes
/
collision_utils.hpp
File metadata and controls
29 lines (20 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef COLLISION_UTILS_HPP
#define COLLISION_UTILS_HPP
#include "sbpt_generated_includes.hpp"
#include <glm/glm.hpp>
#include <vector>
namespace collision_utils {
enum class Symbol { a, b };
struct CollisionManifold {
Symbol object_that_normal_exists_on;
glm::vec3 normal_generating_least_overlap;
// if this is positive then there is a collision
float penetration;
std::vector<glm::vec3> contact_points; // optional for now
};
CollisionManifold detect_convex_collision(const draw_info::IndexedVertexPositions &a, const glm::vec3 &posA,
const draw_info::IndexedVertexPositions &b, const glm::vec3 &posB);
void resolve_aabb_collision_on_axis(float &position, float &velocity, float min_a, float max_a, float min_b,
float max_b, const std::string &axis_name);
} // namespace collision_utils
#endif // COLLISION_UTILS_HPP