How to make object repeatdly go up and down motion to 2 certain points and back
just as title says want it to go repeatedly (every 2 seconds) to two points and return back to origin so basically repeated motions every 2 seconds t goes up and down motion
the script I have now goes but not repeatedly and I need it to do this automatically .. I have a movetowards script but not sure I used rite thing I m new so not sure what is most optimal, again for this I want this object to move up and down repeatfdly every 2 seconds, it is a 0 gravity rigibody2d it goes up on start but not back down and not every 2 seconds like I want
this is 2d
pragma strict
// this works but asap goes to object not slowly movig towards
var start : Transform;
var end : Transform;
function Update () {
// if (Input.GetKey("1")){
transform.position = Vector3.Lerp(start.position, end.position, Time.time);
}
}
Comment
I would suggest to use LeanTween or iTween for tasks like this. They are both free and in the asset store.
dmax , perfect thanks.. once again .,, you are the best
Your answer
