 Custom hitbox aimspot (non-center one)
Im struggling with problem of setting aimspot of hitbox capsule I can only aim at center right now.. Want to adjust it by Z and XY values
here is my code:
Vector CRageBot::GetHitboxPosition(Entity* pEntity, int iHitbox)
{
matrix3x4 matrix[128];
if (pEntity->SetupBones(matrix, 128, 0x100, 0.f))
{
studiohdr_t* hdr = model->GetStudiomodel(pEntity->GetModel());
mstudiohitboxset_t* set = hdr->GetHitboxSet(0);
mstudiobbox_t* hitbox = set->GetHitbox(iHitbox);
if (hitbox)
{
float r = hitbox->radius;
Vector bbmin = hitbox->bbmin;
Vector bbmax = hitbox->bbmax;
Vector vMin, vMax, vCenter, sCenter;
VectorTransform(bbmin, matrix[hitbox->bone], vMin);
VectorTransform(bbmax, matrix[hitbox->bone], vMax);
if (r != -1.f)
{
vMin -= r;
vMax += r;
}
return vCenter = Vector((vMin.x + vMax.x) * ((double)cvars->ragebot_aim_hitbox_offset_xy / 10.0)),
(vMin.y + vMax.y) * ((double)cvars->ragebot_aim_hitbox_offset_xy / 10.0)),
(vMin.z + vMax.z) * ((double)cvars->ragebot_aim_hitbox_offset_z / 10.0));
}
}
}
and whenever Im setting my values to other than 0.5 aimbot is going crazy and is shooting in the air? How to aim for example at left-bottom side of hitbox?
|