Guest User

Untitled

a guest
Oct 22nd, 2023
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Unity.Mathematics;
  5. using UnityEngine;
  6.  
  7. public class CableSpawner : MonoBehaviour
  8. {
  9.  
  10. public GameObject empty;
  11. public AnimationCurve curve;
  12.  
  13. // Start is called before the first frame update
  14. void Start()
  15. {
  16.  
  17. }
  18.  
  19. // Update is called once per frame
  20. void Update()
  21. {
  22.  
  23. }
  24.  
  25. private void OnMouseDown()
  26. {
  27. Debug.Log("PRESSED");
  28. if (empty != null)
  29. {
  30. GameObject startPoint = Instantiate(empty, transform.position, new Quaternion(0, 0,0 ,0 ));
  31. GameObject endPoint = Instantiate(empty, Input.mousePosition, new Quaternion(0, 0, 0, 0));
  32. endPoint.AddComponent<StayUnderMouse>();
  33. startPoint.AddComponent<CableProceduralCurve>();
  34. startPoint.GetComponent<CableProceduralCurve>().endPointTransform = endPoint.transform;
  35. startPoint.GetComponent<CableProceduralCurve>().curve = curve;
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment