# Cannot change the Size of the Hole in mesh

Hello Everyone, I am making the Game about Hole,

The Game Contains Hole in the Mesh and the Object fall from it. Like Hole.io game.
I have achieved that moving the Hole in the Mesh by the Vertices and the Hole is Relocating or Moving according to My Desire.
I am Moving the Hole By getting the vertices of the Hole in Mesh and then Move or relocate it in the Script given Below.
There are 2 Issue’s About which I need help.

1- I cannot make the Hole Bigger or Smaller by the vertices of the Hole in mesh.
2- I cannot add more vertices in the Hole of the mesh.

Is there Anyone Who can help the Image and the Code for the mesh is Given Below

Image:

``````public MeshFilter meshFilter;

public MeshCollider meshCollider;

public Vector2 moveLimits;

//Hole vertices radius from the hole's center

public Transform holeCenter;
public Transform rotatingCircle;

public float moveSpeed;

Mesh mesh;
List<int> holeVertices;
//hole vertices offsets from hole center
List<Vector3> offsets;
int holeVerticesCount;

float x, y;
Vector3 touch,
targetPos;

void Start()
{
RotateCircleAnim();

//Initializing lists
holeVertices = new List<int>();
offsets = new List<Vector3>();

//get the meshFilter's mesh
mesh = meshFilter.mesh;

//Find Hole vertices on the mesh
FindHoleVertices();
}

void RotateCircleAnim()
{
rotatingCircle.DORotate(new Vector3(90f, 0f, -90f), .2f).SetEase(Ease.Linear).From(new Vector3(90f, 0f, 0f)).SetLoops(-1, LoopType.Incremental);
}

void Update()
{
MoveHole();
//Update hole vertices
UpdateHoleVerticesPosition();

}

void MoveHole()
{
x = Input.GetAxis("Mouse X");
y = Input.GetAxis("Mouse Y");

//lerp (smooth) movement
touch = Vector3.Lerp(holeCenter.position, holeCenter.position + new Vector3(x, 0f, y), moveSpeed * Time.deltaTime);

targetPos = new Vector3(Mathf.Clamp(touch.x, -moveLimits.x, moveLimits.x), touch.y, Mathf.Clamp(touch.z, -moveLimits.y, moveLimits.y));

holeCenter.position = targetPos;
}

void UpdateHoleVerticesPosition()
{
//FindHoleVertices();
//Move hole vertices
Vector3[] vertices = mesh.vertices;

for (int i = 0; i < holeVerticesCount; i++)
{
vertices[holeVertices[i]] = holeCenter.position + offsets[i];
}

//update mesh vertices
mesh.vertices = vertices;
//update meshFilter's mesh
meshFilter.mesh = mesh;
//update collider
meshCollider.sharedMesh = mesh;
}

void FindHoleVertices()
{
for (int i = 0; i < mesh.vertices.Length; i++)
{
//Calculate distance between holeCenter & each Vertex

float distance = Vector3.Distance(holeCenter.position, mesh.vertices[i]);

{
//this vertex belongs to the Hole
//offset: how far the Vertex from the HoleCenter
}
}

//save hole vertices count
holeVerticesCount = holeVertices.Count;
}

//Visualize Hole vertices Radius in the Scene view
void OnDrawGizmos()
{
Gizmos.color = Color.yellow;