fix collision
This commit is contained in:
@@ -241,10 +241,26 @@ namespace Game
|
|||||||
float fracOffsetY = scaledOffset.z - offsetY;
|
float fracOffsetY = scaledOffset.z - offsetY;
|
||||||
int32_t xPos = (int32_t)(fracOffsetX * heightmap.Width);
|
int32_t xPos = (int32_t)(fracOffsetX * heightmap.Width);
|
||||||
int32_t yPos = (int32_t)(fracOffsetY * heightmap.Height);
|
int32_t yPos = (int32_t)(fracOffsetY * heightmap.Height);
|
||||||
uint8_t height = heightmap.Values[yPos * heightmap.Width + xPos];
|
|
||||||
|
|
||||||
LOG("Height: %u", height);
|
uint8_t height = 0;
|
||||||
return height > 230;
|
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;
|
return false;
|
||||||
|
|||||||
@@ -117,6 +117,8 @@ namespace Game
|
|||||||
}
|
}
|
||||||
LOG("min/max: %lli", bx::getHPCounter() - startTime);
|
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;
|
mesh.Size = mesh.MaxPos - mesh.MinPos;
|
||||||
|
|
||||||
startTime = bx::getHPCounter();
|
startTime = bx::getHPCounter();
|
||||||
|
|||||||
Reference in New Issue
Block a user