mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-22 20:39:57 +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 bottomLimit = -1 * RCL_INFINITY;
|
||||||
RCL_Unit topLimit = RCL_INFINITY;
|
RCL_Unit topLimit = RCL_INFINITY;
|
||||||
|
|
||||||
|
RCL_Unit currCeilHeight = RCL_INFINITY;
|
||||||
|
|
||||||
if (computeHeight)
|
if (computeHeight)
|
||||||
{
|
{
|
||||||
bottomLimit = camera->height - RCL_CAMERA_COLL_HEIGHT_BELOW +
|
bottomLimit = camera->height - RCL_CAMERA_COLL_HEIGHT_BELOW +
|
||||||
RCL_CAMERA_COLL_STEP_HEIGHT;
|
RCL_CAMERA_COLL_STEP_HEIGHT;
|
||||||
|
|
||||||
topLimit = camera->height + RCL_CAMERA_COLL_HEIGHT_ABOVE;
|
topLimit = camera->height + RCL_CAMERA_COLL_HEIGHT_ABOVE;
|
||||||
|
|
||||||
|
if (ceilingHeightFunc != 0)
|
||||||
|
currCeilHeight = ceilingHeightFunc(xSquare,ySquare);
|
||||||
}
|
}
|
||||||
|
|
||||||
// checks a single square for collision against the camera
|
// checks a single square for collision against the camera
|
||||||
|
@ -1768,7 +1773,9 @@ void RCL_moveCameraWithCollision(RCL_Camera *camera, RCL_Vector2D planeOffset,
|
||||||
if (computeHeight)\
|
if (computeHeight)\
|
||||||
{\
|
{\
|
||||||
RCL_Unit height = floorHeightFunc(s1,s2);\
|
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;\
|
dir##Collides = 1;\
|
||||||
else if (ceilingHeightFunc != 0)\
|
else if (ceilingHeightFunc != 0)\
|
||||||
{\
|
{\
|
||||||
|
|
Loading…
Reference in a new issue