当前位置:网站首页>[vivefocus uses the wavevr plug-in to obtain handle operation events]
[vivefocus uses the wavevr plug-in to obtain handle operation events]
2022-06-13 07:04:00 【The year of the Phoenix】
ViveFocus Use WaveVR The plug-in gets the handle operation event
The birth of this article
Join a new company , Take over old projects , The inevitable trouble of the program ape . unfortunately , I am just an old VR The project is stuck in how to get the handle event . I found a lot of information on the Internet , Basically not , Probably because ViveFocus The reason why the sales volume of this single handle device is not very good . Today I will tell you the method , Everyone in the province takes the same detour as me .
Single handle equipment 
One 、 Plugins are required WaveVR
This WaveVR Plug in ,Unity The mall has a free version , Download and import directly , The reason for mentioning here is , There are many people who like to play online disk resources , What I want to say is that common plug-ins like this , You'd better go first Unity Mall and PakageManager Let's find out if there is , If there are, use Unity After all, its own version is the best , The optimal .
( You have to say your Unity Version does not support such a high version , I want to say that's another matter , Just suggest )
Let's get to the point
Two 、 Place the necessary prefabricated parts in the scene

First step , The necessary prefabricated parts are placed in the scene. None of these five elements is indispensable .
WaveVR— Make sure VR visual angle
ControllerLoader—VR Basic controller ( Such as manual adjustment )
InputModuleManager— Radiographic inspection control manager
ButtonManager— Handle button effective management 
WaveVRButtons— Handle button configuration list 
3、 ... and 、 The code gets the handle interaction event
Finish the above preparations , Here comes the main point :
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using wvr;// Namespace is required
public class GamePanel : MonoBehaviour
{
Text showText;
CanvasGroup group;
private void Awake()
{
// Because it is finally packaged as Android for glasses , So ordinary printing is not enough ,
// It's best to generate one Text Components , After the interactive button , Display the content inside
showText = transform.Find("ShowText").GetComponent<Text>();
// control UI Interface display and concealment
group = transform.GetComponent<CanvasGroup>();
}
void Start()
{
}
private void Update()
{
// Judge whether there is a precast body in the scene , Avoid misplacing the times
if (WaveVR_ButtonManager.Instance == null)
return;
// Big disc press
bool pressedTouchpad = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant).GetPressDown(WVR_InputId.WVR_InputId_Alias1_Touchpad);
if (pressedTouchpad)
{
showText.text = " Press Touchpad!!!";
group.alpha = 1;
}
// Press the wrench key
bool pressedTrigger = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant).GetPressDown(WVR_InputId.WVR_InputId_Alias1_Trigger);
if (pressedTrigger)
{
showText.text = " Press Trigger!!!";
group.alpha = 0;
}
// Press... On the disc
bool pressedUp = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant).GetPressDown(WVR_InputId.WVR_InputId_Alias1_DPad_Up);
if (pressedUp)
{
showText.text = " Press Up!!!";
}
// Press the big round key in the middle , The one with a horizontal line
bool pressedMenu = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant).GetPressDown(WVR_InputId.WVR_InputId_Alias1_Menu);
if (pressedMenu)
{
showText.text = " Press Menu!!!";
}
// Volume key + Press down
bool pressedVolume_Up = WaveVR_Controller.Input(WaveVR_Controller.EDeviceType.Dominant).GetPressDown(WVR_InputId.WVR_InputId_Alias1_Volume_Up);
if (pressedVolume_Up)
{
showText.text = " Press Volume_Up!!!";
}
}
}
Conclusion
Binggo~, It's that simple !!!
Originality is not easy. , Share the pitfalls in the development process !!!
If it can help you , Welcome to thumb up !!!
If you have any questions, please read the message !!!
Love between brother and sister , Can you give me a compliment !!!
边栏推荐
- 2022 - 06 - 12: dans un échiquier carré n * N, il y a n * n pièces, donc chaque pièce peut avoir exactement une pièce. Mais maintenant quelques pièces sont rassemblées sur une grille, par exemple: 2 0
- Soup side (8)
- Ml: introduction to stability analysis of machine learning model and detailed introduction to common solutions
- Priority analysis of list variables in ansible playbook and how to separate and summarize list variables
- Jinglianwen technology provides voice data acquisition and labeling services
- Eureka server multi node deployment
- 上位机开发(固件下载软件之软件测试)
- Computer network interview questions
- Jinglianwen Technology: current situation and solutions of data acquisition and labeling industry
- RT-Thread 模拟器 simulator LVGL控件:button 按钮事件
猜你喜欢

基于FPGA的ds18b20温度传感器使用

测试开发程序员,你还在迷茫吗?不能把自己定义为码农......

Intelligent entertainment has developed steadily, and jinglianwen technology provides data collection and labeling services

Tree list under winfrom treelist related

RT thread simulator lvgl control: button button style

The causes of font and style enlargement when the applet is horizontal have been solved

【马尔科夫链-蒙特卡罗】马尔科夫链-蒙特卡罗方法对先验分布进行抽样

SDN basic overview

Fe of mL: introduction to vintage curve /vintage analysis, calculation logic and detailed introduction to case application

上位机开发(固件下载软件之详细设计)
随机推荐
【腾讯阿里最全面试题集锦】(四面:3轮技术+1轮HR)
RT-Thread 模拟器 simulator LVGL控件:button 按钮事件
Department store center supply chain management system
In the era of membership based social e-commerce, how do businesses build their own private domain traffic pool?
Chain 2+1 reward, what kind of mode is beautiful everyday seconds?
YOLOv5解析 | 参数与性能指标
ML之FE:Vintage曲线/Vintage分析的简介、计算逻辑、案例应用之详细攻略
基于ESP32CAM实现WebSocket服务器实时点灯
基于SSM实现水果商城批发平台
Computer network interview questions
上位机开发(固件下载软件之编码调试)
10 Honest Facts I Want To Share With All Junior Developers
检测循环数“142857“
Normalizing y-axis in histograms in R ggplot to proportion
我的理财产品显示清算中是什么意思?
How to make a development board from scratch? Illustrated and illustrated, step by step operation for you to see.
105. constructing binary trees from preorder and inorder traversal sequences
Jinglianwen technology provides voice data acquisition and labeling services
[cloud native | kubernetes] kubernetes configuration
Lightning data import