Level H Engine
|
Contains Collision detection functions for use within the code. More...
Functions | |
bool | rectRectIntersect (Vec2 posBoxA, Vec2 dimBoxA, Vec2 posBoxB, Vec2 dimBoxB) |
Checks to see if two rectangles intersect. More... | |
bool | cubeCubeIntersect (Vec3 posBoxA, Vec3 dimBoxA, Vec3 posBoxB, Vec3 dimBoxB) |
Checks to see if two cubes intersect (position is the center of the cube) More... | |
bool | cubeCubeIntersect (Vec3 posBoxA, Vec3 dimBoxA, Vec3 posBoxB, Vec3 dimBoxB, Vec3 &collisionSides) |
Checks to see if two cubes intersect (position is the center of the cube) More... | |
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) More... | |
bool | sphereCubeIntersect (Vec3 posBox, Vec3 dimBox, Vec3 posSphere, float radSphere, Vec3 &collisionSides) |
Checks to see if a cube and sphere intersects (position is the center of the cube) More... | |
bool | circleCircleIntersect (Vec2 circle1Pos, Vec2 circle2Pos, float circle1Rad, float circle2Rad) |
Takes in two circle positions, radius's to detect if the circles collide. More... | |
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. More... | |
bool | sphereSphereIntersect (Vec3 sphere1Pos, Vec3 sphere2Pos, float sphere1Rad, float sphere2Rad, Vec3 &vel1, Vec3 &vel2) |
Takes in two sphere positions and radius's and uses this to detect if the sphere's collide. More... | |
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. More... | |
Contains Collision detection functions for use within the code.
bool Collision::circleCircleIntersect | ( | Vec2 | circle1Pos, |
Vec2 | circle2Pos, | ||
float | circle1Rad, | ||
float | circle2Rad | ||
) |
Takes in two circle positions, radius's to detect if the circles collide.
circle1Pos | The first circle position's to be used in the collision check. |
circle2Pos | The second circle position's to be used in the collision check. |
circle1Rad | The first circle radius's to be used in the collision check. |
circle2Rad | The second circle radius's to be used in the collision check. |
Takes in a circle position and radius and a box position and dimensions to detect for collision.
circlePos | The circle's position to be used in the collision check. |
boxPos | The box's position to be used in the collision check. |
circleRad | The sphere's radius to be used in the collision check. |
boxDim | The box's dimension's to be used in the collision check. |
Checks to see if two cubes intersect (position is the center of the cube)
posBoxA | The position of the first cube. |
dimBoxA | The dimensions of the first cube. |
posBoxB | The position of the second cube. |
dimBoxB | The dimensions of the second cube. |
bool Collision::cubeCubeIntersect | ( | Vec3 | posBoxA, |
Vec3 | dimBoxA, | ||
Vec3 | posBoxB, | ||
Vec3 | dimBoxB, | ||
Vec3 & | collisionSides | ||
) |
Checks to see if two cubes intersect (position is the center of the cube)
posBoxA | The position of the first cube. |
dimBoxA | The dimensions of the first cube. |
posBoxB | The position of the second cube. |
dimBoxB | The dimensions of the second cube. |
collisionSides | A reference to the sides of the cubes that collides, eg. x = -1 then left, x = 0 then none, x = 1 then right |
Checks to see if two rectangles intersect.
posBoxA | The position of the first rectangle. |
dimBoxA | The dimensions of the first rectangle. |
posBoxB | The position of the second rectangle. |
dimBoxB | The dimensions of the second rectangle. |
Checks to see if a cube and sphere intersects (position is the center of the cube)
posBox | The position of the cube. |
dimBox | The dimensions of the cube. |
posSphere | The position of the sphere. |
radSphere | The radius of the sphere. |
bool Collision::sphereCubeIntersect | ( | Vec3 | posBox, |
Vec3 | dimBox, | ||
Vec3 | posSphere, | ||
float | radSphere, | ||
Vec3 & | collisionSides | ||
) |
Checks to see if a cube and sphere intersects (position is the center of the cube)
posBox | The position of the cube. |
dimBox | The dimensions of the cube. |
posSphere | The position of the sphere. |
radSphere | The radius of the sphere. |
collisionSides | A reference to the sides of the cubes that collides, eg. x = -1 then left, x = 0 then none, x = 1 then right |
bool Collision::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.
sphere1Pos | The first sphere position's to be used in the collision check. |
sphere2Pos | The second sphere position's to be used in the collision check. |
sphere1Rad | The first sphere radius's to be used in the collision check. |
sphere2Rad | The second sphere radius's to be used in the collision check. |
bool Collision::sphereSphereIntersect | ( | Vec3 | sphere1Pos, |
Vec3 | sphere2Pos, | ||
float | sphere1Rad, | ||
float | sphere2Rad, | ||
Vec3 & | vel1, | ||
Vec3 & | vel2 | ||
) |
Takes in two sphere positions and radius's and uses this to detect if the sphere's collide.
sphere1Pos | The first sphere position's to be used in the collision check. |
sphere2Pos | The second sphere position's to be used in the collision check. |
sphere1Rad | The first sphere radius's to be used in the collision check. |
sphere2Rad | The second sphere radius's to be used in the collision check. |
vel1 | A reference to the velocities of the 1st sphere. |
vel2 | A reference to the velocities of the 2nd sphere. |