bool CheckCollision(ref Mesh m1, ref Mesh m2) { BoundingSphere c1BoundingSphere = m1.GetBoundingSphere(); BoundingSphere c2BoundingSphere = m2.GetBoundingSphere(); if (c1BoundingSphere.Intersects(c2BoundingSphere)) { return true; } return false; }
//--------------------------------------- // Collision methods //--------------------------------------- public bool CollidesWithMesh(Mesh m) { if (m_Model == null) return false; // Check whether the bounding boxes of the two cubes intersect. BoundingSphere bs1 = GetBoundingSphere(); BoundingSphere bs2 = m.GetBoundingSphere(); if (bs1.Intersects(bs2)) return true; return false; }