using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using Valve.VR.InteractionSystem; public class CatalogElement : MonoBehaviour { private Vector3 returnPosition; // Start is called before the first frame update void Start() { returnPosition = transform.localPosition; } // Update is called once per frame void Update() { } public void OnGrabSphere() { } public void OnReleaseSphere() { StartCoroutine(ReturnSphere()); } private IEnumerator ReturnSphere() { float time = 0; Vector3 startPosition = transform.localPosition; while (time <= 1) { transform.localPosition = Vector3.Lerp(startPosition, returnPosition, time); time += Time.deltaTime*4; yield return null; } yield break; } }