SleakEngine 1.0.0
C++23 multi-backend game engine
Loading...
Searching...
No Matches
CollisionDetection.hpp
Go to the documentation of this file.
1#ifndef _COLLISION_DETECTION_HPP_
2#define _COLLISION_DETECTION_HPP_
3
5
6namespace Sleak {
7namespace Physics {
8
9 /// Single point of contact between two colliding shapes.
10 /// @ingroup physics
16
17 /// Result of a narrow-phase test: whether a collision occurred and its contact data.
18 /// @ingroup physics
23
24 /// Narrow-phase collision tests; the resulting normal always points from A to B.
25 CollisionManifold TestAABBvsAABB(const AABB& a, const AABB& b);
33
34 /// Dispatches to the right narrow-phase test based on the runtime shape held by each variant.
35 CollisionManifold TestCollision(const ColliderShape& shapeA, const Vector3D& posA, const Vector3D& scaleA,
36 const ColliderShape& shapeB, const Vector3D& posB, const Vector3D& scaleB);
37
38 /// Nearest point on segment [a, b] to the given point.
39 Vector3D ClosestPointOnSegment(const Vector3D& point, const Vector3D& a, const Vector3D& b);
40 /// Nearest points between two line segments, used for capsule-vs-capsule tests.
41 void ClosestPointsSegmentSegment(const Vector3D& a1, const Vector3D& a2,
42 const Vector3D& b1, const Vector3D& b2,
43 Vector3D& closestA, Vector3D& closestB);
45 const Vector3D& v0, const Vector3D& v1, const Vector3D& v2);
46
47} // namespace Physics
48} // namespace Sleak
49
50#endif // _COLLISION_DETECTION_HPP_
Collision shapes, the broadphase tree, and the world that steps them.
Definition SceneBase.hpp:29
void ClosestPointsSegmentSegment(const Vector3D &a1, const Vector3D &a2, const Vector3D &b1, const Vector3D &b2, Vector3D &closestA, Vector3D &closestB)
Nearest points between two line segments, used for capsule-vs-capsule tests.
CollisionManifold TestSphereVsTriangle(const BoundingSphere &sphere, const Vector3D &v0, const Vector3D &v1, const Vector3D &v2)
std::variant< AABB, BoundingSphere, BoundingCapsule, TriangleMesh > ColliderShape
Tagged union of the shapes a ColliderComponent can hold.
CollisionManifold TestCapsuleVsCapsule(const BoundingCapsule &a, const BoundingCapsule &b)
Vector3D ClosestPointOnSegment(const Vector3D &point, const Vector3D &a, const Vector3D &b)
Nearest point on segment [a, b] to the given point.
CollisionManifold TestAABBvsCapsule(const AABB &a, const BoundingCapsule &b)
CollisionManifold TestSphereVsMesh(const BoundingSphere &a, const TriangleMesh &b)
CollisionManifold TestAABBvsAABB(const AABB &a, const AABB &b)
Narrow-phase collision tests; the resulting normal always points from A to B.
CollisionManifold TestAABBvsSphere(const AABB &a, const BoundingSphere &b)
CollisionManifold TestSphereVsCapsule(const BoundingSphere &a, const BoundingCapsule &b)
CollisionManifold TestSphereVsSphere(const BoundingSphere &a, const BoundingSphere &b)
CollisionManifold TestCollision(const ColliderShape &shapeA, const Vector3D &posA, const Vector3D &scaleA, const ColliderShape &shapeB, const Vector3D &posB, const Vector3D &scaleB)
Dispatches to the right narrow-phase test based on the runtime shape held by each variant.
CollisionManifold TestAABBvsMesh(const AABB &a, const TriangleMesh &b)
Root namespace for everything the engine exposes.
Definition Camera.hpp:10