SteamVR_LaserPointer是自带的脚本直接挂上就行
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
using Valve.VR.Extras;
//写的一个控制射线关闭开启的功能
public class LaserPointer_Chh : MonoBehaviour
{
public SteamVR_LaserPointer SteamVrLaserPointer;
/// <summary>
/// 什么类型的按键
/// </summary>
public SteamVR_Action_Boolean disk;
void Start()
{
if (SteamVrLaserPointer == null)
SteamVrLaserPointer = this.GetComponent<SteamVR_LaserPointer>();
}
void Update()
{
//SteamVR_Input_Sources.RightHand 只获取右手的
if (disk.GetStateDown(SteamVR_Input_Sources.RightHand))
{
//按下圆盘开启射线
OpenLaserPointer();
}
if (disk.GetStateUp(SteamVR_Input_Sources