Example #1
0
    //---------------------------------------------------------------



    private void createSnapObjects()
    {
        Vector3 lT = refObj.getPtLeftTop();
        Vector3 lB = refObj.getPtLeftBottom();
        Vector3 rB = refObj.getPtRightBottom();
        Vector3 rT = refObj.getPtRightTop();

        base.createAndPlaceSnapObj(lT, rT);
        base.createAndPlaceSnapObj(rT, rB);
        base.createAndPlaceSnapObj(rB, lB);
        base.createAndPlaceSnapObj(lB, lT);

        base.createAndPlaceSnapObj(lT, lT, SnapType.END);
        base.createAndPlaceSnapObj(rT, rT, SnapType.END);
        base.createAndPlaceSnapObj(rB, rB, SnapType.END);
        base.createAndPlaceSnapObj(lB, lB, SnapType.END);

        Vector3 mid;

        mid = (lT + rT) / 2;
        base.createAndPlaceSnapObj(mid, mid, SnapType.MID);
        mid = (rT + rB) / 2;
        base.createAndPlaceSnapObj(mid, mid, SnapType.MID);
        mid = (rB + lB) / 2;
        base.createAndPlaceSnapObj(mid, mid, SnapType.MID);
        mid = (lB + lT) / 2;
        base.createAndPlaceSnapObj(mid, mid, SnapType.MID);
    }
Example #2
0
    //---------------------------------------------------------------



    public void updateMesh()
    {
        clearMesh();

        Vector3 lT = refObj.getPtLeftTop();
        Vector3 lB = refObj.getPtLeftBottom();
        Vector3 rB = refObj.getPtRightBottom();
        Vector3 rT = refObj.getPtRightTop();

        List <Vector3> cornerPoints = new List <Vector3>();

        cornerPoints.Add(lB);
        cornerPoints.Add(rB);
        cornerPoints.Add(lT);
        cornerPoints.Add(rT);

        Mesh newMesh = getMesh(cornerPoints, transform.forward);

        meshFilter.mesh         = newMesh;
        meshCollider.sharedMesh = newMesh;

        meshObj.transform.position = Vector3.zero;
    }