detection range

This commit is contained in:
ackimixs
2024-05-28 18:19:22 +02:00
parent bfa6b8096c
commit 27b20d3b12
2 changed files with 3 additions and 3 deletions

View File

@@ -47,8 +47,8 @@ void GameControllerHandler::handleMessage(const std::string &message) {
if (distance <= 100) {
strength = 0xFFFF;
} else if (distance <= 300) {
double factor = 1 - Modelec::mapValue(distance, 100.0, this->lidarDectectionDistance, 0.0, 1.0);
} else if (distance <= 400) {
double factor = 1 - Modelec::mapValue(distance, 200.0, this->lidarDectectionDistance, 0.0, 1.0);
strength = static_cast<Uint16>(factor * 0xFFFF);
} else {
strength = 0;

View File

@@ -27,7 +27,7 @@ public:
private:
SDL_GameController* controller;
double lidarDectectionDistance = 0;
double lidarDectectionDistance = 400;
bool rumble = true;
};