Unityの床をひたすらループさせる
キャラクターがひたすら走っているように見せる為に床をループさせましょう。同じサイズの床を二枚並べます。
以下のスクリプトを二枚の床にドラック&ドロップすればOK!です。
FloorLoop
using UnityEngine;
using System.Collections;
public class FloorLoop : MonoBehaviour {
public float speed;
float size = 60;
void Start () {
speed = -1;
}
void Update () {
transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z+speed);
if (transform.position.z + size < 0) {
transform.position = new Vector3(0,0,transform.position.z+size*2);
}
}
}
Author And Source
この問題について(Unityの床をひたすらループさせる), 我々は、より多くの情報をここで見つけました https://qiita.com/amano-kiyoyuki/items/b3f7a62bfed14ac331e0著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .