-
Автор темы
- #1
Capsule Values...:
float g_CapsuleVertices[][3] =
{
{ -0.01f, -0.01f, 1.00f },
{ 0.51f, 0.00f, 0.86f },
{ 0.44f, 0.25f, 0.86f },
{ 0.25f, 0.44f, 0.86f },
{ -0.01f, 0.51f, 0.86f },
{ -0.26f, 0.44f, 0.86f },
{ -0.45f, 0.25f, 0.86f },
{ -0.51f, 0.00f, 0.86f },
{ -0.45f, -0.26f, 0.86f },
{ -0.26f, -0.45f, 0.86f },
{ -0.01f, -0.51f, 0.86f },
{ 0.25f, -0.45f, 0.86f },
{ 0.44f, -0.26f, 0.86f },
{ 0.86f, 0.00f, 0.51f },
{ 0.75f, 0.43f, 0.51f },
{ 0.43f, 0.75f, 0.51f },
{ -0.01f, 0.86f, 0.51f },
{ -0.44f, 0.75f, 0.51f },
{ -0.76f, 0.43f, 0.51f },
{ -0.87f, 0.00f, 0.51f },
{ -0.76f, -0.44f, 0.51f },
{ -0.44f, -0.76f, 0.51f },
{ -0.01f, -0.87f, 0.51f },
{ 0.43f, -0.76f, 0.51f },
{ 0.75f, -0.44f, 0.51f },
{ 1.00f, 0.00f, 0.01f },
{ 0.86f, 0.50f, 0.01f },
{ 0.49f, 0.86f, 0.01f },
{ -0.01f, 1.00f, 0.01f },
{ -0.51f, 0.86f, 0.01f },
{ -0.87f, 0.50f, 0.01f },
{ -1.00f, 0.00f, 0.01f },
{ -0.87f, -0.50f, 0.01f },
{ -0.51f, -0.87f, 0.01f },
{ -0.01f, -1.00f, 0.01f },
{ 0.49f, -0.87f, 0.01f },
{ 0.86f, -0.51f, 0.01f },
{ 1.00f, 0.00f, -0.02f },
{ 0.86f, 0.50f, -0.02f },
{ 0.49f, 0.86f, -0.02f },
{ -0.01f, 1.00f, -0.02f },
{ -0.51f, 0.86f, -0.02f },
{ -0.87f, 0.50f, -0.02f },
{ -1.00f, 0.00f, -0.02f },
{ -0.87f, -0.50f, -0.02f },
{ -0.51f, -0.87f, -0.02f },
{ -0.01f, -1.00f, -0.02f },
{ 0.49f, -0.87f, -0.02f },
{ 0.86f, -0.51f, -0.02f },
{ 0.86f, 0.00f, -0.51f },
{ 0.75f, 0.43f, -0.51f },
{ 0.43f, 0.75f, -0.51f },
{ -0.01f, 0.86f, -0.51f },
{ -0.44f, 0.75f, -0.51f },
{ -0.76f, 0.43f, -0.51f },
{ -0.87f, 0.00f, -0.51f },
{ -0.76f, -0.44f, -0.51f },
{ -0.44f, -0.76f, -0.51f },
{ -0.01f, -0.87f, -0.51f },
{ 0.43f, -0.76f, -0.51f },
{ 0.75f, -0.44f, -0.51f },
{ 0.51f, 0.00f, -0.87f },
{ 0.44f, 0.25f, -0.87f },
{ 0.25f, 0.44f, -0.87f },
{ -0.01f, 0.51f, -0.87f },
{ -0.26f, 0.44f, -0.87f },
{ -0.45f, 0.25f, -0.87f },
{ -0.51f, 0.00f, -0.87f },
{ -0.45f, -0.26f, -0.87f },
{ -0.26f, -0.45f, -0.87f },
{ -0.01f, -0.51f, -0.87f },
{ 0.25f, -0.45f, -0.87f },
{ 0.44f, -0.26f, -0.87f },
{ 0.00f, 0.00f, -1.00f },
};
:creygasm:
uwu codes:
void aim::Multipoint(C_CSPlayer* player, Engine::C_LagRecord* record, int side, std::vector<std::pair<Vector, bool>>& points, mstudiobbox_t* hitbox, mstudiohitboxset_t* hitboxSet, float& pointScale, int hitboxIndex) {
if (!record || !record->m_bIsValid)
return;
auto boneMatrix = record->GetBoneMatrix();
auto boneMatrix2 = record->GetBoneMatrix();
//points.clear();
if (!hitbox || !boneMatrix || !hitboxSet)
return;
auto local = C_CSPlayer::GetLocalPlayer();
if (!local || local->IsDead())
return;
Vector center = (hitbox->bbmax + hitbox->bbmin) * 0.5f;
Vector centerTrans = center.Transform(boneMatrix[hitbox->bone]);
Vector min2, max2;
Math::VectorTransform2(hitbox->bbmin, boneMatrix2[hitbox->bone], min2);
Math::VectorTransform2(hitbox->bbmax, boneMatrix2[hitbox->bone], max2);
//Vector center = (hitbox->bbmax + hitbox->bbmin) * 0.5f;
//Vector centerTrans = center.Transform(boneMatrix[hitbox->bone]);
Vector center2 = (hitbox->bbmax + hitbox->bbmin) * 0.5f;
Vector centerTrans2 = center2;
Math::VectorTransform2(centerTrans2, boneMatrix2[hitbox->bone], centerTrans2);
AddPoint(points, centerTrans2, false);
if (((m_rage_data->rbot->point_scale <= 0.f && hitboxIndex == HITBOX_HEAD) || (m_rage_data->rbot->body_point_scale <= 0.f && hitboxIndex != HITBOX_HEAD)) && m_rage_data->m_pWeapon && hitbox->m_flRadius > 0.0f) {
pointScale = hitbox->m_flRadius <= 0.0f ? 0.4f : 1.f; // 0.91; // we can go high here because the new multipoint is perfect; now this statement is actually true
float spreadCone = Engine::Prediction::Instance()->GetSpread() + Engine::Prediction::Instance()->GetInaccuracy();
float dist = centerTrans.Distance(m_rage_data->m_vecEyePos);
dist /= sinf(DEG2RAD(90.0f - RAD2DEG(spreadCone)));
spreadCone = sinf(spreadCone);
float radiusScaled = (hitbox->m_flRadius - (dist * spreadCone));
if (radiusScaled < 0.0f) {
radiusScaled *= -1.f;
}
float ps = pointScale;
pointScale = (radiusScaled / hitbox->m_flRadius);
pointScale = Math::Clamp(pointScale, 0.0f, ps);
}
if (pointScale <= 0.0f)
return;
// get the hitbox radius (could be redone)
const float hitboxRadius = hitbox->m_flRadius * pointScale;
// backup mins
Vector norm, mins, maxs;
VectorTransformASM(&hitbox->bbmin[0], boneMatrix[hitbox->bone], &mins[0]);
VectorTransformASM(&hitbox->bbmax[0], boneMatrix[hitbox->bone], &maxs[0]);
auto hitboxCenter = (mins + maxs) * 0.5f;
unsigned int pointAmount = 0;
//float feetScale = 0.0f;
// little multipoint check ya know
bool runMultipoint = false;
if (hitboxIndex == HITBOX_HEAD && m_rage_data->rbot->mp_hitboxes_head) {
switch (m_rage_data->rbot->multipoint_intensity % 4) {
case 0:
pointAmount = 4;
break;
case 1:
pointAmount = 6;
break;
case 2:
pointAmount = 8;
break;
case 3:
pointAmount = 10;
break;
}
runMultipoint = true;
}
else if (hitboxIndex == HITBOX_CHEST && m_rage_data->rbot->mp_hitboxes_chest) {
switch (m_rage_data->rbot->multipoint_intensity % 4) {
case 0:
pointAmount = 4;
break;
case 1:
pointAmount = 6;
break;
case 2:
pointAmount = 8;
break;
case 3:
pointAmount = 10;
break;
}
runMultipoint = true;
}
else if (hitboxIndex == HITBOX_UPPER_CHEST && m_rage_data->rbot->mp_hitboxes_chest) {
switch (m_rage_data->rbot->multipoint_intensity % 4) {
case 0:
pointAmount = 4;
break;
case 1:
pointAmount = 6;
break;
case 2:
pointAmount = 8;
break;
case 3:
pointAmount = 10;
break;
}
runMultipoint = true;
}
else if (hitboxIndex == HITBOX_STOMACH && m_rage_data->rbot->mp_hitboxes_stomach) {
switch (m_rage_data->rbot->multipoint_intensity % 4) {
case 0:
pointAmount = 4;
break;
case 1:
pointAmount = 6;
break;
case 2:
pointAmount = 8;
break;
case 3:
pointAmount = 10;
break;
}
runMultipoint = true;
}
else if (hitboxIndex == HITBOX_LOWER_CHEST && m_rage_data->rbot->mp_hitboxes_stomach) {
switch (m_rage_data->rbot->multipoint_intensity % 4) {
case 0:
pointAmount = 4;
break;
case 1:
pointAmount = 6;
break;
case 2:
pointAmount = 8;
break;
case 3:
pointAmount = 10;
break;
}
runMultipoint = true;
}
else if ((hitboxIndex == HITBOX_LEFT_CALF || hitboxIndex == HITBOX_RIGHT_CALF || hitboxIndex == HITBOX_LEFT_THIGH || hitboxIndex == HITBOX_RIGHT_THIGH) && m_rage_data->rbot->mp_hitboxes_legs) {
switch (m_rage_data->rbot->multipoint_intensity % 4) {
case 0:
pointAmount = 1;
break;
case 1:
pointAmount = 2;
break;
case 2:
pointAmount = 4;
break;
case 3:
pointAmount = 6;
break;
}
runMultipoint = true;
}
else if ((hitboxIndex == HITBOX_LEFT_FOOT || hitboxIndex == HITBOX_RIGHT_FOOT) && m_rage_data->rbot->mp_hitboxes_feets) {
//feetScale = m_rage_data->rbot->static_point_scale ? pointScale * 0.1 : 10.f;
runMultipoint = true;
}
else // extra safe in this bitch
runMultipoint = false;
if (hitbox->m_flRadius == -1.f)
{
//AddPoint(points, hitboxCenter, false);
if (runMultipoint)
{
// convert rotation angle to a matrix.
matrix3x4_t rot_matrix;
Math::AngleMatrix(hitbox->m_angAngles, rot_matrix);
// apply the rotation to the entity input space (local).
matrix3x4_t matrix;
Math::ConcatTransforms(boneMatrix[hitbox->bone], rot_matrix, matrix);
// extract origin from matrix.
const Vector origin = matrix.GetOrigin();
// compute raw center point.
Vector center = (hitbox->bbmin + hitbox->bbmax) / 2.f;
// the feet hiboxes have a side, heel and the toe.
if (hitboxIndex == HITBOX_RIGHT_FOOT || hitboxIndex == HITBOX_LEFT_FOOT) {
const float d2 = (hitbox->bbmin.x - center.x) * pointScale;
const float d3 = (hitbox->bbmax.x - center.x) * pointScale;
//heel.
AddPoint(points, Vector(center.x + d2, center.y, center.z), true);
// toe.
AddPoint(points, Vector(center.x + d3, center.y, center.z), true);
}
// nothing to do here we are done.
if(points.empty())
return;
// rotate our bbox points by their correct angle
// and convert our points to world space.
for (auto& p : points) {
// VectorRotate.
// rotate point by angle stored in matrix.
p.first = { p.first.Dot(matrix[0]), p.first.Dot(matrix[1]), p.first.Dot(matrix[2]) };
// transform point to world space.
p.first += origin;
}
}
}
else
{
//AddPoint(points, hitboxCenter, false);
if (runMultipoint)
{
matrix3x4_t dmatrix, rmatrix;
norm = (maxs - mins);
norm = norm.Normalized();
VectorMatrix(Vector(0.0f, 0.0f, .9f), rmatrix);
VectorMatrix(normal, dmatrix);
for (int i = 0; i < 74; i += (int)(74 / pointAmount))
{
if (i >= 74)
i = 73;
float flPoints[3];
VectorRotate(g_CapsuleVertices[i], rmatrix, &flPoints[0]);
VectorRotate(&flPoints[0], dmatrix, &flPoints[0]);
Vector vecPoint = Vector(flPoints) * (hitbox->m_flRadius * pointScale);
if (g_CapsuleVertices[i][2] > 0.f)
vecPoint += (mins - maxs);
// don't need to make an extra center point.
if (Vector(maxs + vecPoint) == center)
continue;
AddPoint(points, Vector(maxs + vecPoint), true);
}
}
}
}