简体中文 | English

中文

A) 3Dof Controller (P1/P1 Pro)

1) Import the DPVR unity plugin (version 0.7.0 and above);

2) In the menu DPVR->Settings, please set the "Peripheral Support" option to "Flip";

3) DpnCameraRig.prefab will automatically generate controller-related prefabs, including code and models.

How to get the controller information:

1) If you want to get the pose and button information of the controller, you can refer to the Daydream controller and use the according properties on the DpnDaydreamController.cs script. For more information, please refer to the comment in the script. Compared to the Daydream controller, DPVR flip controller adds a TRIGGER button, removes the VOLUMEUP and VOLUMEDOWN buttons, changes the APP button to a BACK button and keeps the HOME button. The BACK and HOME button behavior are handled automatically, no application processing is required.

The current system default behavior for the 2 buttons is as follows:

BACK: The function is the same as the BACK key on the HMD;

HOME: Short press returns to launcher, long press recenter calibration;

2) The controller comes with a ray collision algorithm by default. If the menu->DPVR->Settings->"Use DPVRPointer" option option is checked, DPVR collision algorithm is used (default behavior); Otherwise user defined collision algorithm is taking effect;

3) If you set the menu->DPVR->Settings->"Peripheral Support" option to "None". The app would use HMD control as gaze cursor. However in this case, the 3Dof controller can still work as a controller and report its touch and button event as long as it is paired to the All-in-One HMD. Similarly, if you set Dpnmanager.DPVRPointer to true, the DPVR default collision algorithm will take effect;

4) On DPVRunity 0.7.3b and above, the 3Dof controller supports switching between left-hand and right-hand mode in unity plug-in. One can use Interface name : DpnDaydreamController.interactiveHand { set, get } where 0 represents right-hand mode and 1 represents left-hand mode. Please update to the latest image so as to enable this feature;

5) For UI interaction, On DPVRunity 0.7.6 and above, replace EventSystem with DpnEventSystem (please refer to My Very First Unity VR App, section 7), or, alternatively, replace the StandaloneInputModule component under EventSystem with DpnStandaloneInputModule (please refer to Unity Non-VR to VR Porting Tutorial, section 9).



B) Touchpad (M2、M2 Pro、P1、P2)

If you set the menu->DPVR->Settings->"Peripheral Support" option to "None". The app would use HMD control as gaze cursor. There is a touchpad on the right side of the DPVR All-in-One device (eg. M2, M2 Pro, P1, P2, etc.). It supports standard TouchPad and Mouse event.

In Unity, one can use Input.touchCount to check for Touch event. Use Input.GetTouch(0) to get detail info such as touch position.

What is more, the touchpad also reports a mouse event, so one can also use Input.GetMouseButton(0) to check for Touch event. And Input.mousePosition is the touch position.


Attach below script to a Text object, we can see the output.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;


public class TouchPad : MonoBehaviour
{
    Text txt;

    // Use this for initialization
    void Start()
    {
        txt = GetComponent<Text>();
    }

    // Update is called once per frame
    void Update()
    {
        string msg = "touch: ";

        if(Input.touchCount > 0)
        {
            Touch tch = Input.GetTouch(0);
            msg += tch.position.x + "," + tch.position.y + "," + tch.deltaPosition.x + "," + tch.deltaPosition.y + "," + tch.radius + "\n";
        }
        else
        {
            msg += "none\n";
        }

        Vector3 mouse_position = Input.mousePosition;
        bool btn0 = Input.GetMouseButton(0);

        msg += btn0.ToString() + " " + mouse_position.x + "," + mouse_position.y + "," + mouse_position.z + "\n";

        txt.text = msg;
    }
}

Copyright © dpvr.cn, All Rights Reserved 沪ICP备15019466号-2 (Shanghai) Shanghai Lexiang Technology Co., Ltd