static CBaseEntity *FindPhysicsBlocker( IPhysicsObject *pPhysics ) { IPhysicsFrictionSnapshot *pSnapshot = pPhysics->CreateFrictionSnapshot(); CBaseEntity *pBlocker = NULL; float maxVel = 10.0f; while ( pSnapshot->IsValid() ) { IPhysicsObject *pOther = pSnapshot->GetObject(1); if ( pOther->IsMoveable() ) { CBaseEntity *pOtherEntity = static_cast<CBaseEntity *>(pOther->GetGameData()); // dot with this if you have a direction //Vector normal; //pSnapshot->GetSurfaceNormal(normal); float force = pSnapshot->GetNormalForce(); float vel = force * pOther->GetInvMass(); if ( vel > maxVel ) { pBlocker = pOtherEntity; maxVel = vel; } } pSnapshot->NextFrictionData(); } pPhysics->DestroyFrictionSnapshot( pSnapshot ); return pBlocker; }