Ejemplo n.º 1
0
        /// <summary>
        /// This is an optional code path we might enable at some point to use the native arm model on Gear VR, rather than the custom one.
        /// </summary>
        /// <param name="needed"></param>
        void UpdateHandedness(bool needed)
        {
            if (!needed || (_node != XRNode.GameController))
            {
                return;
            }

            switch (TBInput.Get3DOFHandedness())
            {
            case TBInput.Mobile3DOFHandedness.Left:
                if (TBCore.GetActivePlatform() == VRPlatform.OculusPC)
                {
                    _controller = OVRInput.Controller.LTouch;
                }
                else
                {
                    _controller = OVRInput.Controller.LTrackedRemote;
                }
                break;

            case TBInput.Mobile3DOFHandedness.Right:
                if (TBCore.GetActivePlatform() == VRPlatform.OculusPC)
                {
                    _controller = OVRInput.Controller.RTouch;
                }
                else
                {
                    _controller = OVRInput.Controller.RTrackedRemote;
                }
                break;
            }
        }
Ejemplo n.º 2
0
 public void ToggleCenteredAlignment(bool on)
 {
     if (on)
     {
         shoulderPosition = new Vector3(0f, shoulderPosition.y, shoulderPosition.z);
         _shoulderTransform.localPosition = shoulderPosition;
     }
     else
     {
         OnHandednessChanged(TBInput.Get3DOFHandedness());
     }
     _centered = on;
 }
Ejemplo n.º 3
0
        void Start()
        {
            OnHandednessChanged(TBInput.Get3DOFHandedness());

            // Attach the arm to the camera container.
            _shoulderTransform.SetParent(TBCameraRig.instance.transform);
            _shoulderTransform.localRotation = Quaternion.identity;
            _shoulderTransform.localPosition = shoulderPosition;

            // Attach the elbow to the arm pivot.
            _elbowTransform.SetParent(_shoulderTransform);
            _elbowTransform.localPosition = elbowPosition;

            // Attach the hand to the elbow.
            _handTransform.SetParent(_elbowTransform);
            _handTransform.localPosition = handPosition;

            _pointerSourceTransform.MakeZeroedChildOf(_handTransform);
            SetPointerSourceRotation();
            _shoulderTransform.localScale = Vector3.one;
        }