1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-11-24 20:59:58 +01:00

Add steps

This commit is contained in:
Miloslav Číž 2018-09-07 19:52:19 +02:00
parent df8b84a0d5
commit d32de7dfb4

View file

@ -107,6 +107,7 @@ typedef struct
Unit collisionRadius; Unit collisionRadius;
Unit collisionHeightBelow; Unit collisionHeightBelow;
Unit collisionHeightAbove; Unit collisionHeightAbove;
Unit collisionStepHeight;
} Camera; } Camera;
/** /**
@ -983,7 +984,8 @@ void moveCameraWithCollision(Camera *camera, Vector2D planeOffset,
int16_t xSquareNew = divRoundDown(cornerNew.x,UNITS_PER_SQUARE); int16_t xSquareNew = divRoundDown(cornerNew.x,UNITS_PER_SQUARE);
int16_t ySquareNew = divRoundDown(cornerNew.y,UNITS_PER_SQUARE); int16_t ySquareNew = divRoundDown(cornerNew.y,UNITS_PER_SQUARE);
Unit bottomLimit = camera->height - camera->collisionHeightBelow; Unit bottomLimit = camera->height - camera->collisionHeightBelow +
camera->collisionStepHeight;
Unit topLimit = camera->height + camera->collisionHeightAbove; Unit topLimit = camera->height + camera->collisionHeightAbove;
// checks a single square for collision against the camera // checks a single square for collision against the camera