Making Rope mesh to edit vertices. how?
I'm making simple physical rope. it's almost done. except about the rendering... of course i made with Line renderer already. but it's not looks good.
My current rope : https://imgur.com/Dc9mrC8
Anyway, i just tried to move vertices's position to target position. but it's working like this. the Rope mesh is simple. Octagon cylinder. https://imgur.com/bxdOPrB
codes below :
void Start() {
meshRope = GetComponent<MeshFilter>().mesh;
meshRope.GetVertices(vert);
meshRope.GetVertices(normals);
tempVetcicesOffset.Sort(new CompareVector(1));
for (int i = 0; i < meshRope.vertices.Length * 0.5f; i++)
{
vert[i] += new Vector3(0f, -0.1f, 0f);
}
meshRope.vertices = vert.ToArray();
meshRope.RecalculateBounds();
meshRope.RecalculateNormals();
}
I sorted the list of vertex positions by vector's Y height. and loop half. because my model has 16 vertices and sorted so i thought it's only move lower vertices...
I image to make it look like this : https://imgur.com/sU0MHKh
But the ingame is different. : https://imgur.com/rrbaghk, https://imgur.com/A2Muaw8
even vertices length isn't correct. my model have 16. and meshRope.vertices.Length
says 34.
How can i expand meshs to another position? I just want to make a connecting mesh between two objects like rope..