private void Awake()
    {
        instance = this;                    // インスタンス取得
        Application.targetFrameRate = 60;   // fpsセット
        DontDestroyOnLoad(gameObject);      // 永続化

        // ARKitセッションの初期化 ----
        session = UnityARSessionNativeInterface.GetARSessionNativeInterface();
        ARKitWorldTrackingSessionConfiguration config = new ARKitWorldTrackingSessionConfiguration();

        config.planeDetection        = UnityARPlaneDetection.Horizontal;
        config.alignment             = UnityARAlignment.UnityARAlignmentGravity;
        config.getPointCloudData     = true;
        config.enableLightEstimation = false;
        session.RunWithConfig(config);  // セッション実行

        // Cameraがなければ取得
        if (trackingCamera == null)
        {
            trackingCamera = Camera.main;
        }
        // Cardboardの自動ヘッドトラッキング停止
        UnityEngine.XR.XRDevice.DisableAutoXRCameraTracking(trackingCamera, true);
        // シーン遷移時のイベント登録
        SceneManager.sceneLoaded += OnSceneLoaded;
    }
Beispiel #2
0
    private void Start()
    {
        // GvrTrackerインスタンス取得
        vrTacker  = MobileVRTracker.Instance;
        calibData = new CalibrationData();

        // PointCloudパーティクル初期化
        particleBase = Instantiate(pointCloudParticlePrefab);
        frameUpdated = false;
        UnityARSessionNativeInterface.ARFrameUpdatedEvent += ARFrameUpdated;

        // Plane生成用Anchor
        anchorManager = new UnityARAnchorManager();
        UnityARUtility.InitializePlanePrefab(planePrefab);
    }