Okay, here's my code and then I will explain the situation:
Code:
CBaseEntity *pPlayer = pEntity->GetUnknown()->GetBaseEntity();
Vector eyepos = VFuncs::EyePosition(pPlayer);
QAngle eyeang = VFuncs::EyeAngles(pPlayer);
vector_t *pos = CreateVecFromVector(eyepos);
vector_t *ang = CreateVecFromQAngle(eyeang);
Vector end;
AngleVectors(eyeang, &end);
end.NormalizeInPlace();
end = eyepos + end * MAX_TRACE_LENGTH;
Ray_t ray;
ray.Init(eyepos,end);
trace_t tr;
MyTraceFilterSimpleEntitiesOnly tfilter(pPlayer, MASK_SHOT);
enginetrace->TraceRay(ray, MASK_SHOT, &tfilter, &tr);
if (tr.fraction < 1.0f && tr.surface.flags & SURF_HITBOX)
{
// we're aiming at a player, check to see if there's
// anything blocking eyesight (MASK_OPAQUE) in the way
trace_t tr2;
MyTraceFilterSimple tfilter2(pPlayer, MASK_OPAQUE|CONTENTS_MONSTER);
enginetrace->TraceRay(ray, MASK_OPAQUE|CONTENTS_MONSTER, &tfilter2, &tr2);
target_t *target = (target_t *)malloc(sizeof(target_t));
target->opaque = (tr2.fraction < 1.0f && tr2.surface.flags & SURF_HITBOX ? false : true);
target->player = ActivePlayers[tr.m_pEnt->entindex()];
// for debugging
sprintf(szBuffer,"\x04TARGET(SteamID = \"%s\", Opaque = %s)\n",
(target->player ? target->player->GetSteamId() : "BOT"), (target->opaque ? "1" : "0"));
SayTextToEntIndex(szBuffer,engine->IndexOfEdict(pEntity));
effects->Sparks(tr.endpos);
//player->AddSnapshot(pos,ang,type,target);
return;
}
//player->AddSnapshot(pos,ang,type,0);
Basically, what happens here is whenever you aim at the player's body, everything goes as expected and you get the SayText in your HUD showing you the player's Steam ID. But if you aim up at the head, nothing seems to register almost as if the guy is headless or something.. you can aim a little lower at the neck and it will register as well as every other part of the body, but for some reason the TraceRay thinks the guy is headless.
I've tried several different mask and content macros and cannot figure this one out...
__________________