当前位置:网站首页>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 ");
}
}
边栏推荐
- Beanfactory creation process
- 【Paper】2019_ Consensus Control of Multiple AUVs Recovery System Under Switching Topologies and Time D
- Requirements for transfer transaction cases: 1 Employee 1 transfers money to employee 2. Therefore, two update sals should be executed. Purpose: either both updates are successful or both implementati
- Method of applying for code signing certificate by enterprise
- How to repair expired SSL certificates?
- MySQL查询小工具(一)json格式的字符串字段中,替换json数组中对象的某个属性值
- Recommended cultural landmarks of these tourist attractions in Bangkok
- Arrays class
- Ora-00907: missing right parenthesis problem supplement
- Stack implementation integrated Calculator - code implementation
猜你喜欢

National Museum of Singapore - give you spiritual and physical satisfaction

Threejs realizes the simulation of river, surface flow, pipe flow and sea surface

【Paper】2015_ Coordinated cruise control for high-speed train movements based on a multi-agent model

Meet in Bangkok for a romantic trip on Valentine's Day

Royal Albert Hall, a popular landmark in London

What is an optocoupler circuit and what should be paid attention to in actual use?

Recommended cultural landmarks of these tourist attractions in Bangkok

Matlab reads fig file and restores signal

【Paper】2019_ Consensus Control of Multiple AUVs Recovery System Under Switching Topologies and Time D

How to apply for SSL certificate from the manufacturer
随机推荐
【Paper】2021_ Uniformity of heterogeneous hybrid multi-level intelligent systems using UGV and UAV
Difference between request forwarding and redirection
How to renew an SSL certificate
Servlet lifecycle
Window10 jar double click to run without response
Process architecture and process management
Thread safety and processing caused by multithreading
brew安装nvm报nvm command not found解决方案
This connection is not a private connection this website may be pretending to steal your personal or financial information
什么是光耦电路,实际使用中应该注意些什么?
Five methods to clear floating and their advantages and disadvantages
Matlab reads fig file and restores signal
Lambda&Stream
Webots learning notes
What is the difference between synchronized and lock
Arsenal Stadium Tour - take you to the front and back of Arsenal Stadium
【Paper】2015_ Active fault-tolerant control system design with trajectory re-planning against actuator
How the FortiGate firewall rejects a port by using the local in policy policy
Difference between TCP three handshakes and four waves and tcp/udp
Is the Flink connector JDBC open source? Where can I download it