using NBF; using Obi; using UnityEngine; public class Rope : MonoBehaviour { private FRod _rod; [SerializeField] private ObiRope rope; [SerializeField] private ObiRopeCursor cursor; [SerializeField] private float percentageElasticity = 0.2f; private float stretchScale; private void Awake() { rope = GetComponent(); if (_rod) { LineLength_OnValueChanged(_rod.lineLength); } } public void LineLength_OnValueChanged(float length) { cursor = ((cursor == null) ? GetComponent() : cursor); stretchScale = Mathf.Clamp(length - percentageElasticity, 0f, float.PositiveInfinity); } private void Update() { rope.stretchingScale = stretchScale; } }