teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

誤字

2021/03/10 05:10

投稿

land25
land25

スコア7

title CHANGED
File without changes
body CHANGED
@@ -40,15 +40,15 @@
40
40
  private IEnumerator moveTarget(float speed)
41
41
  {
42
42
  Vector3 tmp = sphere.transform.position;
43
- sphere.transform.position = Vector3.Lerp(tmp, target1.transform.position, 0.1f);
43
+ sphere.transform.position = Vector3.MoveTowards(tmp, target1.transform.position, speed);
44
44
  yield return new WaitForSeconds(3.0f) ;
45
45
 
46
46
  Vector3 tmp2 = sphere.transform.position;
47
- sphere.transform.position = Vector3.Lerp(tmp2, target2.transform.position, 0.1f);
47
+ sphere.transform.position = Vector3.MoveTowards(tmp2, target2.transform.position, speed);
48
48
  yield return new WaitForSeconds(3.0f);
49
49
 
50
50
  Vector3 tmp3 = sphere.transform.position;
51
- sphere.transform.position = Vector3.Lerp(tmp3, startPos, 0.1f);
51
+ sphere.transform.position = Vector3.MoveTowards(tmp3, startPos, speed);
52
52
  yield return new WaitForSeconds(3.0f);
53
53
  }
54
54
 
@@ -58,6 +58,7 @@
58
58
  StartCoroutine(moveTarget(speed));
59
59
  }
60
60
  }
61
+
61
62
  ```
62
63
 
63
64
  ### 試したこと