Вопрос Помогите исправить esp с матрицей

Начинающий
Статус
Оффлайн
Регистрация
5 Фев 2024
Сообщения
13
Реакции[?]
0
Поинты[?]
0
bool w2s(const Vector3& EntityPos, Vector2& ScreenPos)
{
auto matrix = il2cpp::unity::find_matrix();
// if (!matrix) return false;

// Vector3 TransVec = Vector3(14, matrix->_24, matrix->_34);
// Vector3 RightVec = Vector3(matrix->_11, matrix->_21, matrix->_31);
// Vector3 UpVec = Vector3(matrix->_12, matrix->_22, matrix->_32);
// float w = Dot(TransVec, EntityPos) + matrix->_44;
// if (w < 0.098f) return false;

// float y = Dot(UpVec, EntityPos) + matrix->_42;
// float x = Dot(RightVec, EntityPos) + matrix->_41;
// ScreenPos = Vector2((screen_center.x) * (1.f + x / w), (screen_center.y) * (1.f - y / w));

const Vector3 translation = { matrix[3][0], matrix[3][1], matrix[3][2] };
const Vector3 up = { matrix[1][0], matrix[1][1], matrix[1][2] };
const Vector3 right = { matrix[0][0], matrix[0][1], matrix[0][2] };

const auto w = translation.dot_product(EntityPos) + matrix[3][3];

if (w < 0.1f)
return false;

const auto x = right.dot_product(EntityPos) + matrix[0][3];
const auto y = up.dot_product(EntityPos) + matrix[1][3];

ScreenPos =
{
screen_center.x * (1.f + x / w),
screen_center.y * (1.f - y / w)
};

return true;
}
bool OOF(BasePlayer* ply) {
Vector3 pos = ply->get_bone_pos(head);
Vector2 screen;

if (!utils::w2s(pos, screen))
return true;

float num = Math::Distance_2D(screen_center, screen);
return num > 1000.f;
}
Vector3 GetEntityPosition(std::uint64_t entity) {
if (!entity) return Vector3::Zero();

uintptr_t plyVis = read(entity + 0x8, uintptr_t);
if (!plyVis) return Vector3::Zero();

uintptr_t visualState = read(plyVis + 0x38, uintptr_t);
if (!visualState) return Vector3::Zero();

Vector3 ret = read(visualState + 0x90, Vector3);
return ret;
}

Vector3 ClosestPoint(BasePlayer* player, Vector3 vec) {

static auto off = METHOD("Assembly-CSharp::BaseEntity::ClosestPoint(Vector3): Vector3");
return reinterpret_cast<Vector3(__fastcall*)(BasePlayer*, Vector3)>(off)(player, vec);
}

bool LineOfSight(Vector3 a, Vector3 b) {
int mask = vars::weapons::penetrate ? 10551296: 1503731969; // projectile los, flyhack mask

bool result = GamePhysics::LineOfSight(a, b, mask, 0.f) && GamePhysics::LineOfSight(b, a, mask, 0.f);
return result;
}
void ServerRPC(DWORD64 ent, Str funcName) {
static auto off = METHOD("Assembly-CSharp::BaseEntity::ServerRPC(String): Void");
reinterpret_cast<void(__stdcall*)(DWORD64, Str)>(off)(ent, funcName);
}
class StringPool {
public:
static uint32_t Get(const char* str) {
static auto off = METHOD("Assembly-CSharp::StringPool::Get(String): UInt32");
return reinterpret_cast<uint32_t(__fastcall*)(il2cpp::String*)>(off)(il2cpp::String::New(str));
}

static il2cpp::String* Get(uint32_t i) {
static auto off = METHOD("Assembly-CSharp::StringPool::Get(UInt32): String");
return reinterpret_cast<il2cpp::String * (__fastcall*)(uint32_t)>(off)(i);
}
};
}
 
Сверху Снизу