collide and slide function for FRect
This commit is contained in:
parent
5aede928d8
commit
56a4aa9d39
2 changed files with 43 additions and 0 deletions
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include "point.h"
|
||||
#include "vector2.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
|
@ -118,6 +119,21 @@ int32_t ARC_FRect_IntersectsPoint(ARC_FRect *rect, ARC_Point *point);
|
|||
*/
|
||||
int32_t ARC_Rect_LineIntersects(ARC_Rect *rect, int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2);
|
||||
|
||||
/**
|
||||
* @brief checks for a ARC_Rect on ARC_Rect collision and slides on collision
|
||||
*
|
||||
* @note need to update this documenation to word it better
|
||||
*
|
||||
* @param rect ARC_Rect that might collide with the wall
|
||||
* @param velocity the ammount ARC_Rect will move
|
||||
* @param wall ARC_Rect that might have collision with rect
|
||||
*
|
||||
* @note velocity is updated based on colliding,
|
||||
* rect's values are not changed,
|
||||
* velocity should be applied after
|
||||
*/
|
||||
void ARC_FRect_CollideAndSlide(ARC_FRect *rect, ARC_Vector2 *velocity, ARC_FRect *wall);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue