mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-12-23 01:26:19 +01:00
Fix collision checking
This commit is contained in:
parent
8a4077bd03
commit
cd88d5a92d
1 changed files with 8 additions and 1 deletions
|
@ -1755,12 +1755,17 @@ void RCL_moveCameraWithCollision(RCL_Camera *camera, RCL_Vector2D planeOffset,
|
|||
RCL_Unit bottomLimit = -1 * RCL_INFINITY;
|
||||
RCL_Unit topLimit = RCL_INFINITY;
|
||||
|
||||
RCL_Unit currCeilHeight = RCL_INFINITY;
|
||||
|
||||
if (computeHeight)
|
||||
{
|
||||
bottomLimit = camera->height - RCL_CAMERA_COLL_HEIGHT_BELOW +
|
||||
RCL_CAMERA_COLL_STEP_HEIGHT;
|
||||
|
||||
topLimit = camera->height + RCL_CAMERA_COLL_HEIGHT_ABOVE;
|
||||
|
||||
if (ceilingHeightFunc != 0)
|
||||
currCeilHeight = ceilingHeightFunc(xSquare,ySquare);
|
||||
}
|
||||
|
||||
// checks a single square for collision against the camera
|
||||
|
@ -1768,7 +1773,9 @@ void RCL_moveCameraWithCollision(RCL_Camera *camera, RCL_Vector2D planeOffset,
|
|||
if (computeHeight)\
|
||||
{\
|
||||
RCL_Unit height = floorHeightFunc(s1,s2);\
|
||||
if (height > bottomLimit)\
|
||||
if (height > bottomLimit || \
|
||||
currCeilHeight - height < \
|
||||
RCL_CAMERA_COLL_HEIGHT_BELOW + RCL_CAMERA_COLL_HEIGHT_ABOVE)\
|
||||
dir##Collides = 1;\
|
||||
else if (ceilingHeightFunc != 0)\
|
||||
{\
|
||||
|
|
Loading…
Reference in a new issue