using Obi; using Obvious.Soap; using UnityEngine; public class Rope : MonoBehaviour { [SerializeField] private ObiRope rope; [SerializeField] private ObiRopeCursor cursor; [SerializeField] private float percentageElasticity = 0.2f; [SerializeField] private FloatVariable lineLength; private float stretchScale; private void Awake() { rope = GetComponent(); LineLength_OnValueChanged(lineLength.Value); } 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; } }