freecam test - not working properly

This commit is contained in:
Jadis0x
2024-06-07 23:00:36 +03:00
parent b644ca0fc4
commit d2ac02fde8
3 changed files with 49 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
#include "pch-il2cpp.h"
#include "pch-il2cpp.h"
#include "Hooks.hpp"
#include "features/menu.hpp"
#include "settings/settings.hpp"
@@ -93,6 +93,52 @@ typedef void(__stdcall* TNolanBehaviour_Update)(app::NolanBehaviour*, MethodInfo
TNolanBehaviour_Update oNolanBehaviour_Update = NULL;
void __stdcall hNolanBehaviour_Update(app::NolanBehaviour* __this, MethodInfo* method) {
if (settings::freecam && IsLocalPlayer(__this)) {
app::CameraController* cameraController = __this->fields.cameraController;
cameraController->fields.m_Anchor = nullptr;
cameraController->fields.m_Character = nullptr;
cameraController->fields.m_CharacterLocomotion = nullptr;
app::Transform* cameraControllerTransform = app::CameraController_get_CameraTransform(cameraController, nullptr);
static app::Vector3 newCameraPosition = app::Transform_get_position(cameraControllerTransform, nullptr);
static app::Quaternion newCameraRotation = app::Transform_get_rotation(cameraControllerTransform, nullptr);
// Kamera hareketi ve rotasyonu için inputları kontrol et
float moveSpeed = 15.0f;
float rotateSpeed = 2.0f;
if (GetAsyncKeyState('W') & 0x8000) {
newCameraPosition = newCameraPosition + (app::Transform_get_forward(cameraControllerTransform, nullptr) * moveSpeed * Time_DeltaTime());
}
if (GetAsyncKeyState('S') & 0x8000) {
newCameraPosition = newCameraPosition - (app::Transform_get_forward(cameraControllerTransform, nullptr) * moveSpeed * Time_DeltaTime());
}
if (GetAsyncKeyState('A') & 0x8000) {
newCameraPosition = newCameraPosition - (app::Transform_get_right(cameraControllerTransform, nullptr) * moveSpeed * Time_DeltaTime());
}
if (GetAsyncKeyState('D') & 0x8000) {
newCameraPosition = newCameraPosition + (app::Transform_get_right(cameraControllerTransform, nullptr) * moveSpeed * Time_DeltaTime());
}
// Mouse hareketlerini al
float deltaX = Input::GetAxis("Mouse X") * rotateSpeed;
float deltaY = Input::GetAxis("Mouse Y") * rotateSpeed;
// Kamerayı döndür
app::Quaternion rotationX = app::Quaternion_Euler(0, deltaX, 0, nullptr);
app::Quaternion rotationY = app::Quaternion_Euler(-deltaY, 0, 0, nullptr);
newCameraRotation = app::Quaternion_op_Multiply(newCameraRotation, rotationX, nullptr);
newCameraRotation = app::Quaternion_op_Multiply(rotationY, newCameraRotation, nullptr);
// Yeni pozisyon ve rotasyonu ayarla
app::Transform_set_position(cameraControllerTransform, newCameraPosition, nullptr);
app::Transform_set_rotation(cameraControllerTransform, newCameraRotation, nullptr);
}
if (settings::fly && IsLocalPlayer(__this)) {
float speed = settings::fly_speed;

View File

@@ -48,4 +48,5 @@ namespace settings {
float new_azazel_speed = 0.f;
bool disable_longInteract = false;
bool freecam = false;
}

View File

@@ -29,7 +29,6 @@ namespace settings {
extern float demon_esp_color[4];
extern bool goat_esp;
extern float goat_esp_color[4];
extern bool chat_spam;
extern std::string message;
extern bool spoof_level;
@@ -47,11 +46,10 @@ namespace settings {
extern bool auto_respawn;
extern bool change_player_speed;
extern int new_speed;
extern bool freeze_azazel;
extern float new_azazel_speed;
extern bool disable_longInteract;
extern bool freecam;
}
#endif