using UnityEngine; using System.Collections; public class MagnetLaser : MonoBehaviour { private LineRenderer lr; public GameObject player; public GameObject rodstart; public int segments; public float randomSize; private magnetGun gun; // Use this for initialization void Start () { gun = player.GetComponent (); lr = GetComponent (); } // Update is called once per frame void Update () { if (gun.GravityTarget != null) { lr.enabled = true; lr.SetVertexCount(segments+1); lr.SetPosition(0, rodstart.transform.position); lr.SetPosition (segments,gun.GravityTarget.transform.position); Vector3 normalizedV =(gun.GravityTarget.transform.position - player.transform.position); float distance = normalizedV.magnitude; //normalizedV.Normalize(); for (int i = 1; i