Go to new position with Corutine
using System.Collections;
public class GoToOtherPosition : MonoBehaviour {
public Vector3 d;
int i = 0;
void Start () {
StartCoroutine ( MoveTowardsTarget() );
}
IEnumerator MoveTowardsTarget() {
for(int i = 0 ; i <= 30 ; i++)
{
//yield return new WaitForSeconds(0.005f);
yield return null;
transform.position = new Vector3 (i, 0, 0);
}
}
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น