相关文档与SDK下载地址:Hi5 2.0 插件下载 - Powered By Noitom Internet Team
追踪器:HTC Vive Tracker 2.0/3.0
3) Hi5_Interaction_Simple_Objects
4) Hi5_Left_Hand_C ,Hi5_Right_Hand_C ,Hi5_Left_Hand_V ,Hi5_Right_Hand_V
3.2 组合物体设置
3.3 简单物体设置
3.4 桌面物体
桌面放置物体的 Layer 要设置为 Hi5_Plane,例如 Box001,设置如图所示:
例如 Button_Interaction_3,设置如图所示:
之后就可以点击运行啦
Hi5_Interface_Hand 脚本
一、手状态
enum E_Interface_Hand_State
{
ERelease = -1,
EPinch = 2,
ELift = 4,
}
E_Interface_Hand_State GetHandState(out int interactionObjectId)E_Interface_Hand_State 返回手部状态,interactionObjectId 返回交互物体 Id 索引
二、手姿态识别状态
enum Hi5_Glove_Gesture_Recognition_State {
ENone = 0,
EOk,
EFist,
EIndexPoint,
EHandPlane
}
Hi5_Glove_Gesture_Recognition_State GetRecognitionState()Hi5_Glove_Gesture_Recognition_State 返回手当前状态
public void MessageFun(string messageKey, object param1, object param2)
{
if (messageKey.CompareTo(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKe y.messageHandEvent) == 0)
{
Hi5_Glove_Interaction_Hand_Event_Data data = param1 as Hi5_Glove_Interaction_Hand_Event_Data;
switch (data.mEventType)
{
case EEventHandType.EClap:
{
//拍击事件
} break;
case EEventHandType.EPoke:
{
//戳事件
} break;
case EEventHandType.EPinch:
{
//抓取事件
} break;
case EEventHandType.EThrow:
{
//抛出事件
} break;
case EEventHandType.ELift:
{
//托举事件
} break;
case EEventHandType.ERelease:
{
//释放事件
}break;
}
}
}
交互物体状态
enum E_Object_State {
ENone = -1,
EStatic = 1,
EPinch = 3,
EMove = 2,
EClap = 4,
EFlyLift = 5,
EPoke = 6,
}
E_Object_State GetObjectItemState();获取交互物体状态int GetObjectId();返回交互物体 Id
交互物体事件
public void MessageFun(string messageKey, object param1, object
param2){
if (messageKey.CompareTo(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKe y.messageObjectEvent) == 0)
{
Hi5_Glove_Interaction_Object_Event_Data data = param1 as Hi5_Glove_Interaction_Object_Event_Data;
if (data.mObjectId == ObjectItem.idObject)
{
switch (data.mEventType)
{
case EEventObjectType.EClap:
{
}break;
case EEventObjectType.EPoke:
{
}break;
case EEventObjectType.EPinch:
{
}break;
case EEventObjectType.EMove:
{
}break;
case EEventObjectType.ELift:
{
}break;
case EEventObjectType.EStatic:
if (mItem != null) {
mItem.ResetCorlor();
}break;
}
}
}
}
Hi5_Interface_Button virtual public void MessageFun(string messageKey, object param1, object param2)
{
if (messageKey.CompareTo(Hi5_Glove_Interaction_Message.Hi5_MessageMessageKe y.messageObjectEvent) == 0)
{
Hi5_Glove_Interaction_Object_Event_Data data = param1 as Hi5_Glove_Interaction_Object_Event_Data;
if (data.mObjectId == ObjectItem.idObject)
{
if (data.mEventType == EEventObjectType.EClap)
{
}else if (data.mEventType == EEventObjectType.EPoke)
{
}else if (data.mEventType == EEventObjectType.EStatic)
{
}
}
}
}
运行时,电脑防火墙要关闭。