diff --git a/sp/src/game/server/ai_concommands.cpp b/sp/src/game/server/ai_concommands.cpp index e004dca1..6c4370d9 100644 --- a/sp/src/game/server/ai_concommands.cpp +++ b/sp/src/game/server/ai_concommands.cpp @@ -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();