Example #1
0
    private void DefineFarmNWandSE()
    {
        var poly = UPoly.RetTerrainPoly(_min, _max, Dir.SWtoNE);

        _NW = poly[0];
        _SE = poly[2];
    }
Example #2
0
File: Way.cs Project: Cdrix/SM
    /// <summary>
    /// Defined a 3d  rectangle with current selection: onScreenPoly. Defines firstCorner and secondCorner too,
    /// _dir too
    /// </summary>
    /// <returns></returns>
    public void CreateWay()
    {
        //print("1st way p." + _firstWayPoint);
        //print("2st  way p corn." + _secondWayPoint);

        if (firstCorner == new Vector2())
        {
            firstCorner    = new Vector2(UInput.TransformedMPos.x, UInput.TransformedMPos.y);
            _firstWayPoint = ClosestSubMeshVert;
        }
        else if (firstCorner != new Vector2())
        {
            secondCorner    = new Vector2(UInput.TransformedMPos.x, UInput.TransformedMPos.y);
            _secondWayPoint = UPoly.RayCastTerrain(secondCorner).point;
            _secondWayPoint = m.Vertex.FindClosestVertex(_secondWayPoint, m.CurrentHoverVertices.ToArray());
            //direction was dragged on terrain
            _dir         = UDir.ReturnDragDir(_firstWayPoint, _secondWayPoint);
            onScreenPoly = UPoly.RetTerrainPoly(_firstWayPoint, _secondWayPoint, _dir);
        }
    }