12345678910111213141516171819202122232425262728293031323334 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class LineUpdate : MonoBehaviour
- {
- List<Vector3> poslist = new List<Vector3>();
- private void Start()
- {
- LineRenderer lr = this.GetComponent<LineRenderer>();
- if(lr)
- {
- for (int i = 0; i < lr.positionCount; i++)
- {
- poslist.Add(lr.GetPosition(i));
- }
- }
- }
-
- void Update()
- {
- LineRenderer lr = this.GetComponent<LineRenderer>();
- if (lr)
- {
- for (int i = 0; i < lr.positionCount; i++)
- {
- lr.SetPosition(i, this.transform.InverseTransformVector(poslist[i]));
- }
- }
-
- }
- }
|