sandbox
Loading...
Searching...
No Matches
collision_detection.hpp
1// SPDX-License-Identifier: MIT
2#ifndef LIBSBX_PHYSICS_COLLISION_DETECTION_HPP_
3#define LIBSBX_PHYSICS_COLLISION_DETECTION_HPP_
4
5#include <libsbx/math/vector3.hpp>
6#include <libsbx/math/matrix4x4.hpp>
7#include <libsbx/math/volume.hpp>
8#include <libsbx/math/quaternion.hpp>
9
10#include <libsbx/scenes/node.hpp>
11
12#include <libsbx/physics/shape_collider.hpp>
13#include <libsbx/physics/mesh_collider.hpp>
14
15namespace sbx::physics {
16
18 math::vector3 position;
19 math::quaternion rotation;
20 const physics::shape_collider& collider;
21}; // struct collider_data
22
24 math::vector3 position;
25 std::float_t depth{0.0f};
26}; // struct contact_point
27
29 math::vector3 normal;
30 float depth{0.0f};
31 std::vector<contact_point> contact_points;
32}; // struct collision_manifold
33
34auto check_collision(const collider_data& first, const collider_data& second) -> std::optional<collision_manifold>;
35
36auto check_collision(const collider_data& convex, const mesh_collider& mesh, const math::vector3& mesh_position, const math::quaternion& mesh_rotation) -> std::optional<collision_manifold>;
37
38} // namespace sbx::physics
39
40#endif // LIBSBX_PHYSICS_COLLISION_DETECTION_HPP_
Definition: quaternion.hpp:25
Definition: vector3.hpp:23
Definition: mesh_collider.hpp:22
Definition: collision_detection.hpp:17
Definition: collision_detection.hpp:28
Definition: collision_detection.hpp:23
Definition: shape_collider.hpp:44