コード例 #1
0
ファイル: main_proc.cs プロジェクト: stories2/TizenUnityVR
    // Update is called once per frame
    void Update()
    {
        if (r_flag == true)
        {
            r_flag = false;
            view.set_logger(log);
            gyroscope.set_logger(log);
            view.set_camera(main_camera, 0);
            view.set_camera(sub_camera, 1);

            log.push("init ok", "main_proc");
        }
        //process

        //get user x y z position
        if (gyroscope.is_platform_window())
        {
            vec3 = gyroscope.return_now_xyz();
        }
        else
        {
            vec3 = gyroscope.return_now_vector();
        }

        //rotate calculation
        int i, upper = 75;

        for (i = 0; i < 2; i += 1)
        {
            if (gyroscope.is_platform_window())
            {
                view.set_camera_rotate(calculate_rotate(gyroscope.return_prev_xyz(), gyroscope.return_now_xyz()), i);
            }
            else
            {
                //view.set_camera_rotate (calculate_rotate (level_upper (gyroscope.return_prev_vector (), 100), level_upper (gyroscope.return_now_vector (), 100)), i);
                view.set_camera_rotate(calculate_rotate(level_upper(gyroscope.return_prev_vector(), upper), level_upper(gyroscope.return_now_vector(), upper)), i);
            }
        }

        //i/o
        if (gyroscope.is_platform_window() != true)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Application.Quit();
            }
        }
    }