Phillipes_Fablab/Assets/Scripts/CatalogElement.cs
2023-01-16 15:16:34 +01:00

45 lines
933 B
C#

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;
}
}