Exemplo n.º 1
0
        public Vector3 GetCellCornerPointClosestToMouseCursor()
        {
            Ray   ray = EditorCamera.Instance.Camera.ScreenPointToRay(Input.mousePosition);
            float t;

            if (Plane.Raycast(ray, out t))
            {
                Vector3        pickPoint        = ray.GetPoint(t);
                List <Vector3> cellCornerPoints = GetCellCornerPoints(GetCellFromWorldXZ(pickPoint.x, pickPoint.z));
                return(Vector3Extensions.GetPointClosestToPoint(cellCornerPoints, pickPoint));
            }

            return(Vector3.zero);
        }
Exemplo n.º 2
0
        public Vector3 GetCellCornerPointClosestToInputDevPos()
        {
            Ray ray;

            if (!InputDevice.Instance.GetPickRay(EditorCamera.Instance.Camera, out ray))
            {
                return(Vector3.zero);
            }

            float t;

            if (Plane.Raycast(ray, out t))
            {
                Vector3        pickPoint        = ray.GetPoint(t);
                List <Vector3> cellCornerPoints = GetCellCornerPoints(GetCellFromWorldXZ(pickPoint.x, pickPoint.z));
                return(Vector3Extensions.GetPointClosestToPoint(cellCornerPoints, pickPoint));
            }

            return(Vector3.zero);
        }
Exemplo n.º 3
0
 public Vector3 GetPointClosestToPoint(Vector3 point)
 {
     return(Vector3Extensions.GetPointClosestToPoint(GetPoints(), point));
 }