Created
November 5, 2025 15:33
-
-
Save nilsmunch/5197559663b9fe7f9ace991eb1198736 to your computer and use it in GitHub Desktop.
Crane stuff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using LizardKit.DebugButton; | |
| using UnityEngine; | |
| public class CraneCable : MonoBehaviour | |
| { | |
| public LineRenderer lineRenderer; | |
| public Transform CraneTip; | |
| public Transform Hook; | |
| private void Update() | |
| { | |
| DrawLine(); | |
| } | |
| [Button] | |
| private void DrawLine() | |
| { | |
| lineRenderer.SetPosition(0, CraneTip.position); | |
| lineRenderer.SetPosition(1, Hook.position); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.InputSystem; | |
| public class CraneBaseController : MonoBehaviour | |
| { | |
| public float moveSpeed = 15f; | |
| public float winceSpeed = 1f; | |
| public SpringJoint CableWince; | |
| void Update() | |
| { | |
| if (Keyboard.current.leftArrowKey.isPressed) transform.Rotate(Vector3.forward * (moveSpeed * Time.deltaTime), Space.Self); | |
| if (Keyboard.current.rightArrowKey.isPressed) transform.Rotate(Vector3.back * (moveSpeed * Time.deltaTime), Space.Self); | |
| if (Keyboard.current.upArrowKey.isPressed) CableWince.maxDistance -= winceSpeed * Time.deltaTime; | |
| if (Keyboard.current.downArrowKey.isPressed) CableWince.maxDistance += winceSpeed * Time.deltaTime; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment