Flattening terrain under my object at start()

I need to flatten the terrain of an object at the start when it is activated/instantiated into the scene. I want to use a specific box collider to do it.

So basically, how would I flatten the terrain within this collider?

Here is the script so far.

//Collider.
public Collider boundsCollider;


void Start () {

		//Flatten ground around before starting the bitch up..

		//Cast ray down to check and get terrain.
		Vector3 dRayDir = transform.TransformDirection(new Vector3(0,-100,0));
		Ray dRay = new Ray(transform.position, dRayDir);
		RaycastHit dhit;
		if(Physics.Raycast(dRay, out dhit, Mathf.Infinity)){

			var terrain = dhit.transform.GetComponent<Terrain>();

		}

//So what to do with the collider and how to access the tiles(points?) on the terrain within said collider?..

}

Help… thanks.

This is not a simple thing. Search on ‘Dynamic terrain deformation’ for examples, and although those are usually written from the perspective of terrain changes from explosions or similar, the functions you will need potentially serve as examples (splatmap mgmt., heightmap mgmt. and the terrainData class).

A search on Dynamic terrain deformation turns up many links.