SteamVR 2.0设备手柄认识——绑定BindingUI——手柄检测
设备认识
手柄
设备接口
Action类型
bool、vector1、vector2、vector3、pose、skeleton
bool
既然是按键自然有按下,抬起,一直按,双击
菜单,电源,扳机都是bool值
Vector1
2019年4月15日13:57:13
抱歉这个暂时不知道怎么用,如果你知道可以告诉我。
Vector2
触控板也是触控键,二维坐标,很好理解
Vector3
三维坐标,可以理解为手柄的位置,和头显位置。
Pose
2019年4月15日13:57:13
抱歉这个暂时不知道怎么用,如果你知道可以告诉我。
skeleton
猜测跟骨胳手有关系,还是暂时没用过,毕竟刚学
ActionSet动作集
属于包含关系
动作集包含动作,而动作包含动作类型
如同下图,
default platformer buggy 都是动作集,
interactUI teleport grabpinch move 都是动作
这两个可以自定义,而动作类型不行
bool vector2 pos
OpenBindingUI
SteamVR Input窗口。点击OpenBindingUI。会自动浏览器打开绑定界面,前期打开steam,与连接vive设备
会看到跟Unity里边一样的属性
手柄按键检测
以前这样检测手柄
2.0这样
private Hand hand;
private SteamVR_Input_Sources handType;
//扳机
public SteamVR_Action_Boolean trrigerKey = SteamVR_Input.GetAction<SteamVR_Action_Boolean>("default", "GrabPinch");
//握持
public SteamVR_Action_Boolean gripKey;
//触控
public SteamVR_Action_Boolean touchPadKey;
void Start()
{
hand = GetComponent<Hand>();
handType = hand.handType;
}
// Update is called once per frame
void Update()
{
if(trrigerKey.GetStateDown(handType))
{
Debug.Log(handType + "扳机按下");
}
if (gripKey[handType].stateDown)
{
Debug.Log(handType + "握持按下");
}
if (touchPadKey.GetStateDown(handType))
{
Debug.Log(handType + "触控按下 ");
}
}
脚本挂到手上
我发现steamvr检测输入有多种方式,以及获取动作,
目前还有输入,我并不懂,pose vector1 跟骨胳,如果以后明白,后期会修改博客。
下几篇,讲解。传送,射线等