fix pipe rotation + test blocks

This commit is contained in:
A-lex-Ra
2023-12-13 21:33:55 +06:00
parent cb13b42960
commit ae10ca248d
12 changed files with 43 additions and 9 deletions
+2 -2
View File
@@ -117,12 +117,12 @@ void CameraControl::update(PlayerInput& input, float delta, Chunks* chunks) {
player->currentViewCamera = camera;
}
if (player->currentViewCamera == player->SPCamera) {
player->SPCamera->position = chunks->rayCastToObstacle(camera->position, camera->front, 3.0f);
player->SPCamera->position = chunks->rayCastToObstacle(camera->position, camera->front, 3.0f) - 0.2f*(camera->front);
player->SPCamera->dir = -camera->dir;
player->SPCamera->front = -camera->front;
}
else if (player->currentViewCamera == player->TPCamera) {
player->TPCamera->position = chunks->rayCastToObstacle(camera->position, -camera->front, 3.0f);
player->TPCamera->position = chunks->rayCastToObstacle(camera->position, -camera->front, 3.0f) + 0.2f * (camera->front);
player->TPCamera->dir = camera->dir;
player->TPCamera->front = camera->front;
}
+5 -5
View File
@@ -14,11 +14,11 @@ void CoordSystem::transform(AABB& aabb) {
aabb.b += fix2;
}
const BlockRotProfile BlockRotProfile::PIPE {"pipe", {
{ { 1, 0, 0 }, { 0, 0, 1 }, { 0,-1, 0 }, { 0, 0,-1 }, { 0, 1, 0 } }, // North
{ { 0, 1, 0 }, {-1, 0, 0 }, { 0, 0, 1 }, { 1, 0, 0 }, { 1, 0, 0 } }, // East
{ { 1, 0, 0 }, { 0, 0,-1 }, { 0, 1, 0 }, { 0, 1, 0 }, { 0, 0, 1 } }, // South
{ { 0,-1, 0 }, { 1, 0, 0 }, { 0, 0, 1 }, { 0, 1, 0 }, { 0, 1, 0 } }, // West
const BlockRotProfile BlockRotProfile::PIPE {"pipe", {//TODO consexpr or init-time fix and fix2 calculations
{ { 1, 0, 0 }, { 0, 0, 1 }, { 0, -1, 0 }, { 0, 0, -1 }, { 0, 1, 0 } }, // North
{ { 0, 0, 1 }, {-1, 0, 0 }, { 0, -1, 0 }, { 1, 0, -1 }, { 1, 1, 0 } }, // East
{ { -1, 0, 0 }, { 0, 0,-1 }, { 0, -1, 0 }, { 1, 0, 0 }, { 1, 1, 1 } }, // South
{ { 0, 0, -1 }, { 1, 0, 0 }, { 0, -1, 0 }, { 0, 0, 0 }, { 0, 1, 1 } }, // West
{ { 1, 0, 0 }, { 0, 1, 0 }, { 0, 0, 1 }, { 0, 0, 0 }, { 0, 0, 0 } }, // Up
{ { 1, 0, 0 }, { 0,-1, 0 }, { 0, 0,-1 }, { 0, 1,-1 }, { 0, 1, 1 } }, // Down
}};