Intersection between line (ray) and xz-layer at specific high


How do I calculate the point of intersection of a line (ray) and the xz-layer witch is at a specific high?

I create a ray with ScreenPointToRay from the camera looking down at 90° with a high of 10. With ray.direction I get it’s direction but how do I calculate when this ray intersects the xz-layer at high 0 without using a collider?

Sorry for my english…


You can use Unity’s mathematical plane class. See the reference page for Plane.Raycast() for an example. For your use the ‘groundPlane’ variable would be initialized as:

groundPlane = new Plane(Vector3.up,;