Add extra trace to npc_create for NPCs which should use bbox instead of hull (e.g. npc_rollermine)

This commit is contained in:
ALLEN-PC\acj30 2023-11-24 10:29:02 -06:00
parent e7cdb69c58
commit 424fcf0792

View File

@ -477,6 +477,20 @@ public:
AI_TraceHull( baseNPC->GetAbsOrigin(), vUpBit, baseNPC->GetHullMins(), baseNPC->GetHullMaxs(),
MASK_NPCSOLID, baseNPC, COLLISION_GROUP_NONE, &tr );
// NEW: For vphysics/flying entities, do a second attempt which teleports based on bounding box
if ( (baseNPC->GetMoveType() == MOVETYPE_VPHYSICS || baseNPC->CapabilitiesGet() & bits_CAP_MOVE_FLY) && (tr.startsolid || tr.fraction < 1.0) )
{
vUpBit.z += baseNPC->BoundingRadius();
baseNPC->Teleport( &vUpBit, NULL, NULL );
UTIL_DropToFloor( baseNPC, MASK_NPCSOLID );
Vector vUpBit2 = vUpBit;
vUpBit2.z += 1;
AI_TraceHull( vUpBit, vUpBit2, baseNPC->CollisionProp()->OBBMins(), baseNPC->CollisionProp()->OBBMaxs(),
MASK_NPCSOLID, baseNPC, COLLISION_GROUP_NONE, &tr );
}
if ( tr.startsolid || (tr.fraction < 1.0) )
{
baseNPC->SUB_Remove();