Answer the question
In order to leave comments, you need to log in
How to draw a line from point to point?
The position of the line object is located at a different point, how to extend the line to another part?
It doesn't work like this:
Line.transform.position = FirstPoint.position;
Line.SetPosition(1, SecondPoint.position);
Answer the question
In order to leave comments, you need to log in
connect the LineRenderer component
public LineRenderer lineRenderer;
// Start is called before the first frame update
void Start()
{
lineRenderer.positionCount = 3; //указываем кол-во точек
Vector3 firstPoint = new Vector3(0, 0, 0);
lineRenderer.SetPosition(0, firstPoint); //номер точки и её положение
Vector3 secondPoint = new Vector3(5, 5, 0);
lineRenderer.SetPosition(1, secondPoint);
Vector3 thirdPoint = new Vector3(15, 5, 0);
lineRenderer.SetPosition(2, thirdPoint);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question