コード例 #1
0
    private void InteractionManager_SourceDetected(UnityEngine.XR.WSA.Input.InteractionSourceDetectedEventArgs args)
    {
        // Check to see that the source is a hand.
        if (args.state.source.kind != UnityEngine.XR.WSA.Input.InteractionSourceKind.Hand)
        {
            return;
        }

        Vector3 pos;

        if (args.state.sourcePose.TryGetPosition(out pos) && allowTrack)
        {
            if (handednessOffsetObj != null)
            {
                bool isRightHand = Camera.main.worldToCameraMatrix.MultiplyPoint(pos).x > 0;
                handednessOffsetObj.transform.localPosition = isRightHand ? rightHandLocalPos : new Vector3(-rightHandLocalPos.x, rightHandLocalPos.y, rightHandLocalPos.z);
            }
            Vector3 temppos = new Vector3(pos.x, pos.y, pos.z + 0.05f);
            //   if (!TempMenu.activeSelf)
            //  {
            TrackingObject.SetActive(true);
            TrackingObject.transform.position = temppos;
            // }
            //  else
            //  {
            //       TempMenu.SetActive(true);
            //       TempMenu.transform.position = temppos;
            //   }
        }
    }
コード例 #2
0
 private void InteractionManager_SourceDetected(UnityEngine.XR.WSA.Input.InteractionSourceDetectedEventArgs args)
 {
     handIsShown = true;
 }
コード例 #3
0
 private void Source_Detected(UnityEngine.XR.WSA.Input.InteractionSourceDetectedEventArgs hand)
 {
     HandDetected = true;
 }