当前位置:网站首页>[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 !!!
边栏推荐
- Comment utiliser le logiciel wangyou DFM pour l'analyse des plaques froides
- Priority analysis of list variables in ansible playbook and how to separate and summarize list variables
- Tidb data migration (DM) Introduction
- 学习Mysql基础第一天
- Raspberry school advanced development - "writing of IO port driver code" includes bus address, physical \u virtual address and bcm2835 chip manual knowledge
- New Taishan crowdfunding business diversion fission growth model in 2022
- First day of learning MySQL Basics
- 通过函数seaborn.cubehelix_palette生成顺序调色板
- June 12, 2022: if there are n*n pieces in an n*n square chessboard, each grid can have exactly one piece. But now some pieces are gathered on a grid, such as 2030100300. The above two-dimensional arra
- Local file upload FTP or remote directory
猜你喜欢

First day of learning MySQL Basics

不间断管理设计

Jinglianwen technology provides a one-stop smart home data acquisition and labeling solution

Why is the new e-commerce outlet mode so popular? What is the specific mode?

Project analysis of Taishan crowdfunding mode: why is Taishan crowdfunding mode so popular?

RT-Thread 模拟器 simulator LVGL控件:button 按钮事件

Tidb dashboard modify port

Micro isolation (MSG)

数字时代进化论

10 Honest Facts I Want To Share With All Junior Developers
随机推荐
1154. day of the year
Ansible PlayBook的中清单变量优先级分析及清单变量如何分离总结
牙周炎问题调研(持续进行中)
In the era of membership based social e-commerce, how do businesses build their own private domain traffic pool?
Can flush open a stock account? Is it safe?
How to seize the bonus of social e-commerce through brand play to achieve growth and profit?
Related operations under Oracle Database
通过函数seaborn.cubehelix_palette生成顺序调色板
10 Honest Facts I Want To Share With All Junior Developers
[Markov chain Monte Carlo] Markov chain Monte Carlo method sampling prior distribution
The innovative public platoon mode team invites users to split, beautiful every second, and links the 2+1 new business model
怎么写出一份令人惊叹的设计文档?
RT-Thread 模拟器 simulator LVGL控件:button 按钮事件
How to make a development board from scratch? Illustrated and illustrated, step by step operation for you to see.
Tidb data migration (DM) Introduction
上位机开发(固件下载软件之架构设计)
Jinglianwen technology provides voice data acquisition and labeling services
2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
测试开发程序员,你还在迷茫吗?不能把自己定义为码农......
Lightning breakpoint continuation