示例#1
0
        private void Awake()
        {
            _currentState = new OVRPlugin.HandState();
            CreatePointer();
            SetupSkeleton();

            IsInitialized = true;
        }
示例#2
0
 private void Awake()
 {
     _currentState    = new OVRPlugin.HandState();
     Skeleton         = GetComponent <HandSkeleton>();
     Physics          = GetComponent <HandPhysics>();
     SkeletonVis      = GetComponent <SkeletonVisualizer>();
     HandMesh         = GetComponent <HandMesh>();
     _confidenceFader = new HandConfidenceFader(40);
 }
示例#3
0
 private float?RetrieveHandScale()
 {
     if (IsTracking)
     {
         OVRPlugin.Hand      handeness = ovrSkeleton.GetSkeletonType() == OVRSkeleton.SkeletonType.HandLeft ? OVRPlugin.Hand.HandLeft : OVRPlugin.Hand.HandRight;
         OVRPlugin.HandState handState = new OVRPlugin.HandState();
         if (OVRPlugin.GetHandState(OVRPlugin.Step.Render, handeness, ref handState))
         {
             return(handState.HandScale);
         }
     }
     return(null);
 }
示例#4
0
 private void UpdateSkeletonPose(OVRPlugin.HandState pose)
 {
     if (IsTracked)
     {
         transform.position = pose.RootPose.Position.FromFlippedZVector3f();
         transform.rotation = pose.RootPose.Orientation.FromFlippedZQuatf();
         for (var i = 0; i < _bones.Count; ++i)
         {
             _bones[i].localRotation = pose.BoneRotations[i].FromFlippedZQuatf();
         }
         transform.localScale = new Vector3(pose.HandScale, pose.HandScale, pose.HandScale);
     }
 }
示例#5
0
        private void Start()
        {
#if OCULUS_QUEST
            _currentHandState = new OVRPlugin.HandState();
#endif

            InputTracking.nodeAdded   += NodeAdd;
            InputTracking.nodeRemoved += NodeRemove;

            _manager = FindObjectOfType <BaseManager>();
            if (Point == XRNode.HardwareTracker)
            {
                _manager.MapHardwareTrackers += MapHardwareTrackers;
            }

            _nodes = new List <XRNodeState>();
        }
示例#6
0
 private void PollAndSendHandTrackingData(OVRPlugin.Step renderStep, OVRPlugin.Hand handType)
 {
     OVRPlugin.HandState handState = default(OVRPlugin.HandState);
     if (OVRPlugin.GetHandState(renderStep, handType, ref handState))
     {
         try
         {
             SendDataUDP(XmlSerialize.Serialize(HandRelatedDataContainer.AsHandData(
                                                    new HandData(renderStep, handType, handState)
                                                    )));
         }
         catch (Exception e)
         {
             Debug.Log($"Unable to send hand data: {e.ToString()}");
         }
     }
 }
        public bool UpdatePose(OVRPlugin.HandState pose)
        {
            if (_bones == null)
            {
                return(false);
            }

            if (_hand.IsTracked)
            {
                transform.localPosition = pose.RootPose.Position.FromFlippedZVector3f();
                transform.localRotation = pose.RootPose.Orientation.FromFlippedZQuatf();
                for (var i = 0; i < _bones.Count; ++i)
                {
                    _bones[i].localRotation = pose.BoneRotations[i].FromFlippedZQuatf();
                }
                _hand.transform.localScale = new Vector3(pose.HandScale, pose.HandScale, pose.HandScale);
            }
            return(true);
        }
 public HandData(OVRPlugin.Step step, OVRPlugin.Hand hand, OVRPlugin.HandState handState)
 {
     Step      = step;
     Hand      = hand;
     HandState = handState;
 }