# How to Calculate the Contact Point between Ray and Plane

Is there any quick way to find the intersection point between Plane and Ray?

-
Try googling "line plane intersection" – brandon Feb 1 '12 at 14:27
An intersection between a Vector3 and a Plane doesn't make sense. You can find the intersection between a Plane and a line segment, a ray, or a line, but all of these require not one, but two Vector3's to be represented. Or you can check if a certain Point lies on the Plane or not. Which of these are you trying to achieve? – David Gouveia Feb 1 '12 at 14:30
i am using the Vector3 as a Direction , Mmm it should be a Ray not a Vector3 – MhdSyrwan Feb 1 '12 at 14:38
long story short, study linear algebra – brandon Feb 1 '12 at 14:51

Try the following method which relies on XNA's built in Math API to intersect a `Ray` and a `Plane` and get back the point of intersection:

``````Vector3? GetRayPlaneIntersectionPoint(Ray ray, Plane plane)
{
float? distance = ray.Intersects(plane);
return distance.HasValue ? ray.Position + ray.Direction * distance.Value : null;
}
``````

The method returns `null` if there's no intersection, or the point of intersection otherwise.

-
thanks very much :) , i thought it returns just a boolean – MhdSyrwan Feb 1 '12 at 15:18