Example #1
0
        public Vector3 GetSnapDestinationPointClosestToCursorPickPoint()
        {
            if (IsValid)
            {
                if (_type == SnapSurfaceType.GridCell)
                {
                    List <Vector3> snapDestinationPoints = _surfaceQuad.GetCenterAndCornerPoints();
                    snapDestinationPoints.AddRange(_surfaceQuad.GetMidEdgePoints());

                    return(Vector3Extensions.GetClosestPointToPoint(snapDestinationPoints, _mouseCursorPickPoint));
                }
                else
                {
                    XZOrientedQuad3D gridCellQuad          = _objectBoxSnapSurfaceGrid.GetCellFromPoint(_mouseCursorPickPoint).Quad;
                    List <Vector3>   snapDestinationPoints = gridCellQuad.GetCenterAndCornerPoints();
                    snapDestinationPoints.AddRange(gridCellQuad.GetMidEdgePoints());

                    return(Vector3Extensions.GetClosestPointToPoint(snapDestinationPoints, _mouseCursorPickPoint));
                }
            }
            return(Vector3.zero);
        }