mirror of
https://github.com/nothke/quality-control.git
synced 2025-09-02 00:23:43 +00:00
Magnet cables
This commit is contained in:
22
Assets/Scripts/LineAttachEnd.cs
Normal file
22
Assets/Scripts/LineAttachEnd.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class LineAttachEnd : MonoBehaviour
|
||||
{
|
||||
public Transform anchor;
|
||||
|
||||
LineRenderer _line;
|
||||
LineRenderer line { get { if (!_line) _line = GetComponent<LineRenderer>(); return _line; } }
|
||||
|
||||
private void Start()
|
||||
{
|
||||
line.useWorldSpace = true;
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
line.SetPosition(0, transform.position);
|
||||
line.SetPosition(1, anchor.position);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user