From 8adf27acfbe599b6346d22f2b43e438de5b31d9a Mon Sep 17 00:00:00 2001 From: ackimixs Date: Wed, 15 May 2024 16:15:03 +0200 Subject: [PATCH] PI --- GameControllerHandler.h | 4 ++-- utils.h | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/GameControllerHandler.h b/GameControllerHandler.h index 75d1383..37c3da1 100644 --- a/GameControllerHandler.h +++ b/GameControllerHandler.h @@ -42,13 +42,13 @@ public: if (tokens[2] == "stop proximity") { std::vector args = Utils::split(tokens[3], ","); int distance = stoi(args[0]); - double angle = stod(args[1]) / 100; + double angle = (stod(args[1]) / 100) + (PI / 2); Uint16 strength = 0xFFFF; if (distance < 200) { strength = static_cast((200 - distance) * 0xFFFF / 200); - double angleFactor = std::abs(std::sin(angle)); + double angleFactor = 1 - std::abs(std::sin(angle)); strength *= angleFactor; } diff --git a/utils.h b/utils.h index 5062974..8e1f019 100644 --- a/utils.h +++ b/utils.h @@ -2,6 +2,8 @@ #include #include +#define PI 3.14159265358979323846 + namespace Utils { inline bool startWith(const std::string& str, const std::string& start) {