Helper class for 2D collision detection.
More...
#include <Collision2DHelper.hpp>
|
| static bool | checkCollisionRecs (const Rectangle &rec1, const Rectangle &rec2) |
| | Check if two rectangles are colliding. More...
|
| |
| static bool | checkCollisionCircles (const Vector2f ¢er1, const float &radius1, const Vector2f ¢er2, const float &radius2) |
| | Check if two circles are colliding. More...
|
| |
| static bool | checkCollisionCircleRec (const Vector2f ¢er, const float &radius, const Rectangle &rec) |
| | Check if a circle is colliding with a rectangle. More...
|
| |
| static bool | checkCollisionPointRec (const Vector2f &point, const Rectangle &rec) |
| | Check if point is inside rectangle. More...
|
| |
| static bool | checkCollisionPointCircle (const Vector2f &point, const Vector2f ¢er, const float &radius) |
| | Check if point is inside circle. More...
|
| |
| static bool | checkCollisionPointTriangle (const Vector2f &point, const Vector2f &p1, const Vector2f &p2, const Vector2f &p3) |
| | Check if point is inside a triangle. More...
|
| |
| static bool | checkCollisionLines (const Vector2f &startPos1, const Vector2f &endPos1, const Vector2f &startPos2, const Vector2f &endPos2, Vector2f &collisionPoint) |
| | Check the collision between two lines defined by two points each, returns collision point by reference. More...
|
| |
| static bool | checkCollisionPointLine (const Vector2f &point, const Vector2f &p1, const Vector2f &p2, const int &threshold) |
| | Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]. More...
|
| |
| static Rectangle | getCollisionRec (const Rectangle &rec1, const Rectangle &rec2) |
| | Get collision rectangle for two rectangles collision. More...
|
| |
Helper class for 2D collision detection.
◆ checkCollisionCircleRec()
| bool raylib::helper::Collision2DHelper::checkCollisionCircleRec |
( |
const Vector2f & |
center, |
|
|
const float & |
radius, |
|
|
const Rectangle & |
rec |
|
) |
| |
|
static |
Check if a circle is colliding with a rectangle.
- Parameters
-
| center | the circle center |
| radius | the circle radius |
| rec | the rectangle |
- Returns
- true if the circle is colliding with the rectangle, false otherwise
◆ checkCollisionCircles()
| bool raylib::helper::Collision2DHelper::checkCollisionCircles |
( |
const Vector2f & |
center1, |
|
|
const float & |
radius1, |
|
|
const Vector2f & |
center2, |
|
|
const float & |
radius2 |
|
) |
| |
|
static |
Check if two circles are colliding.
- Parameters
-
| center1 | the first circle center |
| radius1 | the first circle radius |
| center2 | the second circle center |
| radius2 | the second circle radius |
- Returns
- true if the circles are colliding, false otherwise
◆ checkCollisionLines()
Check the collision between two lines defined by two points each, returns collision point by reference.
- Parameters
-
| startPos1 | the first line start position |
| endPos1 | the first line end position |
| startPos2 | the second line start position |
| endPos2 | the second line end position |
| collisionPoint | the collision point (stored in it) |
- Returns
- true if the lines are colliding, false otherwise
◆ checkCollisionPointCircle()
| bool raylib::helper::Collision2DHelper::checkCollisionPointCircle |
( |
const Vector2f & |
point, |
|
|
const Vector2f & |
center, |
|
|
const float & |
radius |
|
) |
| |
|
static |
Check if point is inside circle.
- Parameters
-
| point | the point |
| center | the circle center |
| radius | the circle radius |
- Returns
- true if the point is colliding with the circle, false otherwise
◆ checkCollisionPointLine()
| bool raylib::helper::Collision2DHelper::checkCollisionPointLine |
( |
const Vector2f & |
point, |
|
|
const Vector2f & |
p1, |
|
|
const Vector2f & |
p2, |
|
|
const int & |
threshold |
|
) |
| |
|
static |
Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold].
- Parameters
-
| point | the point |
| p1 | the first line point |
| p2 | the second line point |
| threshold | the margin in pixels |
- Returns
- true if the point is colliding with the line, false otherwise
◆ checkCollisionPointRec()
| bool raylib::helper::Collision2DHelper::checkCollisionPointRec |
( |
const Vector2f & |
point, |
|
|
const Rectangle & |
rec |
|
) |
| |
|
static |
Check if point is inside rectangle.
- Parameters
-
| point | the point |
| rec | the rectangle |
- Returns
- true if the point is colliding with the rectangle, false otherwise
◆ checkCollisionPointTriangle()
Check if point is inside a triangle.
- Parameters
-
| point | the point |
| p1 | the first triangle point |
| p2 | the second triangle point |
| p3 | the third triangle point |
- Returns
- true if the point is colliding with the triangle, false otherwise
◆ checkCollisionRecs()
| bool raylib::helper::Collision2DHelper::checkCollisionRecs |
( |
const Rectangle & |
rec1, |
|
|
const Rectangle & |
rec2 |
|
) |
| |
|
static |
Check if two rectangles are colliding.
- Parameters
-
| rec1 | the first rectangle |
| rec2 | the second rectangle |
- Returns
- true if the rectangles are colliding, false otherwise
◆ getCollisionRec()
| Rectangle raylib::helper::Collision2DHelper::getCollisionRec |
( |
const Rectangle & |
rec1, |
|
|
const Rectangle & |
rec2 |
|
) |
| |
|
static |
Get collision rectangle for two rectangles collision.
- Parameters
-
| rec1 | the first rectangle |
| rec2 | the second rectangle |
- Returns
- the collision rectangle
The documentation for this class was generated from the following files: