当前位置:网站首页>[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 !!!
边栏推荐
- Is it safe for Hangzhou Securities to open an account?
- Upper computer development (software test of firmware download software)
- Computer network interview questions
- Tidb execution plan -- II
- 如何使用望友DFM軟件進行冷板分析
- Tidb index optimization
- How worker threads in the thread pool are recycled
- 【马尔科夫链-蒙特卡罗】马尔科夫链-蒙特卡罗方法对先验分布进行抽样
- FSM state machine
- 【腾讯阿里最全面试题集锦】(四面:3轮技术+1轮HR)
猜你喜欢
Nfv basic overview
Computer network interview questions
Lightning breakpoint continuation
NFV基本概述
Project analysis of Taishan crowdfunding mode: why is Taishan crowdfunding mode so popular?
15、 IO stream (I)
基于FPGA的ds18b20温度传感器使用
【马尔科夫链-蒙特卡罗】马尔科夫链-蒙特卡罗方法对先验分布进行抽样
2022-06-12:在N*N的正方形棋盤中,有N*N個棋子,那麼每個格子正好可以擁有一個棋子。 但是現在有些棋子聚集到一個格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二維數組代錶,一
Reflection of C # Foundation
随机推荐
Tree list under winfrom treelist related
【腾讯阿里最全面试题集锦】(四面:3轮技术+1轮HR)
我的理财产品显示清算中是什么意思?
Tidb index optimization
Comment utiliser le logiciel wangyou DFM pour l'analyse des plaques froides
2022-06-12:在N*N的正方形棋盘中,有N*N个棋子,那么每个格子正好可以拥有一个棋子。 但是现在有些棋子聚集到一个格子上了,比如: 2 0 3 0 1 0 3 0 0 如上的二维数组代表,一
Tidb grafana reverse proxy
RT-Thread 模拟器 simulator LVGL控件:button 按钮事件
Upper computer development (software test of firmware download software)
NFV基本概述
Tidb statistics
In the era of membership based social e-commerce, how do businesses build their own private domain traffic pool?
DM Experiment 6: filter replication
汇编语言基础:寄存器和寻址方式
ML:机器学习模型的稳定性分析简介、常见的解决方法之详细攻略
c#高级编程-特性篇
Ticdc introduction
Is it safe for Hangzhou Securities to open an account?
杭州网上开户是安全的吗?
上位机开发(固件下载软件之详细设计)