Improve floor detection for multi-story buildings

- Increase footprint sampling radius from 0.28 to 0.4 units
- Only update floor cache if found floor is close to query height
- Prevents caching wrong floor from different stories
This commit is contained in:
Kelsi 2026-02-05 17:46:30 -08:00
parent e768f5048c
commit bf6a5ba596
2 changed files with 7 additions and 5 deletions

View file

@ -518,9 +518,9 @@ void CameraController::update(float deltaTime) {
return base;
};
// Sample center + small footprint to avoid slipping through narrow floor pieces.
// Sample center + footprint to avoid slipping through narrow floor pieces.
std::optional<float> groundH;
constexpr float FOOTPRINT = 0.28f;
constexpr float FOOTPRINT = 0.4f; // Larger footprint for better floor detection
const glm::vec2 offsets[] = {
{0.0f, 0.0f},
{FOOTPRINT, 0.0f}, {-FOOTPRINT, 0.0f},
@ -824,7 +824,7 @@ void CameraController::update(float deltaTime) {
};
std::optional<float> groundH;
constexpr float FOOTPRINT = 0.28f;
constexpr float FOOTPRINT = 0.4f; // Larger footprint for better floor detection
const glm::vec2 offsets[] = {
{0.0f, 0.0f}, {FOOTPRINT, 0.0f}, {-FOOTPRINT, 0.0f}, {0.0f, FOOTPRINT}, {0.0f, -FOOTPRINT}
};