| 123456789101112131415161718192021222324252627282930313233 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class DrawLinkLine : MonoBehaviour
- {
- public LineRenderer LineRenderer;
- public float lineWidth = 0.002f;
- public Transform startpoint;
- public Transform endpoint;
- // Start is called before the first frame update
- void Start()
- {
-
- }
- // Update is called once per frame
- void Update()
- {
- //是否使用世界坐标
- LineRenderer.useWorldSpace = true;
- //设置开始和结束位置0代表第一个点,1代表第二个点
- LineRenderer.SetPosition(0, startpoint.position);
- LineRenderer.SetPosition(1, endpoint.position);
- //开始和结束位置的颜色
- //LineRenderer.startColor = new Color(1, 0.8F, 0.1F, 0);
- //LineRenderer.endColor = Color.red;
- //开始和结束粗细大小
- LineRenderer.startWidth = lineWidth;
- LineRenderer.endWidth = lineWidth;
- }
- }
|