How to move single vertex in a subdivided plane
Hello everyone, i'm trying to create snow track in a low poly world. To create a super light and easy way to do this I created a plane with ~400 vertex and wanted to move signle vertex along the y-axis when they meet the char collider. it doesn't work and i cant get why, does anybody spot any mistake or error?
Thank you all
p.s. i know there are several other ways to do this, but i'd like to stick with this.
void Start()
{
vertici = neve.vertices;
Debug.Log("uno dei vert è " + vertici[0]);
}
void Update()
{
if(daSchiacciare > -1)
{
vertici[daSchiacciare].y = vertici[daSchiacciare].z - (deltaNeve);
neve.SetVertices(vertici);
Debug.Log("sto cambiando punti");
}
}
private void OnCollisionStay(Collision collision)
{
foreach (Vector3 vertice in vertici){
if (AcpCollider.bounds.Contains(vertice))
{
Debug.Log("questo è da schiacciare" + vertice);
daSchiacciare=System.Array.IndexOf(vertici,vertice);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
Getting face of mesh when you already have one tri 0 Answers
Error CS0117: 'Mesh' does not contain a definition for 'vertices'. 0 Answers
Procedural Mesh Problems 0 Answers
Create a mesh from a PNG sprite 0 Answers