Пример #1
0
    void Awake()
    {
        instance = this;
        objects  = GameObject.FindObjectsOfType <NoloVR_TrackedDevice>();
        GameObject androidCallBack = new GameObject("USB Host Peripherals");

        androidCallBack.AddComponent <NoloVR_AndroidCallBack>();
        switch (turnAroundButtonType)
        {
        case TurnAroundButtonType.Menu:
            buttontype = NoloButtonID.Menu;
            break;

        case TurnAroundButtonType.Touchpad:
            buttontype = NoloButtonID.TouchPad;
            break;

        case TurnAroundButtonType.Grip:
            buttontype = NoloButtonID.Grip;
            break;

        case TurnAroundButtonType.Null:
            break;

        default:
            break;
        }
        NoloVR_Controller.Listen();
    }
Пример #2
0
 public static NoloVR_Manager GetInstance()
 {
     if (instance == null)
     {
         instance = new NoloVR_Manager();
     }
     return(instance);
 }
Пример #3
0
    void Awake()
    {
        instance = this;
        objects  = GameObject.FindObjectsOfType <NoloVR_TrackedDevice>();
        GameObject androidCallBack = new GameObject("USB Host Peripherals");

        androidCallBack.AddComponent <NoloVR_AndroidCallBack>();
        NoloVR_Playform.InitPlayform().SetHmdTrackingCenter(NoloVR_Utils.GetHmdTrackingCenter(vrPlayform));
        NoloVR_Controller.Listen();
    }
 void Start()
 {
     foreach (NoloVR_TrackedDevice item in NoloVR_Manager.GetInstance().objects)
     {
         if (item.deviceType == NoloDeviceType.LeftController)
         {
             leftController = item.gameObject.transform;
         }
         if (item.deviceType == NoloDeviceType.RightController)
         {
             rightController = item.gameObject.transform;
         }
     }
     controllerCenter = new GameObject("controllerCenter");
 }
Пример #5
0
 void Update()
 {
     //按下touchpad
     if (NoloVR_Controller.GetDevice(deviceType).GetNoloButtonPressed(NoloButtonID.TouchPad))
     //if (true)
     {
         PointerActivate(true);
         var jointPosition = ProjectForwardBeam();
         downPosition = ProjectDownBeam(jointPosition);
         DisplayCurvedBeam(jointPosition, downPosition);
         SetPointerCursor(downPosition);
     }
     if (NoloVR_Controller.GetDevice(deviceType).GetNoloButtonUp(NoloButtonID.TouchPad))
     {
         if (pointerContactTarget != null)
         {
             NoloVR_Manager.GetInstance().transform.position = downPosition -
                                                               new Vector3(NoloVR_Controller.GetDevice(NoloDeviceType.Hmd).GetPose().pos.x, 0, NoloVR_Controller.GetDevice(NoloDeviceType.Hmd).GetPose().pos.z);
         }
         PointerActivate(false);
     }
 }
    void Update()
    {
        if (NoloVR_Playform.InitPlayform().GetPlayformError() != NoloError.None)
        {
            return;
        }

        transform.localPosition = new Vector3(0, -NoloVR_Plugins.GetHmdInitPosition().y, 0);
        //y - play ground height
        for (int i = 0; i < NoloVR_Manager.GetInstance().objects.Length; i++)
        {
            if (Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.x) > Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.z) ||
                Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.y - transform.position.y) > Mathf.Abs(NoloVR_Manager.GetInstance().objects[i].transform.localPosition.z) + 0.1f)
            {
                NOLO_Events.Send(NOLO_Events.EventsType.TrackingOutofRange);
                break;
            }
            else
            {
                NOLO_Events.Send(NOLO_Events.EventsType.TrackingInRange);
            }
        }
    }
Пример #7
0
    public override void OnInspectorGUI()
    {
        m_Target                = target as NoloVR_Manager;
        m_Target.appKey         = EditorGUILayout.TextField("App Key", m_Target.appKey);
        m_Target.gameTrackModel = (NoloVR_Manager.TrackModel)EditorGUILayout.EnumPopup("Game Track Model", m_Target.gameTrackModel);
        if (m_Target.gameTrackModel == NoloVR_Manager.TrackModel.Track_3dof)
        {
            track = NoloVR_Manager.TrackModel.Track_3dof;
            m_Target.useDefaultHeight = EditorGUILayout.Toggle("Use Default Height", m_Target.useDefaultHeight);
            if (m_Target.useDefaultHeight)
            {
                m_Target.defaultHeight = EditorGUILayout.Slider("Default Height", m_Target.defaultHeight, 1, 2);
            }
            //ResetRightContrller(false);
            string strPC = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
            if (strPC.Contains("NOLO_6DOF"))
            {
                strPC = strPC.Replace("NOLO_6DOF", "NOLO_3DOF");
            }
            else if (strPC.Contains("NOLO_3DOF"))
            {
            }
            else
            {
                strPC += ";NOLO_3DOF";
            }
            string strAD = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
            if (strAD.Contains("NOLO_6DOF"))
            {
                strAD = strAD.Replace("NOLO_6DOF", "NOLO_3DOF");
            }
            else if (strPC.Contains("NOLO_3DOF"))
            {
            }
            else
            {
                strAD += ";NOLO_3DOF";
            }
            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, strPC);
            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, strAD);
        }
        else
        {
            track                         = NoloVR_Manager.TrackModel.Track_6dof;
            m_Target.VRCamera             = (GameObject)EditorGUILayout.ObjectField("VR Camera", m_Target.VRCamera, typeof(GameObject), true);
            m_Target.turnAroundButtonType = (TurnAroundButtonType)EditorGUILayout.EnumPopup("Turn Around Button", m_Target.turnAroundButtonType);
            type = m_Target.turnAroundButtonType;
            //ResetRightContrller(true);
            string strPC = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
            if (strPC.Contains("NOLO_3DOF"))
            {
                strPC = strPC.Replace("NOLO_3DOF", "NOLO_6DOF");
            }
            else if (strPC.Contains("NOLO_6DOF"))
            {
            }
            else
            {
                strPC += ";NOLO_6DOF";
            }
            string strAD = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
            if (strAD.Contains("NOLO_3DOF"))
            {
                strAD = strAD.Replace("NOLO_3DOF", "NOLO_6DOF");
            }
            else if (strPC.Contains("NOLO_6DOF"))
            {
            }
            else
            {
                strAD += ";NOLO_6DOF";
            }
            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, strPC);
            PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, strAD);
        }


        if (GUI.changed)
        {
            EditorUtility.SetDirty(m_Target);
        }
    }
Пример #8
0
 private void Awake()
 {
     m_Target = target as NoloVR_Manager;
     m_Target.gameTrackModel       = track;
     m_Target.turnAroundButtonType = type;
 }
Пример #9
0
 void Start()
 {
     vrCamera = NoloVR_Manager.GetInstance().VRCamera;
 }
 void Start()
 {
     //get vrcamera
     vrCamera = NoloVR_Manager.GetInstance().VRCamera;
 }