Level H Engine
Collision.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../Maths/Vec2.h"
4 #include "../Maths/Vec3.h"
5 
9 namespace Collision
10 {
11 
20  bool rectRectIntersect(Vec2 posBoxA, Vec2 dimBoxA, Vec2 posBoxB, Vec2 dimBoxB);
21 
30  bool cubeCubeIntersect(Vec3 posBoxA, Vec3 dimBoxA, Vec3 posBoxB, Vec3 dimBoxB);
31 
41  bool cubeCubeIntersect(Vec3 posBoxA, Vec3 dimBoxA, Vec3 posBoxB, Vec3 dimBoxB, Vec3 &collisionSides);
42 
51  bool sphereCubeIntersect(Vec3 posBox, Vec3 dimBox, Vec3 posSphere, float radSphere);
52 
62  bool sphereCubeIntersect(Vec3 posBox, Vec3 dimBox, Vec3 posSphere, float radSphere, Vec3 &collisionSides);
63 
72  bool circleCircleIntersect(Vec2 circle1Pos, Vec2 circle2Pos, float circle1Rad, float circle2Rad);
73 
82  bool sphereSphereIntersect(Vec3 sphere1Pos, Vec3 sphere2Pos, float sphere1Rad, float sphere2Rad);
83 
94  bool sphereSphereIntersect(Vec3 sphere1Pos, Vec3 sphere2Pos, float sphere1Rad, float sphere2Rad, Vec3 &vel1, Vec3 &vel2);
95 
104  bool circleRectIntersect(Vec2 circlePos, Vec2 boxPos, float circleRad, Vec2 boxDim);
105 
106 }
Contains Collision detection functions for use within the code.
Definition: Collision.cpp:5
Contains the Vec2 structure with functions and overloaded operators.
Definition: Vec2.h:8
bool rectRectIntersect(Vec2 posBoxA, Vec2 dimBoxA, Vec2 posBoxB, Vec2 dimBoxB)
Checks to see if two rectangles intersect.
Definition: Collision.cpp:8
bool cubeCubeIntersect(Vec3 posBoxA, Vec3 dimBoxA, Vec3 posBoxB, Vec3 dimBoxB)
Checks to see if two cubes intersect (position is the center of the cube)
Definition: Collision.cpp:20
bool sphereSphereIntersect(Vec3 sphere1Pos, Vec3 sphere2Pos, float sphere1Rad, float sphere2Rad)
Takes in two sphere positions and radius's and uses this to detect if the sphere's collide...
Definition: Collision.cpp:189
Contains the Vec3 structure with functions and overloaded operators.
Definition: Vec3.h:8
bool circleCircleIntersect(Vec2 circle1Pos, Vec2 circle2Pos, float circle1Rad, float circle2Rad)
Takes in two circle positions, radius's to detect if the circles collide.
Definition: Collision.cpp:175
bool circleRectIntersect(Vec2 circlePos, Vec2 boxPos, float circleRad, Vec2 boxDim)
Takes in a circle position and radius and a box position and dimensions to detect for collision...
Definition: Collision.cpp:235
bool sphereCubeIntersect(Vec3 posBox, Vec3 dimBox, Vec3 posSphere, float radSphere)
Checks to see if a cube and sphere intersects (position is the center of the cube) ...
Definition: Collision.cpp:98