大きな流れ
- GameObjectの取得とポジションの取得
- ポジションの変更
GameObjectの取得とポジションの取得
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimerAndMove : MonoBehaviour {
GameObject camera;
// Use this for initialization
void Start () {
camera = GameObject.Find("OVRCameraRig"); // GameObjectの取得
pos = camera.transform.position; // ポジションの変更
}
// Update is called once per frame
void Update () {
}
}
- OVRCameraRigはGameObjectの名前
ポジションの変更
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimerAndMove : MonoBehaviour {
GameObject camera;
// Use this for initialization
void Start () {
camera = GameObject.Find("OVRCameraRig"); // GameObjectの取得
pos = camera.transform.position; // ポジションの変更
}
// Update is called once per frame
void Update () {
camera.transform.position = new Vector3 (pos.x , pos.y, pos.z + 10);
}
}
- この場合z軸方向に10ずつ移動し続ける