From d7f91f239380a08d376d256b615bd5e7a2b166bf Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Sun, 24 Jul 2022 21:24:36 -0600 Subject: [PATCH 1/2] Fix #32 , Added Freeze Enemies --- cheat-library/cheat-library.vcxproj | 2 + cheat-library/cheat-library.vcxproj.filters | 6 ++ cheat-library/src/appdata/il2cpp-functions.h | 4 ++ cheat-library/src/user/cheat/cheat.cpp | 2 + cheat-library/src/user/cheat/game/Entity.cpp | 12 ++++ cheat-library/src/user/cheat/game/Entity.h | 3 +- .../src/user/cheat/player/NoClip.cpp | 4 ++ .../src/user/cheat/world/FreezeEnemies.cpp | 60 +++++++++++++++++++ .../src/user/cheat/world/FreezeEnemies.h | 27 +++++++++ 9 files changed, 119 insertions(+), 1 deletion(-) create mode 100644 cheat-library/src/user/cheat/world/FreezeEnemies.cpp create mode 100644 cheat-library/src/user/cheat/world/FreezeEnemies.h diff --git a/cheat-library/cheat-library.vcxproj b/cheat-library/cheat-library.vcxproj index d84be75..4fd1b85 100644 --- a/cheat-library/cheat-library.vcxproj +++ b/cheat-library/cheat-library.vcxproj @@ -95,6 +95,7 @@ + @@ -182,6 +183,7 @@ + diff --git a/cheat-library/cheat-library.vcxproj.filters b/cheat-library/cheat-library.vcxproj.filters index 494df5e..fca6000 100644 --- a/cheat-library/cheat-library.vcxproj.filters +++ b/cheat-library/cheat-library.vcxproj.filters @@ -246,6 +246,9 @@ Header Files + + Header Files + @@ -450,6 +453,9 @@ Source Files + + Source Files + diff --git a/cheat-library/src/appdata/il2cpp-functions.h b/cheat-library/src/appdata/il2cpp-functions.h index e7a94dc..d292c64 100644 --- a/cheat-library/src/appdata/il2cpp-functions.h +++ b/cheat-library/src/appdata/il2cpp-functions.h @@ -255,6 +255,7 @@ DO_APP_FUNC(0x03187C30, Vector3, MoleMole_BaseEntity_GetRight, (BaseEntity* __th DO_APP_FUNC(0x03185DC0, Vector3, MoleMole_BaseEntity_GetUp, (BaseEntity* __this, MethodInfo* method)); DO_APP_FUNC(0x031A5120, bool, MoleMole_BaseEntity_IsActive, (BaseEntity* __this, MethodInfo* method)); DO_APP_FUNC(0x031AFEE0, Rigidbody*, MoleMole_BaseEntity_GetRigidbody, (BaseEntity* __this, MethodInfo* method)); +DO_APP_FUNC(0x0318DB20, Animator*, MoleMole_BaseEntity_get_animator, (BaseEntity* __this, MethodInfo* method)); // type should be 'MoleMole_VCCharacterCombat' not 'MoleMole_VCBaseMove' // function name should be 'GetVisualCombatComponent' not 'GetMoveComponent' @@ -318,6 +319,7 @@ DO_APP_FUNC(0x057E4470, void, Cursor_set_visible, (bool value, MethodInfo* metho DO_APP_FUNC(0x057E4460, void, Cursor_set_lockState, (CursorLockMode__Enum value, MethodInfo* method)); DO_APP_FUNC(0x057E4450, bool, Cursor_get_visible, (MethodInfo* method)); +DO_APP_FUNC(0x0571E980, void, Rigidbody_set_collisionDetectionMode, (Rigidbody* __this, CollisionDetectionMode__Enum value, MethodInfo* method)); DO_APP_FUNC(0x0571E9A0, void, Rigidbody_set_detectCollisions, (Rigidbody* __this, bool value, MethodInfo* method)); DO_APP_FUNC(0x0571E9E0, void, Rigidbody_set_isKinematic, (Rigidbody* __this, bool value, MethodInfo* method)); DO_APP_FUNC(0x0571E8F0, Vector3, Rigidbody_get_velocity, (Rigidbody* __this, MethodInfo* method)); @@ -335,6 +337,8 @@ DO_APP_FUNC(0x057E9D10, int32_t, Camera_get_pixelHeight, (Camera* __this, Method DO_APP_FUNC(0x0579EB70, int32_t, Screen_get_width, (MethodInfo* method)); DO_APP_FUNC(0x0579EB00, int32_t, Screen_get_height, (MethodInfo* method)); +DO_APP_FUNC(0x058236F0, void, Animator_set_speed, (Animator* __this, float value, MethodInfo* method)); + DO_APP_FUNC(0x058AE2D0, bool, Behaviour_get_isActiveAndEnabled, (Behaviour* __this, MethodInfo* method)); DO_APP_FUNC(0x05891610, Vector3, Quaternion_ToEulerAngles, (Quaternion rotation, MethodInfo* method)); diff --git a/cheat-library/src/user/cheat/cheat.cpp b/cheat-library/src/user/cheat/cheat.cpp index 249b63a..687f565 100644 --- a/cheat-library/src/user/cheat/cheat.cpp +++ b/cheat-library/src/user/cheat/cheat.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -91,6 +92,7 @@ namespace cheat FEAT_INST(VacuumLoot), FEAT_INST(DialogSkip), FEAT_INST(DumbEnemies), + FEAT_INST(FreezeEnemies), FEAT_INST(ElementalSight), FEAT_INST(KillAura), FEAT_INST(MobVacuum), diff --git a/cheat-library/src/user/cheat/game/Entity.cpp b/cheat-library/src/user/cheat/game/Entity.cpp index 71f564d..37c3747 100644 --- a/cheat-library/src/user/cheat/game/Entity.cpp +++ b/cheat-library/src/user/cheat/game/Entity.cpp @@ -205,6 +205,18 @@ namespace cheat::game SAFE_END(); } + app::Animator* Entity::animator() + { + if (!isLoaded()) + return nullptr; + + SAFE_BEGIN(); + return app::MoleMole_BaseEntity_get_animator(m_RawEntity, nullptr); + SAFE_ERROR(); + return nullptr; + SAFE_END(); + } + app::GameObject* Entity::gameObject() { if (!isLoaded()) diff --git a/cheat-library/src/user/cheat/game/Entity.h b/cheat-library/src/user/cheat/game/Entity.h index 65126ab..6a4e9b2 100644 --- a/cheat-library/src/user/cheat/game/Entity.h +++ b/cheat-library/src/user/cheat/game/Entity.h @@ -37,7 +37,8 @@ namespace cheat::game app::GameObject* gameObject(); app::Rigidbody* rigidbody(); - + app::Animator* animator(); + app::Vector3 forward(); app::Vector3 back(); app::Vector3 right(); diff --git a/cheat-library/src/user/cheat/player/NoClip.cpp b/cheat-library/src/user/cheat/player/NoClip.cpp index 6982c45..9a97c26 100644 --- a/cheat-library/src/user/cheat/player/NoClip.cpp +++ b/cheat-library/src/user/cheat/player/NoClip.cpp @@ -139,8 +139,12 @@ namespace cheat::feature auto rigidBody = avatarEntity->rigidbody(); if (rigidBody == nullptr) return; + if (!f_FreeflightMode) + { + app::Rigidbody_set_collisionDetectionMode(rigidBody, app::CollisionDetectionMode__Enum::Continuous, nullptr); app::Rigidbody_set_detectCollisions(rigidBody, false, nullptr); + } if (!f_VelocityMode) app::Rigidbody_set_velocity(rigidBody, zero, nullptr); diff --git a/cheat-library/src/user/cheat/world/FreezeEnemies.cpp b/cheat-library/src/user/cheat/world/FreezeEnemies.cpp new file mode 100644 index 0000000..b44cd50 --- /dev/null +++ b/cheat-library/src/user/cheat/world/FreezeEnemies.cpp @@ -0,0 +1,60 @@ +#include "pch-il2cpp.h" +#include "FreezeEnemies.h" + +#include + +#include +#include +#include + +namespace cheat::feature +{ + + FreezeEnemies::FreezeEnemies() : Feature(), + NF(f_Enabled, "Freeze Enemies", "FreezeEnemies", false) + { + events::GameUpdateEvent += MY_METHOD_HANDLER(FreezeEnemies::OnGameUpdate); + } + + const FeatureGUIInfo& FreezeEnemies::GetGUIInfo() const + { + static const FeatureGUIInfo info{ "", "World", false }; + return info; + } + + void FreezeEnemies::DrawMain() + { + ConfigWidget(f_Enabled, "Freezes all enemies' animation speed."); + } + + bool FreezeEnemies::NeedStatusDraw() const +{ + return f_Enabled; + } + + void FreezeEnemies::DrawStatus() + { + ImGui::Text("Freeze Enemies"); + } + + FreezeEnemies& FreezeEnemies::GetInstance() + { + static FreezeEnemies instance; + return instance; + } + + void FreezeEnemies::OnGameUpdate() + { + auto& manager = game::EntityManager::instance(); + + for (const auto& monster : manager.entities(game::filters::combined::Monsters)) + { + auto animator = monster->animator(); + if (animator == nullptr) + return; + + f_Enabled ? app::Animator_set_speed(animator, 0.f, nullptr) : app::Animator_set_speed(animator, 1.f, nullptr); + } + } +} + diff --git a/cheat-library/src/user/cheat/world/FreezeEnemies.h b/cheat-library/src/user/cheat/world/FreezeEnemies.h new file mode 100644 index 0000000..91741c4 --- /dev/null +++ b/cheat-library/src/user/cheat/world/FreezeEnemies.h @@ -0,0 +1,27 @@ +#pragma once +#include +#include + +namespace cheat::feature +{ + + class FreezeEnemies : public Feature + { + public: + config::Field> f_Enabled; + + static FreezeEnemies& GetInstance(); + + void OnGameUpdate(); + + const FeatureGUIInfo& GetGUIInfo() const override; + void DrawMain() override; + + virtual bool NeedStatusDraw() const override; + void DrawStatus() override; + + private: + FreezeEnemies(); + }; +} + From 77aa1de369c171cffaacdd0f3e98015ef799ad08 Mon Sep 17 00:00:00 2001 From: Joaquin <67109235+Taiga74164@users.noreply.github.com> Date: Sun, 24 Jul 2022 22:52:47 -0600 Subject: [PATCH 2/2] Solved #207 , Fixed some typos --- README.md | 11 ++++--- cheat-library/cheat-library.vcxproj | 4 +-- cheat-library/cheat-library.vcxproj.filters | 4 +-- cheat-library/src/appdata/il2cpp-functions.h | 2 ++ cheat-library/src/user/cheat/cheat.cpp | 4 +-- .../src/user/cheat/visuals/EnablePeaking.h | 25 --------------- .../{EnablePeaking.cpp => EnablePeeking.cpp} | 28 ++++++++--------- .../src/user/cheat/visuals/EnablePeeking.h | 25 +++++++++++++++ .../src/user/cheat/visuals/FreeCamera.cpp | 23 ++++++++++++++ .../src/user/cheat/visuals/FreeCamera.h | 1 + .../src/user/cheat/world/FreezeEnemies.cpp | 31 +++++++++++++------ 11 files changed, 99 insertions(+), 59 deletions(-) delete mode 100644 cheat-library/src/user/cheat/visuals/EnablePeaking.h rename cheat-library/src/user/cheat/visuals/{EnablePeaking.cpp => EnablePeeking.cpp} (59%) create mode 100644 cheat-library/src/user/cheat/visuals/EnablePeeking.h diff --git a/README.md b/README.md index eb7481e..09748d8 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ As well as setting up **`cheat-library`** as startup project. #### Player - Invincible - Attack Modifier -- No Cooldown Skill/Ultimate/Sprint +- No Cooldown Skill/Ultimate/Sprint/Bow - Unlimited Stamina - No Clip @@ -66,6 +66,7 @@ As well as setting up **`cheat-library`** as startup project. - Auto Seelie - Vacuum Loot - Dumb Enemies +- Freeze Enemies - Auto Destroy Objects - Auto Loot - Pickup Range @@ -92,7 +93,7 @@ As well as setting up **`cheat-library`** as startup project. - Chest Indicator - Hide UI - In-game Embedded Browser -- Enable Peaking +- Enable Peeking - Profile Changer - Free Camera - Texture Changer @@ -135,9 +136,9 @@ As well as setting up **`cheat-library`** as startup project.

Bugs

Welcome to the short explanation for bug reporting -1. You Found a bug. -1. write down what happened, as well as your first thoughts on what you think caused it. -1. can it be reproduced? Yes or no. If yes: Explain in as much clear as possible. i.e what happens when the bug occurs and why it occurs. +1. You found a bug. +1. Write down what happened, as well as your first thoughts on what you think caused it. +1. Can it be reproduced? Yes or no. If yes: Explain in as much clear as possible. i.e what happens when the bug occurs and why it occurs. 1. Tell us which version you are using. copy the `SHA`/ Version Number of the latest commit when you built the mod. For example: `bd17a00ec388f3b93624280cde9e1c66e740edf9` / Release 0.7 ## Bug reporting template diff --git a/cheat-library/cheat-library.vcxproj b/cheat-library/cheat-library.vcxproj index 4fd1b85..4b97d16 100644 --- a/cheat-library/cheat-library.vcxproj +++ b/cheat-library/cheat-library.vcxproj @@ -34,7 +34,7 @@ - + @@ -125,7 +125,7 @@ - + diff --git a/cheat-library/cheat-library.vcxproj.filters b/cheat-library/cheat-library.vcxproj.filters index fca6000..27e4666 100644 --- a/cheat-library/cheat-library.vcxproj.filters +++ b/cheat-library/cheat-library.vcxproj.filters @@ -213,7 +213,7 @@ Header Files - + Header Files @@ -420,7 +420,7 @@ Source Files - + Source Files diff --git a/cheat-library/src/appdata/il2cpp-functions.h b/cheat-library/src/appdata/il2cpp-functions.h index d292c64..b7fefa6 100644 --- a/cheat-library/src/appdata/il2cpp-functions.h +++ b/cheat-library/src/appdata/il2cpp-functions.h @@ -319,6 +319,8 @@ DO_APP_FUNC(0x057E4470, void, Cursor_set_visible, (bool value, MethodInfo* metho DO_APP_FUNC(0x057E4460, void, Cursor_set_lockState, (CursorLockMode__Enum value, MethodInfo* method)); DO_APP_FUNC(0x057E4450, bool, Cursor_get_visible, (MethodInfo* method)); +DO_APP_FUNC(0x0571E7C0, RigidbodyConstraints__Enum, Rigidbody_get_constraints, (Rigidbody* __this, MethodInfo* method)); +DO_APP_FUNC(0x0571E990, void, Rigidbody_set_constraints, (Rigidbody* __this, RigidbodyConstraints__Enum value, MethodInfo* method)); DO_APP_FUNC(0x0571E980, void, Rigidbody_set_collisionDetectionMode, (Rigidbody* __this, CollisionDetectionMode__Enum value, MethodInfo* method)); DO_APP_FUNC(0x0571E9A0, void, Rigidbody_set_detectCollisions, (Rigidbody* __this, bool value, MethodInfo* method)); DO_APP_FUNC(0x0571E9E0, void, Rigidbody_set_isKinematic, (Rigidbody* __this, bool value, MethodInfo* method)); diff --git a/cheat-library/src/user/cheat/cheat.cpp b/cheat-library/src/user/cheat/cheat.cpp index 687f565..a0f2093 100644 --- a/cheat-library/src/user/cheat/cheat.cpp +++ b/cheat-library/src/user/cheat/cheat.cpp @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include @@ -117,7 +117,7 @@ namespace cheat FEAT_INST(PaimonFollow), FEAT_INST(HideUI), FEAT_INST(Browser), - FEAT_INST(EnablePeaking), + FEAT_INST(EnablePeeking), FEAT_INST(TextureChanger), FEAT_INST(FreeCamera) diff --git a/cheat-library/src/user/cheat/visuals/EnablePeaking.h b/cheat-library/src/user/cheat/visuals/EnablePeaking.h deleted file mode 100644 index 62604db..0000000 --- a/cheat-library/src/user/cheat/visuals/EnablePeaking.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once -#include -#include - -namespace cheat::feature -{ - - class EnablePeaking : public Feature - { - public: - config::Field> f_Enabled; - - static EnablePeaking& GetInstance(); - - const FeatureGUIInfo& GetGUIInfo() const override; - void DrawMain() override; - - virtual bool NeedStatusDraw() const override; - void DrawStatus() override; - - private: - EnablePeaking(); - }; -} - diff --git a/cheat-library/src/user/cheat/visuals/EnablePeaking.cpp b/cheat-library/src/user/cheat/visuals/EnablePeeking.cpp similarity index 59% rename from cheat-library/src/user/cheat/visuals/EnablePeaking.cpp rename to cheat-library/src/user/cheat/visuals/EnablePeeking.cpp index edf40bd..3d9a72d 100644 --- a/cheat-library/src/user/cheat/visuals/EnablePeaking.cpp +++ b/cheat-library/src/user/cheat/visuals/EnablePeeking.cpp @@ -1,5 +1,5 @@ #include "pch-il2cpp.h" -#include "EnablePeaking.h" +#include "EnablePeeking.h" #include @@ -7,43 +7,43 @@ namespace cheat::feature { static void MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook(app::MoleMole_VCBaseSetDitherValue* __this, float value, MethodInfo* method); - EnablePeaking::EnablePeaking() : Feature(), - NF(f_Enabled, "Enable Peaking", "Visuals::EnablePeaking", false) + EnablePeeking::EnablePeeking() : Feature(), + NF(f_Enabled, "Enable Peeking", "Visuals::EnablePeeking", false) { HookManager::install(app::MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue, MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook); } - const FeatureGUIInfo& EnablePeaking::GetGUIInfo() const + const FeatureGUIInfo& EnablePeeking::GetGUIInfo() const { - static const FeatureGUIInfo info{ "EnablePeaking", "Visuals", false }; + static const FeatureGUIInfo info{ "EnablePeeking", "Visuals", false }; return info; } - void EnablePeaking::DrawMain() + void EnablePeeking::DrawMain() { ConfigWidget(f_Enabled, ";)"); } - bool EnablePeaking::NeedStatusDraw() const + bool EnablePeeking::NeedStatusDraw() const { return f_Enabled; } - void EnablePeaking::DrawStatus() + void EnablePeeking::DrawStatus() { - ImGui::Text("Enable Peaking"); + ImGui::Text("Enable Peeking"); } - EnablePeaking& EnablePeaking::GetInstance() + EnablePeeking& EnablePeeking::GetInstance() { - static EnablePeaking instance; + static EnablePeeking instance; return instance; - } + } static void MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook(app::MoleMole_VCBaseSetDitherValue* __this, float value, MethodInfo* method) { - EnablePeaking& EnablePeaking = EnablePeaking::GetInstance(); - if (EnablePeaking.f_Enabled) + EnablePeeking& EnablePeeking = EnablePeeking::GetInstance(); + if (EnablePeeking.f_Enabled) value = 1; CALL_ORIGIN(MoleMole_VCBaseSetDitherValue_set_ManagerDitherAlphaValue_Hook, __this, value, method); diff --git a/cheat-library/src/user/cheat/visuals/EnablePeeking.h b/cheat-library/src/user/cheat/visuals/EnablePeeking.h new file mode 100644 index 0000000..50b414f --- /dev/null +++ b/cheat-library/src/user/cheat/visuals/EnablePeeking.h @@ -0,0 +1,25 @@ +#pragma once +#include +#include + +namespace cheat::feature +{ + + class EnablePeeking : public Feature + { + public: + config::Field> f_Enabled; + + static EnablePeeking& GetInstance(); + + const FeatureGUIInfo& GetGUIInfo() const override; + void DrawMain() override; + + virtual bool NeedStatusDraw() const override; + void DrawStatus() override; + + private: + EnablePeeking(); + }; +} + diff --git a/cheat-library/src/user/cheat/visuals/FreeCamera.cpp b/cheat-library/src/user/cheat/visuals/FreeCamera.cpp index eaa297f..b39819f 100644 --- a/cheat-library/src/user/cheat/visuals/FreeCamera.cpp +++ b/cheat-library/src/user/cheat/visuals/FreeCamera.cpp @@ -3,6 +3,7 @@ #include #include +#include namespace cheat::feature { @@ -20,6 +21,7 @@ namespace cheat::feature FreeCamera::FreeCamera() : Feature(), NF(f_Enabled, "Free Camera", "Visuals::FreeCamera", false), + NF(f_FreezeAnimation, "Freeze Character Animation", "Visuals::FreeCamera", false), NF(f_Speed, "Speed", "Visuals::FreeCamera", 1.0f), NF(f_LookSens, "Look Sensitivity", "Visuals::FreeCamera", 1.0f), NF(f_RollSpeed, "Roll Speed", "Visuals::FreeCamera", 1.0f), @@ -50,6 +52,7 @@ namespace cheat::feature void FreeCamera::DrawMain() { ConfigWidget("Enable", f_Enabled); + ConfigWidget("Freeze Character Animation", f_FreezeAnimation, "Freezes the active character's animation.\nAfter disabling, jump to un-freeze your character."); if (ImGui::BeginTable("FreeCameraDrawTable", 1, ImGuiTableFlags_NoBordersInBody)) { ImGui::TableNextRow(); @@ -245,5 +248,25 @@ namespace cheat::feature } else DisableFreeCam(); + + // Taiga#5555: There's probably be a better way of implementing this. But for now, this is just what I came up with. + auto& manager = game::EntityManager::instance(); + auto animator = manager.avatar()->animator(); + auto rigidBody = manager.avatar()->rigidbody(); + if (animator == nullptr && rigidBody == nullptr) + return; + + if (f_FreezeAnimation) + { + //auto constraints = app::Rigidbody_get_constraints(rigidBody, nullptr); + //LOG_DEBUG("%s", magic_enum::enum_name(constraints).data()); + app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezePosition, nullptr); + app::Animator_set_speed(animator, 0.f, nullptr); + } + else + { + app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezeRotation, nullptr); + app::Animator_set_speed(animator, 1.f, nullptr); + } } } \ No newline at end of file diff --git a/cheat-library/src/user/cheat/visuals/FreeCamera.h b/cheat-library/src/user/cheat/visuals/FreeCamera.h index 9f0ea7e..1084b4a 100644 --- a/cheat-library/src/user/cheat/visuals/FreeCamera.h +++ b/cheat-library/src/user/cheat/visuals/FreeCamera.h @@ -8,6 +8,7 @@ namespace cheat::feature { public: config::Field> f_Enabled; + config::Field> f_FreezeAnimation; config::Field f_Speed; config::Field f_LookSens; config::Field f_RollSpeed; diff --git a/cheat-library/src/user/cheat/world/FreezeEnemies.cpp b/cheat-library/src/user/cheat/world/FreezeEnemies.cpp index b44cd50..a9d8bed 100644 --- a/cheat-library/src/user/cheat/world/FreezeEnemies.cpp +++ b/cheat-library/src/user/cheat/world/FreezeEnemies.cpp @@ -7,7 +7,7 @@ #include #include -namespace cheat::feature +namespace cheat::feature { FreezeEnemies::FreezeEnemies() : Feature(), @@ -28,12 +28,12 @@ namespace cheat::feature } bool FreezeEnemies::NeedStatusDraw() const -{ + { return f_Enabled; } - void FreezeEnemies::DrawStatus() - { + void FreezeEnemies::DrawStatus() + { ImGui::Text("Freeze Enemies"); } @@ -43,18 +43,31 @@ namespace cheat::feature return instance; } - void FreezeEnemies::OnGameUpdate() - { + // Taiga#5555: There's probably be a better way of implementing this. But for now, this is just what I came up with. + void FreezeEnemies::OnGameUpdate() + { auto& manager = game::EntityManager::instance(); for (const auto& monster : manager.entities(game::filters::combined::Monsters)) { auto animator = monster->animator(); - if (animator == nullptr) + auto rigidBody = monster->rigidbody(); + if (animator == nullptr && rigidBody == nullptr) return; - f_Enabled ? app::Animator_set_speed(animator, 0.f, nullptr) : app::Animator_set_speed(animator, 1.f, nullptr); + if (f_Enabled) + { + //auto constraints = app::Rigidbody_get_constraints(rigidBody, nullptr); + //LOG_DEBUG("%s", magic_enum::enum_name(constraints).data()); + app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezeAll, nullptr); + app::Animator_set_speed(animator, 0.f, nullptr); + } + else + { + app::Rigidbody_set_constraints(rigidBody, app::RigidbodyConstraints__Enum::FreezeRotation, nullptr); + app::Animator_set_speed(animator, 1.f, nullptr); + } } - } + } }