Sunallme HoloLens不知道有没有对左右手区分,你可以研究下官方的文档API
Sunallme
还真的支持左右手了,官方最近新发的一个开源项目 LunarModule 登月舱的项目就用到了左右手操作
private void Update() {
if (Show) {
messageRenderer.enabled = true;
UpdateHand(leftHand, InputSources.Instance.hands.GetHandState(InputSourceHands.HandednessEnum.Left, MinConfidence), OffsetLeft);
UpdateHand(rightHand, InputSources.Instance.hands.GetHandState(InputSourceHands.HandednessEnum.Right, MinConfidence), OffsetRight);
} else {
messageRenderer.enabled = false;
leftHand.enabled = false;
rightHand.enabled = false;
}
}
private void UpdateHand (Renderer handRenderer, InputSourceHands.CurrentHandState handState, Vector2 handOffset) {
if (handState == null) {
switch (Visibility) {
case VisibilityEnum.Always:
case VisibilityEnum.TrackingLost:
handRenderer.enabled = true;
handRenderer.material.mainTexture = HandAbsentTexture;
handRenderer.material.color = HandAbsentColor;
break;
case VisibilityEnum.TrackingPresent:
handRenderer.enabled = false;
break;
}
} else {
if (FollowOnScreen) {
// Get the world position of the billboarded indicator
Vector3 handPos = transform.InverseTransformPoint (handState.Position);
handPos.x += handOffset.x;
handPos.y += handOffset.y;
handPos.z = 0f;
handPos.x = Mathf.Clamp(handPos.x, MinRange.x, MaxRange.x);
handPos.y = Mathf.Clamp(handPos.y, MinRange.y, MaxRange.y);
handRenderer.transform.localPosition = handPos;
}
if (handState.Pressed) {
switch (Visibility) {
case VisibilityEnum.Always:
case VisibilityEnum.TrackingPresent:
handRenderer.enabled = true;
handRenderer.material.mainTexture = HandPressedTexture;
handRenderer.material.color = HandPressedColor;
break;
case VisibilityEnum.TrackingLost:
handRenderer.enabled = false;
break;
}
} else {
switch (Visibility) {
case VisibilityEnum.Always:
case VisibilityEnum.TrackingPresent:
handRenderer.enabled = true;
handRenderer.material.mainTexture = HandPresentTexture;
handRenderer.material.color = HandPresentColor;
break;
case VisibilityEnum.TrackingLost:
handRenderer.enabled = false;
break;
}
}
}
github: https://github.com/Microsoft/MRDesignLabs_Unity_LunarModule