bool IsCollisionBetween(Vector3 inFrom, Vector3 inTo, Collider inVictim) { Vector3 dir = inTo - inFrom; float lng = dir.magnitude; dir /= lng; inFrom -= dir * 0.04f; int mask = ~(ObjectLayerMask.IgnoreRayCast | ObjectLayerMask.Ragdoll | ObjectLayerMask.PhysicBody | ObjectLayerMask.Hat); RaycastHit[] hits = Physics.RaycastAll(inFrom, dir, lng, mask); if (hits.Length > 1) { System.Array.Sort(hits, CollisionUtils.CompareHits); } foreach (RaycastHit hit in hits) { if ((hit.collider.isTrigger == true) || (hit.collider == inVictim)) { continue; } if (noBlocking != null && IgnoreInBlockingTest(hit.collider.transform) == true) { continue; } m_ObstacleNormalAccum += hit.normal; #if DEBUG DebugDraw.LineOriented(ColMiss, inFrom, inTo); DebugDraw.Collider(ColMiss, inVictim, 0.96f); DebugDraw.Diamond(ColMiss, 0.02f, hit.point); #endif return(true); } #if DEBUG DebugDraw.LineOriented(ColHit, inFrom, inTo); DebugDraw.Collider(ColHit, inVictim, 0.96f); #endif return(false); }