Hi !
Please, I need your help. I want to draw randomly smooth curves with lines renderer but I don’t succed to do it.
I found some solutions but they don’t correspond to my expectations. They add vertices in my curve even when my line is almost straight. This is my method which add vertices below :
private void AddVertices()
{
if (vertices == null)
{
vertices = new List<Vector2>();
}
vertices.Add(start);
GameObject.Find("StartPoint").GetComponent<LevelLimit>().SetPosition(start);
for (int index = 0; index < pathSize; index++)
{
Vector2 newVertex = new Vector2();
float lastX = vertices[vertices.Count - 1].x;
newVertex.x = lastX + segmentLength;
newVertex.y = RandYPos();
vertices.Add(newVertex);
}
vertices.Add(end);
GameObject.Find("EndPoint").GetComponent<LevelLimit>().SetPosition(end);
}
Can you help me please ?
Thanks a lot for answers !