Exemple #1
0
 public static void Write(this BinaryWriter w, Hand p)
 {
     w.Write(p.indexFlex);
     w.Write(p.gripFlex);
     w.Write(p.isPointing);
     w.Write(p.isThumbUp);
 }
 public static void Write(this BinaryWriter writer, OvrAvatarDriver.HandPose pose)
 {
     writer.Write(pose.indexFlex);
     writer.Write(pose.gripFlex);
     writer.Write(pose.isPointing);
     writer.Write(pose.isThumbUp);
 }
 public void UpdatePose(OvrAvatarDriver.HandPose pose)
 {
     if (!gameObject.activeInHierarchy || animator == null)
     {
         return;
     }
     animator.SetBool("HoldController", showControllers);
     animator.SetFloat("Flex", pose.gripFlex);
     animator.SetFloat("Pinch", pose.indexFlex);
     animator.SetLayerWeight(animator.GetLayerIndex("Point Layer"), pose.isPointing ? 1.0f : 0.0f);
     animator.SetLayerWeight(animator.GetLayerIndex("Thumb Layer"), pose.isThumbUp ? 1.0f : 0.0f);
 }
Exemple #4
0
    void TranslateHandPoseToInput(ref OvrAvatarDriver.HandPose handPose, ref OvrAvatarDriver.ControllerPose controllerPose, ref HandInput input)
    {
        input.handTrigger = handPose.gripFlex;

        input.previousIndexTrigger = input.indexTrigger;
        input.indexTrigger         = handPose.indexFlex;

        if (input.indexTrigger >= IndexThreshold && input.previousIndexTrigger < IndexThreshold)
        {
            input.indexPressFrame = context.GetRenderFrame();
        }

        input.pointing = true;

        input.x = controllerPose.button1IsDown;
        input.y = controllerPose.button2IsDown;

        input.stick = controllerPose.joystickPosition;
    }
Exemple #5
0
    void UpdateHand(ref HandData hand, OvrAvatarDriver.PoseFrame frame)
    {
        OvrAvatarDriver.HandPose handPose = (hand.id == LeftHand) ? frame.handLeftPose : frame.handRightPose;

        OvrAvatarDriver.ControllerPose controllerPose = (hand.id == LeftHand) ? frame.controllerLeftPose : frame.controllerRightPose;

        TranslateHandPoseToInput(ref handPose, ref controllerPose, ref hand.input);

        UpdateRotate(ref hand);

        UpdateZoom(ref hand);

        UpdateGrip(ref hand);

        DetectStateChanges(ref hand);

        UpdateCurrentState(ref hand);

        UpdateHeldObject(ref hand);
    }