using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR.InteractionSystem; public class LinearDriveSpring : MonoBehaviour { public LinearDrive LinearDrive; public Interactable Interactable; private void Update() { if (!Interactable.attachedToHand) { transform.position += (LinearDrive.startPosition.position - transform.position) * 10f * Time.deltaTime; LinearDrive.linearMapping.value = (transform.position - LinearDrive.startPosition.position).magnitude / (LinearDrive.endPosition.position - LinearDrive.startPosition.position).magnitude; } } }