- 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

**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.

### Follow this Question

### Related Questions

How to Rotate Plane of Cube Around its Center? (Rotate Vectors Around Point/Axis/Direction) 1 Answer

Using the Horizontal Slider to Control a Plane's Y transform Variable 1 Answer

Get mapping postion of 1 point on a plane defined by 3 points 1 Answer

What is Vector3.Exclude for? 2 Answers

Get the raod turn radius 1 Answer