Hello everyone, I’m new to Unity and I’m having an issue I believe should be easy to solve but haven’t been able to!
I’m working on an Android game, and when I’m done dragging an object with touch, I want it to go to its original position. This isn’t a problem when I want it to go from Point A to Point B immediately, but I want my object to go back to Point A slowly, and smoothly.
This is the part I have issues with, inside the update function.
if (touch.phase == TouchPhase.Ended) {
if(!lockedObject && objMoved == true) {
transform.position = Vector2.Lerp(originalPos, transform.position, Time.deltaTime); //This moves my object to its original position instantly
GetComponent<AudioSource> ().PlayOneShot (myClip[1]);
}
}