private Vector3 EnsurePoint(Vector3 point, IImmutableFace lastFace)
        {
            //TODO: Add support for different directions
            var ray = new Ray(point, Vector3.down);

            lastFace.Plane.Raycast(ray, out float distance);
            return(ray.GetPoint(distance));
        }
        /// <summary>
        /// Creates an instance of the CachedFace class.
        /// </summary>
        /// <param name="source">The source face.</param>
        public CachedFace(IImmutableFace source)
        {
            this.source = source;

            this.plane = source.Plane;
            this.a     = source.A;
            this.b     = source.B;
            this.c     = source.C;
        }
        /// <summary>
        /// Creates a new instance of the PathfindingRequest class.
        /// </summary>
        /// <param name="layer">Index of the layer on which to search for the path.</param>
        /// <param name="areaMask">The area mask that specyfies which faces should be considered during pathfinding.</param>
        /// <param name="radius">Defines how close the agent center can get to edges of the navigation mesh.</param>
        /// <param name="startPosition">The end point of a path.</param>
        /// <param name="endPosition">The end point of a path.</param>
        /// <param name="pathType">How to calculate a path.</param>
        /// <param name="startFace">The start face of the path. (optional)</param>
        public PathfindingRequest(int layer, int areaMask, float radius,
                                  Vector3 startPosition, Vector3 endPosition, PathType pathType,
                                  IImmutableFace startFace = null)
        {
            this.layer         = layer;
            this.areaMask      = areaMask;
            this.radius        = radius;
            this.startPosition = startPosition;
            this.endPosition   = endPosition;
            this.pathType      = pathType;
            this.startFace     = startFace;

            status = Status.Pending;
        }
 /// <summary>
 /// Create the threadsafe copy of the <c>SurfaceRaycastHit</c> class instance.
 /// </summary>
 /// <param name="surfaceRaycastHit">The source object.</param>
 public SurfaceImmutableRaycastHit(SurfaceRaycastHit surfaceRaycastHit)
 {
     this.position = surfaceRaycastHit.position;
     this.face     = surfaceRaycastHit.face;
 }