Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Unity.Mathematics;
- using UnityEngine;
- public class CableSpawner : MonoBehaviour
- {
- public GameObject empty;
- public AnimationCurve curve;
- // Start is called before the first frame update
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- }
- private void OnMouseDown()
- {
- Debug.Log("PRESSED");
- if (empty != null)
- {
- GameObject startPoint = Instantiate(empty, transform.position, new Quaternion(0, 0,0 ,0 ));
- GameObject endPoint = Instantiate(empty, Input.mousePosition, new Quaternion(0, 0, 0, 0));
- endPoint.AddComponent<StayUnderMouse>();
- startPoint.AddComponent<CableProceduralCurve>();
- startPoint.GetComponent<CableProceduralCurve>().endPointTransform = endPoint.transform;
- startPoint.GetComponent<CableProceduralCurve>().curve = curve;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment