forked from AugmentedWorkplace/AugmentedWorkplace_VR
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDrawLine.cs
27 lines (23 loc) · 934 Bytes
/
DrawLine.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DrawLine : MonoBehaviour {
public GameObject lineGeneratorPrefab;
private List<GameObject> lineGeneratorList;
private void Start()
{
lineGeneratorList = new List<GameObject>();
}
public void SpawnLineGenerator(Vector3[] pointPositions)
{
//Debug.Log("Spawning line generator");
//Debug.Log("Points: " + pointPositions);
//Debug.Log("Length: " + pointPositions.GetLength(0));
//Debug.Log("Other length: " + pointPositions.Length);
GameObject lineGeneratorClone = Instantiate(lineGeneratorPrefab);
LineRenderer lineRenderer = lineGeneratorClone.GetComponent<LineRenderer>();
lineRenderer.positionCount = pointPositions.Length;
lineRenderer.SetPositions(pointPositions);
lineGeneratorList.Add(lineGeneratorClone);
}
}