fix collision

This commit is contained in:
Asuro
2025-06-20 15:41:52 +02:00
parent 4e00355dbe
commit e15cd79e04
2 changed files with 21 additions and 3 deletions

View File

@@ -241,10 +241,26 @@ namespace Game
float fracOffsetY = scaledOffset.z - offsetY;
int32_t xPos = (int32_t)(fracOffsetX * heightmap.Width);
int32_t yPos = (int32_t)(fracOffsetY * heightmap.Height);
uint8_t height = heightmap.Values[yPos * heightmap.Width + xPos];
LOG("Height: %u", height);
return height > 230;
uint8_t height = 0;
switch (card.Rotation)
{
case 0:
height = heightmap.Values[yPos * heightmap.Width + xPos];
break;
case 1:
height = heightmap.Values[(heightmap.Height - xPos - 1) * heightmap.Width + yPos];
break;
case 2:
height =
heightmap
.Values[(heightmap.Height - yPos - 1) * heightmap.Width + (heightmap.Width - xPos - 1)];
break;
default:
height = heightmap.Values[xPos * heightmap.Width + (heightmap.Height - yPos - 1)];
break;
}
return height >= 110 && height <= 125;
}
}
return false;

View File

@@ -117,6 +117,8 @@ namespace Game
}
LOG("min/max: %lli", bx::getHPCounter() - startTime);
mesh.MinPos = {-5.0f, -5.0f, -5.0f};
mesh.MaxPos = {5.0f, 5.0f, 5.0f};
mesh.Size = mesh.MaxPos - mesh.MinPos;
startTime = bx::getHPCounter();