当前位置:网站首页>HTC vive cosmos development - handle button event
HTC vive cosmos development - handle button event
2022-06-30 04:43:00 【ToDoNothing】
1. Environment configuration
htc vive cosmos The environment configuration of is relatively simple , stay HTC VIVE Download from the official website VIVEPORT The client can : website :viveport
2. Handle key event (unity+VRTK)
(1) take VRTK and Steam VR Import ,steam vr Version cannot be too new , Press VRTK Only those recommended on the official website , I am using steam vr The version is 1.2.3,unity Version is 2019.4.8f1. Official website transmission :VRTK
(2) The second is , stay Player Setting Inside , Need to put OpenVR Put it on the top , hold None Get rid of .
(3) The corresponding keys of the handle can be in VRTK In the event mechanism of , And it's very simple , Add a script to the mapping of the handle .
(4) The code is also simple , as follows :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VRTK;
public class TriggerButtonTest : MonoBehaviour
{
private VRTK_ControllerEvents controllerEvents;
void Start()
{
controllerEvents = GetComponent<VRTK_ControllerEvents>();
controllerEvents.TriggerPressed += DoTriggerPressed;
//ButtonOnePressed Corresponding Cosmos Handle is X key
controllerEvents.ButtonOnePressed += ButtonOnePress;
//ButtonTwoPressed Corresponding Cosmos Handle is Y key
controllerEvents.ButtonTwoPressed += ButtonTwoPress;
//GripPressed Corresponding Cosmos Handle is Grip key
controllerEvents.GripPressed += GripPress;
//TouchpadPressed Corresponding Cosmos Handle is Grip key
controllerEvents.TouchpadPressed += TouchpadPress;
}
// Update is called once per frame
void Update()
{
}
private void DoTriggerPressed(object sender, ControllerInteractionEventArgs e)
{
Debug.Log("Trigger Press");
}
private void ButtonOnePress(object sender, ControllerInteractionEventArgs e)
{
Debug.Log("ButtonOnePress ");
}
private void ButtonTwoPress(object sender, ControllerInteractionEventArgs e)
{
Debug.Log("ButtonTwoPress");
}
private void StartMenuPress(object sender, ControllerInteractionEventArgs e)
{
Debug.Log("StartMenuPress ");
}
private void GripPress(object sender, ControllerInteractionEventArgs e)
{
Debug.Log("GripPress ");
}
private void TouchpadPress(object sender, ControllerInteractionEventArgs e)
{
Debug.Log("TouchpadPress ");
}
}
边栏推荐
- Input / output and interrupt technology -- microcomputer Chapter 6 learning notes
- How to repair expired SSL certificates?
- 為什麼win10開熱點後電腦沒有網絡?
- MySQL查询小工具(一)json格式的字符串字段中,替换json数组中对象的某个属性值
- How to renew an SSL certificate
- One interview question every day to talk about the process of TCP connection and disconnection
- Royal Albert Hall, a popular landmark in London
- Dual domain SSL certificate
- [UAV] kinematic analysis from single propeller to four rotor UAV
- Check London attractions suitable for parents and children in winter vacation
猜你喜欢

Sailing experience not to be missed in New York Tourism: take you to enjoy the magnificent city scenery from different perspectives

harbor api 2.0查询

How to use div boxes to simulate line triangles

Use of thread pool

Approaching history, introduction to the London Guard Museum

Junior students summarize JS basic interview questions

Have a heart beating Valentine's day in Singapore

Issue SSL certificate with IP address

Redis实现短信登入功能(二)Redis实现登入功能

How to repair expired SSL certificates?
随机推荐
【Paper】2021_ Uniformity of heterogeneous hybrid multi-level intelligent systems using UGV and UAV
[control] multi agent system summary. 4. control agreement.
How to write a conditional statement to obtain the value of the maximum time in a table using a MySQL statement
EasyRecovery数据恢复软件 恢复了我两年前的照片视频数据
【Paper】2017_ Research on coordinated control method of underwater vehicle formation marine survey
Efficiency test of adding and querying ArrayList and LinkedList
brew安装nvm报nvm command not found解决方案
Threejs实现模拟河流,水面水流,水管水流,海面
【Paper】2015_ Coordinated cruise control for high-speed train movements based on a multi-agent model
什么是光耦电路,实际使用中应该注意些什么?
小C的数组(array)
Winter vacation parent-child tour, these new york attractions are not only fun but also knowledge
Circle center technology, very anxious?
Cheap SSL certificate abroad
Encapsulating JDBC tool classes
SSL update method
Pourquoi l'ordinateur n'a - t - il pas de réseau après l'ouverture du Hotspot win10?
Thread safety and processing caused by multithreading
[learn FPGA programming from scratch -52]: high level chapter - FPGA development based on IP core - basic framework for IP core use (taking PLL as an example)
Beanfactory creation process