File size: 618 Bytes
1bc3c94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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;
using UnityEngine;

public class KeypointLine : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public Keypoint start;
    public Keypoint end;
    public Color color;
    public float width;

    void Start()
    {
        lineRenderer.startColor = color;
        lineRenderer.endColor = color;
        lineRenderer.startWidth = width;
        lineRenderer.endWidth = width;
    }

    void Update()
    {
        lineRenderer.SetPosition(0, start.Position);
        lineRenderer.SetPosition(1, end.Position);
        lineRenderer.gameObject.SetActive(start.IsActive && end.IsActive);
    }
}