Wait delay Moving Platform at each point
I'm trying to make moving platform wait for a delay at point A (currentPosition) and B (moveToward). The current script only waits at point B.
public bool move;
public float moveSpeed = 0.3f;
public float delayMoveTime = 1.0f;
public Vector3 moveToward;
private Vector3 currentPosition;
void Start () {
currentPosition = transform.position;
}
void FixedUpdate () {
// PingPong object back and forth
if (move) {
float time = Mathf.PingPong (Time.time * moveSpeed, delayMoveTime);
transform.position = Vector3.Lerp (currentPosition, moveToward, time);
}
}
Comment