0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

PingPongの使い方に

0
Posted at

PingPongの引数

Mathf.PingPong(t, length);

tは往復速度を表して

lengthは往復させる範囲を表している

例えばlengthが3の場合

length
1
2
3
2
1

1,2,3,2,1がひたすら繰り返される動きになる

tにTime.time割り当てる事で秒数ごとに処理ができる

(Time.timeとは実行してから経過している時間)

Mathf.PingPong(Time.time, 3);

上のコードの場合以下のような結果になる

length Time.time
1 1秒後
2 2秒後
3 3秒後
2 4秒後
1 5秒後

使用例

動く壁
無題の動画 ‐ Clipchampで作成 (1).gif

最後に

機械的な動きをさせたいときに使うといい感じになりそう

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?