makeLine.addPoints C# (CSharp) Method

addPoints() public method

public addPoints ( GameObject b, bool d, float t ) : void
b GameObject
d bool
t float
return void
    public void addPoints(GameObject b, bool d, float t)
    {
        //d is for drawing

        float distance = Vector3.Distance (b.transform.position, prevPos);
        if (d) {
            if(distance>detailDistance ){
                addPoint (b, t);
                prevPos = b.transform.position;
            }
        } else {
            if(getPointCount()>0){
                List<Point> pointsToCheck = new List<Point>();
                for (int i = -1; i <= 1; i++) {
                    for (int j = -1; j <= 1; j++) {
                        for (int k = -1; k <= 1; k++) {
                            Vector3 offset = new Vector3(i, j, k) * granularity;
                            int cell = getHashedCell(b.transform.position + offset);
                            if (hashGrid.ContainsKey(cell)) {
                                pointsToCheck.AddRange(hashGrid[cell]);
                            }
                        }
                    }
                }
                for (int i = 0; i < pointsToCheck.Count; i++){
                    Point p = pointsToCheck[i];
                    if(Vector3.Distance(p.pos,b.transform.position)<eraseDistance){
                        if(p.parent.opacity==1)
                            p.parent.opacity=.99f;
                    }
                }
            }
        }
    }

Usage Example

Example #1
0
 public void eraseLine(bool draw)
 {
     for (int i = 0; i < lines.Count; i++)
     {
         makeLine other = (makeLine)lines[i].GetComponent(typeof(makeLine));
         other.addPoints(brush, draw);
     }
 }
All Usage Examples Of makeLine::addPoints