Answer the question
In order to leave comments, you need to log in
How to move an object from point to point?
Here is my code how to make an object move back and forth indefinitely
public class MoveEnem : MonoBehaviour
{
public Vector2 startPos;
public Vector2 endPos;
public float step;
private float progress;
void Start()
{
transform.position = startPos;
}
void Update()
{
transform.position = Vector2.Lerp(startPos, endPos, progress);
progress += step;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question