-
Автор темы
- #1
C++:
static int ClipRayToHitbox(const Ray_t& ray, mstudiobbox_t* hitbox, matrix3x4_t& matrix, trace_t& trace)
{
static auto fn = (util::FindSignature(crypt_str("client.dll"), crypt_str("55 8B EC 83 E4 F8 F3 0F 10 42")));
trace.fraction = 1.0f;
trace.startsolid = false;
return reinterpret_cast <int(__fastcall*)(const Ray_t&, mstudiobbox_t*, matrix3x4_t&, trace_t&)> (fn)(ray, hitbox, matrix, trace);
}
bool aim::hitbox_intersection(player_t* e, matrix3x4_t* matrix, int hitbox, const Vector& start, const Vector& end, float* safe)
{
trace_t trace;
Ray_t Ray = Ray_t(start, end);
trace.fraction = 1.0f;
trace.startsolid = false;
auto studio_model = m_modelinfo()->GetStudioModel(e->GetModel());
if (!studio_model)
return false;
auto studio_set = studio_model->pHitboxSet(e->m_nHitboxSet());
if (!studio_set)
return false;
auto studio_hitbox = studio_set->pHitbox(hitbox);
if (!studio_hitbox)
return false;
return ClipRayToHitbox(Ray, studio_hitbox, matrix[studio_hitbox->bone], Trace);
}