1
0
Fork 0
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:
Miloslav Číž 2020-03-09 16:21:10 +01:00
parent 8a4077bd03
commit cd88d5a92d

View file

@ -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)\
{\