- Home /

# Point on a Plane between two points

I have a Plane (the class not the gameobject) and two Vector 3 positions.

I am trying to find the point on the line between the two positions that also intersects the plane.

My best idea at the moment is creating a custom plane class that stores the equation of the plane and working it out using algebra however I feel like there is likely a simpler way.

Thanks

Assuming you have a collider on the plane, you can get the middle between both points and use Collider.ClosestPoint like so

```
Vector3 pointOnPlane = myPlaneObject.GetComponent<Collider>().ClosestPoint(centerPointOfTwoPoints);
```

Rereading your question now, I think it may actually be easiest to Raycast between the two points, and if the ray hits the plane, then you found your intersecting point. Something to note though, if your plane is 1-sided you would need to set your physics to query backfaces.

To clarify the plane is the built -in class Plane not a physical one

**Answer** by MomentsStudio
·
Feb 17 at 07:33 PM

It turns out getting the equation from the plane was not too hard.

```
Vector3 PointOnPlaneBetweenTwoPoints(Plane p, Vector3 a, Vector3 b){
Vector3 q = (b-a);
q.Normalize();
Vector3 planeEqation;
Vector3 pointOnPlane = p.ClosestPointOnPlane(Vector3.zero);
Vector3 normal = p.normal;
planeEqation = normal;
float offset = Vector3.Dot(pointOnPlane,normal);
Debug.Log(planeEqation);
float t = (offset-Vector3.Dot(a,planeEqation))/Vector3.Dot(q,planeEqation);
return a+(q*t);
}
```

If anyone else ever needs this feel free to use it.

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.