- Home /

# Project a position onto a plane whose normal isn't at the origin.

I need to project an object's position onto a plane. Unity provides this method :

```
Vector3.ProjectOnPlane(Vector3 positionToProject, Vector3 normalOfPlane)
```

This method projects a Vector 3 onto a plane whose normal is at the origin. I have been trying to take the result from this and apply it to the position of another object, but every attempt so far has failed. Is there a way to project on to a plane defined by a normal that isn't on the origin?

**Answer** by asafsitner
·
Feb 18, 2017 at 04:42 AM

I know it's an old question, but as I ran into the same problem today, I'll answer:

Unity's built-in methods do not have an option to specify the plane's origin, however, it's possible to do so manually and use **Plane.Raycast** to find the intersection point, for example:

```
private void ProjectTransformOnPlane(Transform objectToProject, Vector3 planeOrigin, Vector3 planeNormal)
{
Plane projectionPlane = new Plane(planeNormal, planeOrigin);
float distanceToIntersection;
Ray intersectionRay = new Ray(objectToProject.position, objectToProject.forward);
if (projectionPlane.Raycast(intersectionRay, out distanceToIntersection))
{
objectToProject.position = objectToProject.position + objectToProject.forward * distanceToIntersection;
}
}
```

This principle can be modified and applied to different scenarios, but in each of them, we must have the origin and direction of the vector we'd like to project onto the plane.

In this case, I used the Transform's forward to find its direction, but any other vector can be used.

**Answer** by PraetorBlue
·
Feb 14, 2019 at 01:55 AM

Since you are working with *Vectors* and not *Rays*, it is safe to conceptualize all vectors as being "on the origin".

What the projection of the vector on the plane will do is give you the component of the vector which is parallel to the plane. You can then do with this projection whatever you want. Your question is a little unclear with regards to your use case, so it's hard to say much more than that.

### 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

Math Question : How to Get a Point on a Ray which is EXACTLY 5 units away from Vector3.Zero? 5 Answers

How to get a vector3 (postion) 1 unit away from another in the direction of a 3rd vector3? 2 Answers

Return grid points within a cube selection 1 Answer

Please help, bullet drop is wrong at certain angles ? 0 Answers

How to compute the change in vector when it's referential vector changes? 0 Answers