当前位置:网站首页>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 ");
}
}
边栏推荐
- 股票利益【非dp】
- The subsystem implementing transaction persistence in DBMS is ()
- How to write a conditional statement to obtain the value of the maximum time in a table using a MySQL statement
- Enlist soldiers and generals, draw small programs, multi-threaded display time
- 【Paper】2015_ Active fault-tolerant control system design with trajectory re-planning against actuator
- System programming summary
- Qt6 QML Book/Qt Quick 3D/Qt Quick 3D
- [control] multi agent system summary. 4. control agreement.
- Difference between TCP three handshakes and four waves and tcp/udp
- 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
猜你喜欢

Intern method of string

Directory operations and virtual file systems

Introduction to system programming

为什么win10开热点后电脑没有网络?

This connection is not a private connection this website may be pretending to steal your personal or financial information

Learning about signals

How to use div boxes to simulate line triangles

【Paper】2021_ Analysis of the Consensus Protocol of Heterogeneous Agents with Time-Delays

Matlab reads fig file and restores signal

Recommended cultural landmarks of these tourist attractions in Bangkok
随机推荐
Foreign SSL certificate
Issue SSL certificate with IP address
Servlet lifecycle
What to do when the alicloud SSL certificate expires
Blocking queue example
Pourquoi l'ordinateur n'a - t - il pas de réseau après l'ouverture du Hotspot win10?
Keywords implements and @override
This connection is not a private connection this website may be pretending to steal your personal or financial information
Serializable and Deserialize
Qt Creator 8 Beta2发布
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
Is the Flink connector JDBC open source? Where can I download it
Learning about signals
Learn about threads
[FPGA] IIC读写EEPROM 的实现
【Paper】2020_ Research on defense and evaluation strategy of heterogeneous UAV formation_ Zuojiankai
基于servlet+jsp+mysql实现的工资管理系统【源码+数据库】
[UAV] gyroscope data analysis, taking Victor intelligent jy901b as an example
Five methods to clear floating and their advantages and disadvantages
Encapsulating JDBC tool classes