Transform namespace updated & freecam removed
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "UnityEngine/Transform.h"
|
#include "UnityEngine/Transform.h"
|
||||||
|
|
||||||
app::Transform* Transform::Get(app::GameObject* go)
|
app::Transform* Transform::GetTransform(app::GameObject* go)
|
||||||
{
|
{
|
||||||
if (!go || !app::GameObject_get_transform) return nullptr;
|
if (!go || !app::GameObject_get_transform) return nullptr;
|
||||||
|
|
||||||
@@ -11,9 +11,38 @@ app::Transform* Transform::Get(app::GameObject* go)
|
|||||||
return __transform ? __transform : nullptr;
|
return __transform ? __transform : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
app::Vector3 Transform::Position(app::Transform* transform)
|
app::Vector3 Transform::GetPosition(app::Transform* transform)
|
||||||
{
|
{
|
||||||
if (!transform || !app::Transform_get_position) return app::Vector3();
|
if (!transform || !app::Transform_get_position) return app::Vector3();
|
||||||
|
|
||||||
return app::Transform_get_position(transform, nullptr);
|
return app::Transform_get_position(transform, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app::Quaternion Transform::GetRotation(app::Transform* transform)
|
||||||
|
{
|
||||||
|
return app::Transform_get_rotation(transform, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
app::Vector3 Transform::GetForward(app::Transform* transform)
|
||||||
|
{
|
||||||
|
return app::Transform_get_forward(transform, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
app::Vector3 Transform::GetRight(app::Transform* transform)
|
||||||
|
{
|
||||||
|
return app::Transform_get_right(transform, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
app::Vector3 Transform::GetEulerAngles(app::Quaternion rotation)
|
||||||
|
{
|
||||||
|
return app::Quaternion_get_eulerAngles(&rotation, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
app::Quaternion Transform::QuaternionEuler(app::Vector3 eulerAngles)
|
||||||
|
{
|
||||||
|
float x = eulerAngles.x;
|
||||||
|
float y = eulerAngles.y;
|
||||||
|
float z = eulerAngles.z;
|
||||||
|
|
||||||
|
return app::Quaternion_Euler(x, y, z, nullptr);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
namespace Transform {
|
namespace Transform {
|
||||||
app::Transform* Get(app::GameObject* go);
|
app::Transform* GetTransform(app::GameObject* go);
|
||||||
app::Vector3 Position(app::Transform* transform);
|
app::Vector3 GetPosition(app::Transform* transform);
|
||||||
|
app::Quaternion GetRotation(app::Transform* transform);
|
||||||
|
app::Vector3 GetForward(app::Transform* transform);
|
||||||
|
app::Vector3 GetRight(app::Transform* transform);
|
||||||
|
app::Vector3 GetEulerAngles(app::Quaternion rotation);
|
||||||
|
app::Quaternion QuaternionEuler(app::Vector3 eulerAngles);
|
||||||
}
|
}
|
||||||
@@ -31,11 +31,11 @@ static void DrawBoxESP(app::GameObject *it, float footOffset, float headOffset,
|
|||||||
if (!it || cam == nullptr)
|
if (!it || cam == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
app::Transform* _transform = Transform::Get(it);
|
app::Transform* _transform = Transform::GetTransform(it);
|
||||||
if (_transform == nullptr)
|
if (_transform == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
app::Vector3 pos = Transform::Position(_transform);
|
app::Vector3 pos = Transform::GetPosition(_transform);
|
||||||
|
|
||||||
app::Vector3 footpos = app::Camera_WorldToScreenPoint_1(cam, app::Vector3{pos.x, pos.y + footOffset, pos.z}, NULL);
|
app::Vector3 footpos = app::Camera_WorldToScreenPoint_1(cam, app::Vector3{pos.x, pos.y + footOffset, pos.z}, NULL);
|
||||||
app::Vector3 headpos = app::Camera_WorldToScreenPoint_1(cam, app::Vector3{pos.x, pos.y + headOffset, pos.z}, NULL);
|
app::Vector3 headpos = app::Camera_WorldToScreenPoint_1(cam, app::Vector3{pos.x, pos.y + headOffset, pos.z}, NULL);
|
||||||
|
|||||||
@@ -174,10 +174,10 @@ void Misc::SpawnPrefab(const char* prefabName) {
|
|||||||
if (localPlayer) {
|
if (localPlayer) {
|
||||||
app::Quaternion rotation = app::Quaternion_get_identity(NULL);
|
app::Quaternion rotation = app::Quaternion_get_identity(NULL);
|
||||||
|
|
||||||
app::Transform* playerTransform = Transform::Get(localPlayer);
|
app::Transform* playerTransform = Transform::GetTransform(localPlayer);
|
||||||
if (playerTransform == nullptr) return;
|
if (playerTransform == nullptr) return;
|
||||||
|
|
||||||
app::Vector3 playerPos = Transform::Position(playerTransform);
|
app::Vector3 playerPos = Transform::GetPosition(playerTransform);
|
||||||
|
|
||||||
if (app::BoltNetwork_Instantiate_6) {
|
if (app::BoltNetwork_Instantiate_6) {
|
||||||
app::GameObject* go = (app::GameObject*)app::BoltNetwork_Instantiate_6(p, playerPos, rotation, nullptr);
|
app::GameObject* go = (app::GameObject*)app::BoltNetwork_Instantiate_6(p, playerPos, rotation, nullptr);
|
||||||
|
|||||||
@@ -93,52 +93,6 @@ typedef void(__stdcall* TNolanBehaviour_Update)(app::NolanBehaviour*, MethodInfo
|
|||||||
TNolanBehaviour_Update oNolanBehaviour_Update = NULL;
|
TNolanBehaviour_Update oNolanBehaviour_Update = NULL;
|
||||||
void __stdcall hNolanBehaviour_Update(app::NolanBehaviour* __this, MethodInfo* method) {
|
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)) {
|
if (settings::fly && IsLocalPlayer(__this)) {
|
||||||
|
|
||||||
float speed = settings::fly_speed;
|
float speed = settings::fly_speed;
|
||||||
@@ -147,7 +101,7 @@ void __stdcall hNolanBehaviour_Update(app::NolanBehaviour* __this, MethodInfo* m
|
|||||||
|
|
||||||
if (transform) {
|
if (transform) {
|
||||||
|
|
||||||
app::Vector3 pos = Transform::Position(transform);
|
app::Vector3 pos = Transform::GetPosition(transform);
|
||||||
|
|
||||||
if (GetAsyncKeyState('W') & 0x8000) {
|
if (GetAsyncKeyState('W') & 0x8000) {
|
||||||
pos = pos + (app::Transform_get_forward(transform, nullptr) * speed * Time_DeltaTime());
|
pos = pos + (app::Transform_get_forward(transform, nullptr) * speed * Time_DeltaTime());
|
||||||
@@ -168,7 +122,6 @@ void __stdcall hNolanBehaviour_Update(app::NolanBehaviour* __this, MethodInfo* m
|
|||||||
pos = pos - (app::Transform_get_up(transform, nullptr) * speed * Time_DeltaTime());
|
pos = pos - (app::Transform_get_up(transform, nullptr) * speed * Time_DeltaTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
app::GameObject* thisGameObject = app::Component_get_gameObject((app::Component*)__this, nullptr);
|
app::GameObject* thisGameObject = app::Component_get_gameObject((app::Component*)__this, nullptr);
|
||||||
|
|
||||||
if (thisGameObject != nullptr || !Object::IsNull((app::Object_1*)thisGameObject)) {
|
if (thisGameObject != nullptr || !Object::IsNull((app::Object_1*)thisGameObject)) {
|
||||||
|
|||||||
@@ -48,5 +48,4 @@ namespace settings {
|
|||||||
float new_azazel_speed = 0.f;
|
float new_azazel_speed = 0.f;
|
||||||
|
|
||||||
bool disable_longInteract = false;
|
bool disable_longInteract = false;
|
||||||
bool freecam = false;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ namespace settings {
|
|||||||
extern bool freeze_azazel;
|
extern bool freeze_azazel;
|
||||||
extern float new_azazel_speed;
|
extern float new_azazel_speed;
|
||||||
extern bool disable_longInteract;
|
extern bool disable_longInteract;
|
||||||
extern bool freecam;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user