From df506535919cf7a97879caf92ae7037fa326dc4a Mon Sep 17 00:00:00 2001 From: EchoesFromBeyond Date: Wed, 20 Jul 2022 12:26:46 -0700 Subject: [PATCH 1/3] Custom HotKeys for NoClip Add Custom HotKeys for NoClip for WASD and AltSpeed Key as well as Ascend and Descend Keys. --- .../src/user/cheat/player/NoClip.cpp | 43 ++++++++++++++++--- cheat-library/src/user/cheat/player/NoClip.h | 11 +++++ 2 files changed, 47 insertions(+), 7 deletions(-) diff --git a/cheat-library/src/user/cheat/player/NoClip.cpp b/cheat-library/src/user/cheat/player/NoClip.cpp index c32fa4c..5143bea 100644 --- a/cheat-library/src/user/cheat/player/NoClip.cpp +++ b/cheat-library/src/user/cheat/player/NoClip.cpp @@ -13,6 +13,7 @@ namespace cheat::feature app::Vector3 zero; NoClip::NoClip() : Feature(), +<<<<<<< Updated upstream NF(f_Enabled, "No clip", "NoClip", false), NF(f_NoAnimation, "No Animation", "NoClip", true), NF(f_Speed, "Speed", "NoClip", 5.5f), @@ -21,6 +22,23 @@ namespace cheat::feature NF(f_FreeflightMode, "Freeflight mode", "NoClip", false), NF(f_AltSpeedEnabled, "Alt speed enabled", "NoClip", false), NF(f_AltSpeed, "Alt speed", "NoClip", 1.0f) +======= + NF(f_Enabled, "No clip", "NoClip", false), + NF(f_NoAnimation, "No Animation", "NoClip", true), + NF(f_ForwardKey, "Forward HotKey", "NoClip", Hotkey(ImGuiKey_W)), + NF(f_LeftKey, "Left HotKey", "NoClip", Hotkey(ImGuiKey_A)), + NF(f_BackKey, "Back HotKey", "NoClip", Hotkey(ImGuiKey_S)), + NF(f_RightKey, "Right HotKey", "NoClip", Hotkey(ImGuiKey_D)), + NF(f_AscendKey, "Ascend HotKey", "NoClip", Hotkey(ImGuiKey_Space)), + NF(f_DescendKey, "Descend HotKey", "NoClip", Hotkey(ImGuiKey_ModShift)), + NF(f_Speed, "Speed", "NoClip", 5.5f), + NF(f_CameraRelative, "Relative to camera", "NoClip", true), + NF(f_VelocityMode, "Velocity mode", "NoClip", false), + NF(f_FreeflightMode, "Freeflight mode", "NoClip", false), + NF(f_AltSpeedEnabled, "Alt speed enabled", "NoClip", false), + NF(f_AltSpeed, "Alt speed", "NoClip", 1.0f), + NF(f_AltSpeedKey, "Alt Speed Hotkey", "NoClip", Hotkey(ImGuiKey_ModCtrl)) +>>>>>>> Stashed changes { HookManager::install(app::MoleMole_HumanoidMoveFSM_LateTick, HumanoidMoveFSM_LateTick_Hook); @@ -41,6 +59,16 @@ namespace cheat::feature ConfigWidget("No Animation", f_NoAnimation, "Disables player animations."); +<<<<<<< Updated upstream +======= + ConfigWidget("Forward HotKey", f_ForwardKey, "Set Forward Key"); + ConfigWidget("Left HotKey", f_LeftKey, "Set Left Key"); + ConfigWidget("Back HotKey", f_BackKey, "Set Back Key"); + ConfigWidget("Right HotKey", f_RightKey, "Set Right Key"); + ConfigWidget("Ascend HotKey", f_AscendKey, "Set Ascend Key"); + ConfigWidget("Descend HotKey", f_DescendKey, "Set Descend Key"); + +>>>>>>> Stashed changes ConfigWidget("Speed", f_Speed, 0.1f, 2.0f, 100.0f, "No-clip move speed.\n" \ "Not recommended setting above 5.0."); @@ -56,7 +84,8 @@ namespace cheat::feature ConfigWidget("Alt Speed", f_AltSpeed, 0.1f, 2.0f, 100.0f, "Alternate no-clip move speed.\n" \ "Not recommended setting above 5.0."); - + + ConfigWidget("Alt Speed Key", f_AltSpeedKey, "Set AltSpeed HotKey"); ConfigWidget("Velocity mode", f_VelocityMode,"Use velocity instead of position to move."); ConfigWidget("Freeflight mode", f_FreeflightMode,"Don't remove collisions"); } @@ -128,23 +157,23 @@ namespace cheat::feature auto relativeEntity = f_CameraRelative ? &cameraEntity : avatarEntity; float speed = f_Speed.value(); - if (f_AltSpeedEnabled && Hotkey(VK_LCONTROL).IsPressed()) + if (f_AltSpeedEnabled && f_AltSpeedKey.value().IsPressed()) speed = f_AltSpeed.value(); app::Vector3 dir = {}; - if (Hotkey('W').IsPressed()) + if (f_ForwardKey.value().IsPressed()) dir = dir + relativeEntity->forward(); - if (Hotkey('S').IsPressed()) + if (f_BackKey.value().IsPressed()) dir = dir + relativeEntity->back(); - if (Hotkey('D').IsPressed()) + if (f_RightKey.value().IsPressed()) dir = dir + relativeEntity->right(); - if (Hotkey('A').IsPressed()) + if (f_LeftKey.value().IsPressed()) dir = dir + relativeEntity->left(); - if (Hotkey(VK_SPACE).IsPressed()) + if (f_AscendKey.value().IsPressed()) dir = dir + avatarEntity->up(); if (Hotkey(ImGuiKey_ModShift).IsPressed()) diff --git a/cheat-library/src/user/cheat/player/NoClip.h b/cheat-library/src/user/cheat/player/NoClip.h index ecfc01d..613fad1 100644 --- a/cheat-library/src/user/cheat/player/NoClip.h +++ b/cheat-library/src/user/cheat/player/NoClip.h @@ -12,6 +12,16 @@ namespace cheat::feature public: config::Field> f_Enabled; config::Field> f_NoAnimation; +<<<<<<< Updated upstream +======= + + config::Field f_ForwardKey; + config::Field f_LeftKey; + config::Field f_RightKey; + config::Field f_BackKey; + config::Field f_AscendKey; + config::Field f_DescendKey; +>>>>>>> Stashed changes config::Field f_Speed; config::Field f_CameraRelative; @@ -20,6 +30,7 @@ namespace cheat::feature config::Field f_AltSpeedEnabled; config::Field f_AltSpeed; + config::Field f_AltSpeedKey; static NoClip& GetInstance(); From 2edc6aa81b6f90a5e13fe7e7309b59bf4c6fd0c2 Mon Sep 17 00:00:00 2001 From: EchoesFromBeyond Date: Wed, 20 Jul 2022 13:09:51 -0700 Subject: [PATCH 2/3] Updated to Include a Toggle for using CustomKeys Added Toggle for Using Custom Keys to make sure everyone is happy so they dont have to use them if they dont want to. --- .../src/user/cheat/player/NoClip.cpp | 103 +++++++++++------- cheat-library/src/user/cheat/player/NoClip.h | 6 +- 2 files changed, 64 insertions(+), 45 deletions(-) diff --git a/cheat-library/src/user/cheat/player/NoClip.cpp b/cheat-library/src/user/cheat/player/NoClip.cpp index 5143bea..59b9c1c 100644 --- a/cheat-library/src/user/cheat/player/NoClip.cpp +++ b/cheat-library/src/user/cheat/player/NoClip.cpp @@ -13,32 +13,23 @@ namespace cheat::feature app::Vector3 zero; NoClip::NoClip() : Feature(), -<<<<<<< Updated upstream - NF(f_Enabled, "No clip", "NoClip", false), - NF(f_NoAnimation, "No Animation", "NoClip", true), - NF(f_Speed, "Speed", "NoClip", 5.5f), - NF(f_CameraRelative, "Relative to camera", "NoClip", true), - NF(f_VelocityMode, "Velocity mode", "NoClip", false), - NF(f_FreeflightMode, "Freeflight mode", "NoClip", false), - NF(f_AltSpeedEnabled, "Alt speed enabled", "NoClip", false), - NF(f_AltSpeed, "Alt speed", "NoClip", 1.0f) -======= - NF(f_Enabled, "No clip", "NoClip", false), - NF(f_NoAnimation, "No Animation", "NoClip", true), + NF(f_Enabled, "No clip", "NoClip", false), + NF(f_NoAnimation, "No Animation", "NoClip", true), + NF(f_UseCustomKeys, "Use Custom Hotkeys", "NoClip", false), NF(f_ForwardKey, "Forward HotKey", "NoClip", Hotkey(ImGuiKey_W)), NF(f_LeftKey, "Left HotKey", "NoClip", Hotkey(ImGuiKey_A)), NF(f_BackKey, "Back HotKey", "NoClip", Hotkey(ImGuiKey_S)), NF(f_RightKey, "Right HotKey", "NoClip", Hotkey(ImGuiKey_D)), NF(f_AscendKey, "Ascend HotKey", "NoClip", Hotkey(ImGuiKey_Space)), NF(f_DescendKey, "Descend HotKey", "NoClip", Hotkey(ImGuiKey_ModShift)), + NF(f_AltSpeedKey, "Alt Speed Hotkey", "NoClip", Hotkey(ImGuiKey_ModCtrl)), NF(f_Speed, "Speed", "NoClip", 5.5f), NF(f_CameraRelative, "Relative to camera", "NoClip", true), NF(f_VelocityMode, "Velocity mode", "NoClip", false), NF(f_FreeflightMode, "Freeflight mode", "NoClip", false), NF(f_AltSpeedEnabled, "Alt speed enabled", "NoClip", false), - NF(f_AltSpeed, "Alt speed", "NoClip", 1.0f), - NF(f_AltSpeedKey, "Alt Speed Hotkey", "NoClip", Hotkey(ImGuiKey_ModCtrl)) ->>>>>>> Stashed changes + NF(f_AltSpeed, "Alt speed", "NoClip", 1.0f) + { HookManager::install(app::MoleMole_HumanoidMoveFSM_LateTick, HumanoidMoveFSM_LateTick_Hook); @@ -59,16 +50,18 @@ namespace cheat::feature ConfigWidget("No Animation", f_NoAnimation, "Disables player animations."); -<<<<<<< Updated upstream -======= - ConfigWidget("Forward HotKey", f_ForwardKey, "Set Forward Key"); - ConfigWidget("Left HotKey", f_LeftKey, "Set Left Key"); - ConfigWidget("Back HotKey", f_BackKey, "Set Back Key"); - ConfigWidget("Right HotKey", f_RightKey, "Set Right Key"); - ConfigWidget("Ascend HotKey", f_AscendKey, "Set Ascend Key"); - ConfigWidget("Descend HotKey", f_DescendKey, "Set Descend Key"); + ConfigWidget("Use Custom Keys", f_UseCustomKeys, "Enable the Use of Custom HotKeys"); + + if (f_UseCustomKeys) { + ConfigWidget("Forward HotKey", f_ForwardKey, "Set Forward Key"); + ConfigWidget("Left HotKey", f_LeftKey, "Set Left Key"); + ConfigWidget("Back HotKey", f_BackKey, "Set Back Key"); + ConfigWidget("Right HotKey", f_RightKey, "Set Right Key"); + ConfigWidget("Ascend HotKey", f_AscendKey, "Set Ascend Key"); + ConfigWidget("Descend HotKey", f_DescendKey, "Set Descend Key"); + ConfigWidget("Alt Speed Key", f_AltSpeedKey, "Set AltSpeed HotKey"); + } ->>>>>>> Stashed changes ConfigWidget("Speed", f_Speed, 0.1f, 2.0f, 100.0f, "No-clip move speed.\n" \ "Not recommended setting above 5.0."); @@ -84,8 +77,7 @@ namespace cheat::feature ConfigWidget("Alt Speed", f_AltSpeed, 0.1f, 2.0f, 100.0f, "Alternate no-clip move speed.\n" \ "Not recommended setting above 5.0."); - - ConfigWidget("Alt Speed Key", f_AltSpeedKey, "Set AltSpeed HotKey"); + ConfigWidget("Velocity mode", f_VelocityMode,"Use velocity instead of position to move."); ConfigWidget("Freeflight mode", f_FreeflightMode,"Don't remove collisions"); } @@ -157,28 +149,57 @@ namespace cheat::feature auto relativeEntity = f_CameraRelative ? &cameraEntity : avatarEntity; float speed = f_Speed.value(); - if (f_AltSpeedEnabled && f_AltSpeedKey.value().IsPressed()) - speed = f_AltSpeed.value(); + if (f_AltSpeedEnabled) { + if (!f_UseCustomKeys && Hotkey(ImGuiKey_ModCtrl).IsPressed()) { + speed = f_AltSpeed.value(); + } + if (f_UseCustomKeys && f_AltSpeedKey.value().IsPressed()) { + speed = f_AltSpeed.value(); + } + } app::Vector3 dir = {}; - if (f_ForwardKey.value().IsPressed()) - dir = dir + relativeEntity->forward(); - if (f_BackKey.value().IsPressed()) - dir = dir + relativeEntity->back(); + if (f_UseCustomKeys) { + if (f_ForwardKey.value().IsPressed()) + dir = dir + relativeEntity->forward(); - if (f_RightKey.value().IsPressed()) - dir = dir + relativeEntity->right(); + if (f_BackKey.value().IsPressed()) + dir = dir + relativeEntity->back(); - if (f_LeftKey.value().IsPressed()) - dir = dir + relativeEntity->left(); + if (f_RightKey.value().IsPressed()) + dir = dir + relativeEntity->right(); - if (f_AscendKey.value().IsPressed()) - dir = dir + avatarEntity->up(); + if (f_LeftKey.value().IsPressed()) + dir = dir + relativeEntity->left(); + + if (f_AscendKey.value().IsPressed()) + dir = dir + avatarEntity->up(); + + if (f_DescendKey.value().IsPressed()) + dir = dir + avatarEntity->down(); + } + + if (!f_UseCustomKeys) { + if (Hotkey(ImGuiKey_W).IsPressed()) + dir = dir + relativeEntity->forward(); + + if (Hotkey(ImGuiKey_S).IsPressed()) + dir = dir + relativeEntity->back(); + + if (Hotkey(ImGuiKey_D).IsPressed()) + dir = dir + relativeEntity->right(); + + if (Hotkey(ImGuiKey_A).IsPressed()) + dir = dir + relativeEntity->left(); + + if (Hotkey(ImGuiKey_Space).IsPressed()) + dir = dir + avatarEntity->up(); + + if (Hotkey(ImGuiKey_ModShift).IsPressed()) + dir = dir + avatarEntity->down(); + } - if (Hotkey(ImGuiKey_ModShift).IsPressed()) - dir = dir + avatarEntity->down(); - app::Vector3 prevPos = avatarEntity->relativePosition(); if (IsVectorZero(prevPos)) return; diff --git a/cheat-library/src/user/cheat/player/NoClip.h b/cheat-library/src/user/cheat/player/NoClip.h index 613fad1..a1b1e2e 100644 --- a/cheat-library/src/user/cheat/player/NoClip.h +++ b/cheat-library/src/user/cheat/player/NoClip.h @@ -12,16 +12,15 @@ namespace cheat::feature public: config::Field> f_Enabled; config::Field> f_NoAnimation; -<<<<<<< Updated upstream -======= + config::Field f_UseCustomKeys; config::Field f_ForwardKey; config::Field f_LeftKey; config::Field f_RightKey; config::Field f_BackKey; config::Field f_AscendKey; config::Field f_DescendKey; ->>>>>>> Stashed changes + config::Field f_AltSpeedKey; config::Field f_Speed; config::Field f_CameraRelative; @@ -30,7 +29,6 @@ namespace cheat::feature config::Field f_AltSpeedEnabled; config::Field f_AltSpeed; - config::Field f_AltSpeedKey; static NoClip& GetInstance(); From 7bad3b025fddcfb7a03f21df1644e7a50ea80bd7 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Wed, 20 Jul 2022 21:33:24 -0600 Subject: [PATCH 3/3] code refactor --- .../src/user/cheat/player/NoClip.cpp | 168 ++++++++---------- 1 file changed, 70 insertions(+), 98 deletions(-) diff --git a/cheat-library/src/user/cheat/player/NoClip.cpp b/cheat-library/src/user/cheat/player/NoClip.cpp index 59b9c1c..6982c45 100644 --- a/cheat-library/src/user/cheat/player/NoClip.cpp +++ b/cheat-library/src/user/cheat/player/NoClip.cpp @@ -7,13 +7,13 @@ #include #include -namespace cheat::feature +namespace cheat::feature { static void HumanoidMoveFSM_LateTick_Hook(app::HumanoidMoveFSM* __this, float deltaTime, MethodInfo* method); app::Vector3 zero; - NoClip::NoClip() : Feature(), - NF(f_Enabled, "No clip", "NoClip", false), + NoClip::NoClip() : Feature(), + NF(f_Enabled, "No clip", "NoClip", false), NF(f_NoAnimation, "No Animation", "NoClip", true), NF(f_UseCustomKeys, "Use Custom Hotkeys", "NoClip", false), NF(f_ForwardKey, "Forward HotKey", "NoClip", Hotkey(ImGuiKey_W)), @@ -23,33 +23,53 @@ namespace cheat::feature NF(f_AscendKey, "Ascend HotKey", "NoClip", Hotkey(ImGuiKey_Space)), NF(f_DescendKey, "Descend HotKey", "NoClip", Hotkey(ImGuiKey_ModShift)), NF(f_AltSpeedKey, "Alt Speed Hotkey", "NoClip", Hotkey(ImGuiKey_ModCtrl)), - NF(f_Speed, "Speed", "NoClip", 5.5f), - NF(f_CameraRelative, "Relative to camera", "NoClip", true), - NF(f_VelocityMode, "Velocity mode", "NoClip", false), - NF(f_FreeflightMode, "Freeflight mode", "NoClip", false), - NF(f_AltSpeedEnabled, "Alt speed enabled", "NoClip", false), - NF(f_AltSpeed, "Alt speed", "NoClip", 1.0f) + NF(f_Speed, "Speed", "NoClip", 5.5f), + NF(f_CameraRelative, "Relative to camera", "NoClip", true), + NF(f_VelocityMode, "Velocity mode", "NoClip", false), + NF(f_FreeflightMode, "Freeflight mode", "NoClip", false), + NF(f_AltSpeedEnabled, "Alt speed enabled", "NoClip", false), + NF(f_AltSpeed, "Alt speed", "NoClip", 1.0f) - { + { HookManager::install(app::MoleMole_HumanoidMoveFSM_LateTick, HumanoidMoveFSM_LateTick_Hook); events::GameUpdateEvent += MY_METHOD_HANDLER(NoClip::OnGameUpdate); events::MoveSyncEvent += MY_METHOD_HANDLER(NoClip::OnMoveSync); - } + } - const FeatureGUIInfo& NoClip::GetGUIInfo() const - { - static const FeatureGUIInfo info{ "No-Clip", "Player", true }; - return info; - } + const FeatureGUIInfo& NoClip::GetGUIInfo() const + { + static const FeatureGUIInfo info{ "No-Clip", "Player", true }; + return info; + } - void NoClip::DrawMain() - { + void NoClip::DrawMain() + { ConfigWidget("Enabled", f_Enabled, "Enables no-clip (fast speed + no collision).\n" \ - "To move, use WASD, Space (go up), and Shift (go down)."); + "To move, use WASD, Space (go up), and Shift (go down), or customize your own keys."); ConfigWidget("No Animation", f_NoAnimation, "Disables player animations."); + ConfigWidget("Speed", f_Speed, 0.1f, 2.0f, 100.0f, + "No-clip move speed.\n" \ + "Not recommended setting above 5.0."); + + ConfigWidget("Camera-relative movement", f_CameraRelative, + "Move relative to camera view instead of avatar view/direction."); + + ConfigWidget("Alternate No-clip", f_AltSpeedEnabled, + "Allows usage of alternate speed when holding down LeftCtrl key.\n" \ + "Useful if you want to temporarily go faster/slower than the no-clip speed setting."); + + if (f_AltSpeedEnabled) { + ConfigWidget("Alt Speed", f_AltSpeed, 0.1f, 2.0f, 100.0f, + "Alternate no-clip move speed.\n" \ + "Not recommended setting above 5.0."); + + ConfigWidget("Velocity mode", f_VelocityMode, "Use velocity instead of position to move."); + ConfigWidget("Freeflight mode", f_FreeflightMode, "Don't remove collisions"); + } + ConfigWidget("Use Custom Keys", f_UseCustomKeys, "Enable the Use of Custom HotKeys"); if (f_UseCustomKeys) { @@ -61,47 +81,27 @@ namespace cheat::feature ConfigWidget("Descend HotKey", f_DescendKey, "Set Descend Key"); ConfigWidget("Alt Speed Key", f_AltSpeedKey, "Set AltSpeed HotKey"); } + } - ConfigWidget("Speed", f_Speed, 0.1f, 2.0f, 100.0f, - "No-clip move speed.\n" \ - "Not recommended setting above 5.0."); + bool NoClip::NeedStatusDraw() const + { + return f_Enabled; + } - ConfigWidget("Camera-relative movement", f_CameraRelative, - "Move relative to camera view instead of avatar view/direction."); - - ConfigWidget("Alternate No-clip", f_AltSpeedEnabled, - "Allows usage of alternate speed when holding down LeftCtrl key.\n" \ - "Useful if you want to temporarily go faster/slower than the no-clip speed setting."); - - if (f_AltSpeedEnabled) { - ConfigWidget("Alt Speed", f_AltSpeed, 0.1f, 2.0f, 100.0f, - "Alternate no-clip move speed.\n" \ - "Not recommended setting above 5.0."); - - ConfigWidget("Velocity mode", f_VelocityMode,"Use velocity instead of position to move."); - ConfigWidget("Freeflight mode", f_FreeflightMode,"Don't remove collisions"); - } - } - - bool NoClip::NeedStatusDraw() const -{ - return f_Enabled; - } - - void NoClip::DrawStatus() - { + void NoClip::DrawStatus() + { ImGui::Text("NoClip%s[%.01f%s%|%s]", f_AltSpeedEnabled ? "+Alt " : " ", f_Speed.value(), f_AltSpeedEnabled ? fmt::format("|{:.1f}", f_AltSpeed.value()).c_str() : "", f_CameraRelative ? "CR" : "PR"); - } + } - NoClip& NoClip::GetInstance() - { - static NoClip instance; - return instance; - } + NoClip& NoClip::GetInstance() + { + static NoClip instance; + return instance; + } // No clip update function. // We just disabling collision detect and move avatar when no clip moving keys pressed. @@ -110,7 +110,7 @@ namespace cheat::feature static bool isApplied = false; auto& manager = game::EntityManager::instance(); - + if (!f_Enabled && isApplied) { auto avatarEntity = manager.avatar(); @@ -119,7 +119,7 @@ namespace cheat::feature return; app::Rigidbody_set_detectCollisions(rigidBody, true, nullptr); - + isApplied = false; } @@ -141,65 +141,37 @@ namespace cheat::feature return; if (!f_FreeflightMode) app::Rigidbody_set_detectCollisions(rigidBody, false, nullptr); - + if (!f_VelocityMode) - app::Rigidbody_set_velocity(rigidBody, zero,nullptr); + app::Rigidbody_set_velocity(rigidBody, zero, nullptr); auto cameraEntity = game::Entity(reinterpret_cast(manager.mainCamera())); auto relativeEntity = f_CameraRelative ? &cameraEntity : avatarEntity; float speed = f_Speed.value(); - if (f_AltSpeedEnabled) { - if (!f_UseCustomKeys && Hotkey(ImGuiKey_ModCtrl).IsPressed()) { - speed = f_AltSpeed.value(); - } - if (f_UseCustomKeys && f_AltSpeedKey.value().IsPressed()) { - speed = f_AltSpeed.value(); - } - } + if (f_AltSpeedEnabled ? f_UseCustomKeys ? f_AltSpeedKey.value().IsPressed() : Hotkey(ImGuiKey_ModCtrl).IsPressed() : NULL) + speed = f_AltSpeed.value(); app::Vector3 dir = {}; - if (f_UseCustomKeys) { - if (f_ForwardKey.value().IsPressed()) - dir = dir + relativeEntity->forward(); + if (f_UseCustomKeys ? f_ForwardKey.value().IsPressed() : Hotkey(ImGuiKey_W).IsPressed()) + dir = dir + relativeEntity->forward(); - if (f_BackKey.value().IsPressed()) - dir = dir + relativeEntity->back(); + if (f_UseCustomKeys ? f_BackKey.value().IsPressed() : Hotkey(ImGuiKey_S).IsPressed()) + dir = dir + relativeEntity->back(); - if (f_RightKey.value().IsPressed()) - dir = dir + relativeEntity->right(); + if (f_UseCustomKeys ? f_RightKey.value().IsPressed() : Hotkey(ImGuiKey_D).IsPressed()) + dir = dir + relativeEntity->right(); - if (f_LeftKey.value().IsPressed()) - dir = dir + relativeEntity->left(); + if (f_UseCustomKeys ? f_LeftKey.value().IsPressed() : Hotkey(ImGuiKey_A).IsPressed()) + dir = dir + relativeEntity->left(); - if (f_AscendKey.value().IsPressed()) - dir = dir + avatarEntity->up(); + if (f_UseCustomKeys ? f_AscendKey.value().IsPressed() : Hotkey(ImGuiKey_Space).IsPressed()) + dir = dir + avatarEntity->up(); - if (f_DescendKey.value().IsPressed()) - dir = dir + avatarEntity->down(); - } + if (f_UseCustomKeys ? f_DescendKey.value().IsPressed() : Hotkey(ImGuiKey_ModShift).IsPressed()) + dir = dir + avatarEntity->down(); - if (!f_UseCustomKeys) { - if (Hotkey(ImGuiKey_W).IsPressed()) - dir = dir + relativeEntity->forward(); - - if (Hotkey(ImGuiKey_S).IsPressed()) - dir = dir + relativeEntity->back(); - - if (Hotkey(ImGuiKey_D).IsPressed()) - dir = dir + relativeEntity->right(); - - if (Hotkey(ImGuiKey_A).IsPressed()) - dir = dir + relativeEntity->left(); - - if (Hotkey(ImGuiKey_Space).IsPressed()) - dir = dir + avatarEntity->up(); - - if (Hotkey(ImGuiKey_ModShift).IsPressed()) - dir = dir + avatarEntity->down(); - } - app::Vector3 prevPos = avatarEntity->relativePosition(); if (IsVectorZero(prevPos)) return;