我们做Gear VR只能用触摸板控制移动。要么就写个定位移动,让他在固定地方停留下来。
主要思路是让物体在固定的地方停留,其中用来枚举和协程。枚举来控制点位的个数,协程控制下一步移动的方向。
你也可以在另外脚本中控制枚举状态,让你当前点位完成了你想要的操作,让后在让a->b。或者直接if (cc.position == t1.position){ts = point.c;}让它等于当前位置,直接下步。
你还可以写个协程让它在当前停留多少秒后在进行下布操作。
希望对初学者有帮助,有疑问的可以在下面留言。
在这里插入代码片
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class YDong1 : MonoBehaviour {
public enum point
{
a,
b,
c,
d,
e,
f,
sce,
third
}
public point ts = point.a;
public Transform t1;
public Transform t2;
public Transform t3;
public Transform t4;
public Transform t5;
public Transform t6;
private Vector3 en;
public Transform cc;
// Use this for initialization
void Update() {
if (ts == point.a)
{
en = new Vector3(t1.position.x, t1.position.y, t1.position.z);
StartCoroutine("YD")