- Home /
Destroy Objects which intersect Line
Hello All, Basically im trying to add a randomly generating river system to my game. I have 3 points which are randomly assigned on start, what i want to do is draw 2 points connecting _pointA to _pointB and _pointB to _pointC. From there I want to delete the ground planes which are underneath these newly created lines(world is a flat grid of planes).
Here is my currect addWater function.
function addWater(){
var _pointA = Vector3(Random.Range(0,size), 0,Random.Range(0,size));
var _pointB = Vector3(Random.Range(0,size), 0,Random.Range(0,size));
var _pointC = Vector3(Random.Range(0,size), 0,Random.Range(0,size));
Debug.DrawLine(_pointA, _pointB, Color.red, 100.0);
Debug.DrawLine(_pointB, _pointC, Color.red, 100.0);
Debug.LogWarning("A(" + _pointA.x + "," + _pointA.y + "," + _pointA.z + ")");
Debug.LogWarning("B(" + _pointB.x + "," + _pointB.y + "," + _pointB.z + ")");
Debug.LogWarning("C(" + _pointC.x + "," + _pointC.y + "," + _pointC.z + ")");
}
any help would be much appreciated.
Edit: the var size is the number on planes from one side to the other, or the size of the map.
Edit2: I have tried to use raycast but haven't quite figured how to align a bunch of them along the lines. -
Since you tagged this question with "raycast" I assume you already considered doing raycasts to deter$$anonymous$$e the planes to delete?