Collisions in XNA

Overview of Collision Detection

Bounding Sphere

			Vector3[] points=new Vector3[2];
            points[0] = new Vector3(1, 2, 3);
            points[1] = new Vector3(2, 1, 3);


            BoundingSphere bs1,bs2;

            bs1=BoundingSphere.CreateFromPoints(points);

            bs2 = new BoundingSphere(new Vector3(0, 0, 0), 5);

            if (bs1.Intersects(bs2) == true)
            {
                //
            }

BoundingBox

            BoundingBox bb= new BoundingBox(new Vector3(0, 0, 0), new Vector3(3, 4, 5));

            if (bb.Contains(bs1) == ContainmentType.Contains)
            {
                //
            }

Ray

			Ray r = new Ray(new Vector3(3, 2, 5), new Vector3(1, 2, 3));

            if (r.Intersects(bb) < 10)
            {
                //
            }

Other Bounding classes

BoundingFrustrum

Plane

Model