protected virtual void UpdateState(DHUI_HoverEventArgs _hoverEvent)
        {
            if (ContactPlane_StaticPart.PointInFrontOfPlane(_hoverEvent.InteractorPosition))
            {
                if (hover_distance_staticPart < _hover_touchThreshold)
                {
                    ButtonInternalState = ButtonInternalStates.Touched;
                    m_interactionManager.HapticRetargeting?.HoldRetargeting();
                }
                else
                {
                    ButtonInternalState = ButtonInternalStates.Hovered;

                    m_interactionManager.HapticRetargeting?.UnholdRetargeting();
                }
            }
            else
            {
                if (currentActivationDistance >= _activationDistance_threshold)
                {
                    ButtonInternalState = ButtonInternalStates.Activated;
                }
                else
                {
                    ButtonInternalState = ButtonInternalStates.Pressed;
                }
            }
        }
Beispiel #2
0
        public override void Hover_Start(DHUI_HoverEventArgs _hoverEvent)
        {
            base.Hover_Start(_hoverEvent);
            DHUI_FlightCommand_MoveTo cmd = new DHUI_FlightCommand_MoveTo(m_center.position, m_center.rotation, _droneSpeed);

            m_interactionManager.FlightController.AddToFrontOfQueue(cmd, true, true);
        }
        protected override void UpdateState(DHUI_HoverEventArgs _hoverEvent)
        {
            base.UpdateState(_hoverEvent);


            if (currentActivationDistance >= _lockIn_threshold)
            {
                if (!lockedIn && !lockOutProcess)
                {
                    lockInProcess = true;
                    lockedIn      = true;
                    LockToggle();
                }
                else if (lockedIn && !lockInProcess)
                {
                    lockOutProcess = true;
                    lockedIn       = false;
                    UnlockToggle();
                }
            }
            else
            {
                lockInProcess  = false;
                lockOutProcess = false;
            }
        }
Beispiel #4
0
 public virtual void Hover_Stay(DHUI_HoverEventArgs _hoverEventArgs)
 {
     OnHoverStay?.Invoke(_hoverEventArgs);
     UpdateTouchableStates(_hoverEventArgs);
     UpdateHandRetracting(_hoverEventArgs);
     UpdateHapticRetargeting(_hoverEventArgs);
     UpdateTouchStay();
 }
 protected virtual void UpdateActivationCalculations(DHUI_HoverEventArgs _hoverEvent)
 {
     if (_activationDistance_mode == GlobalLocalMode.Global)
     {
         currentActivationDistance = Vector3.Distance(m_buttonPressValue_point1.position, m_buttonPressValue_point2.position);
     }
     else
     {
         currentActivationDistance = Vector3.Distance(m_buttonPressValue_point1.localPosition, m_buttonPressValue_point2.localPosition);
     }
 }
        public override void Hover_Stay(DHUI_HoverEventArgs _hoverEvent)
        {
            base.Hover_Stay(_hoverEvent);

            UpdateHoverCalculations(_hoverEvent);
            UpdateActivationCalculations(_hoverEvent);
            UpdateState(_hoverEvent);

            UpdateDroneTargetPoint();
            UpdateFlightController();
        }
 public override void Hover_Stay(DHUI_HoverEventArgs _hoverEventArgs)
 {
     if (_stiffnessIllusionActive && TouchedState)
     {
         UpdateStiffnessIllusion(currentActivationDistance);
     }
     else
     {
         UpdateStiffnessIllusion(0f);
     }
     base.Hover_Stay(_hoverEventArgs);
 }
Beispiel #8
0
 protected void UpdateHandRetracting(DHUI_HoverEventArgs _hoverEventArgs)
 {
     if (handRetracting)
     {
         float dist = StaticContactPlane.GetDistance(_hoverEventArgs.InteractorPhysicalPosition);
         if (internal_touchableState != TouchableInternalStates.Touch && ((Time.time >= lastTouchedUp + _maxRetractionTime) || dist >= _retargetingActivationDistance))
         {
             handRetracting = false;
             OnRetractionEnd?.Invoke(_hoverEventArgs);
         }
     }
 }
Beispiel #9
0
        protected virtual void UpdateHapticRetargeting(DHUI_HoverEventArgs _hoverEvent)
        {
            if (TouchableInternalState == TouchableInternalStates.Touch)
            {
                m_interactionManager.HapticRetargeting?.HoldRetargeting();
            }
            else
            {
                m_interactionManager.HapticRetargeting?.UnholdRetargeting();
            }

            if (handRetracting)
            {
                m_interactionManager.HapticRetargeting?.LockTargetPositions();
            }
            else
            {
                m_interactionManager.HapticRetargeting?.UnlockTargetPositions();
            }

            switch (_hapticRetargetingMode)
            {
            case HapticRetargetingMode.PresetRetargeting:
                break;

            case HapticRetargetingMode.CenterToCenter:
                HapticRetargeting_CenterToCenter();
                break;

            case HapticRetargetingMode.Encapsulate:
                HapticRetargeting_Encapsulate();
                break;

            case HapticRetargetingMode.ZOnly:
                HapticRetargeting_ZOnly();
                break;

            case HapticRetargetingMode.NoRetargeting:
            default:
                HapticRetargeting_NoRetargeting();
                break;
            }
            if (!handRetracting && TouchableInternalState != TouchableInternalStates.Touch && Vector3.Distance(m_hapticRetargeting_virtualTarget.position, m_hapticRetargeting_physicalTarget.position) > _maxRetargetingDistance && _hapticRetargetingMode != HapticRetargetingMode.NoRetargeting && !TouchedState)
            {
                OverMaxRetargetingDistance();
                return;
            }
            else if (_hapticRetargetingMode != HapticRetargetingMode.NoRetargeting)
            {
                m_interactionManager.HapticRetargeting?.EnableRetargeting();
            }
        }
        protected virtual void UpdateHapticRetargeting(DHUI_HoverEventArgs _hoverEvent)
        {
            switch (_hapticRetargetingMode)
            {
            case HapticRetargetingMode.CenterToCenter:
                HapticRetargeting_CenterToCenter();
                break;

            case HapticRetargetingMode.NoRetargeting:
            default:
                HapticRetargeting_NoRetargeting();
                break;
            }
        }
        protected virtual void UpdateHoverCalculations(DHUI_HoverEventArgs _hoverEvent)
        {
            Vector3 interactorPos = _hoverEvent.InteractorPosition;

            if (_lockDroneXYWhilePressed && (ButtonInternalState == ButtonInternalStates.Pressed || ButtonInternalState == ButtonInternalStates.Activated))
            {
                interactorPos = lastInteractorPos;
            }

            hover_distance_staticPart       = Mathf.Abs(ContactPlane_StaticPart.GetDistance(interactorPos));
            hover_projectedPoint_staticPart = ContactPlane_StaticPart.GetProjectedPoint(interactorPos);
            hover_distance_movingPart       = Mathf.Abs(ContactPlane_MovingPart.GetDistance(interactorPos));
            hover_projectedPoint_movingPart = ContactPlane_MovingPart.GetProjectedPoint(interactorPos);

            lastInteractorPos = interactorPos;
        }
Beispiel #12
0
        protected virtual void UpdateTouchableStates(DHUI_HoverEventArgs _hoverEvent)
        {
            float dist = StaticContactPlane.GetDistance(_hoverEvent.InteractorVirtualPosition);

            if (dist <= _touchThreshold)
            {
                TouchableInternalState = TouchableInternalStates.Touch;
            }
            else if (dist <= _nearTouchThreshold)
            {
                TouchableInternalState = TouchableInternalStates.NearTouch;
            }
            else
            {
                TouchableInternalState = TouchableInternalStates.Hover;
            }
        }
Beispiel #13
0
        public override void Hover_Stay(DHUI_HoverEventArgs _hoverEvent)
        {
            base.Hover_Stay(_hoverEvent);

            if (_invertActivation)
            {
                SwitchState = m_movingPart.transform.localRotation.y > _activationThreshold;
            }
            else
            {
                SwitchState = m_movingPart.transform.localRotation.y < _activationThreshold;
            }

            DHUI_FlightCommand_MoveTo cmd = new DHUI_FlightCommand_MoveTo(m_center.position, m_center.rotation, _droneSpeed);

            m_interactionManager.FlightController.AddToFrontOfQueue(cmd, true, true);

            if (SwitchState)
            {
                Activation_Stay();
            }
        }
 public virtual void Hover_Stay(DHUI_HoverEventArgs _hoverEvent)
 {
     OnHoverStay?.Invoke(_hoverEvent);
 }
 public virtual void Hover_End(DHUI_HoverEventArgs _hoverEvent)
 {
     OnHoverEnd?.Invoke(_hoverEvent);
 }
 public override void Hover_End(DHUI_HoverEventArgs _hoverEvent)
 {
     base.Hover_End(_hoverEvent);
     ButtonInternalState = ButtonInternalStates.Inactive;
 }
Beispiel #17
0
 protected virtual void SetupHapticRetargeting(DHUI_HoverEventArgs _hoverEvent)
 {
     m_interactionManager.HapticRetargeting?.SetActivationDistance(_retargetingActivationDistance);
     m_interactionManager.HapticRetargeting?.SetTargets(m_hapticRetargeting_virtualTarget, m_hapticRetargeting_physicalTarget);
     m_interactionManager.HapticRetargeting?.EnableRetargeting();
 }
Beispiel #18
0
 public override void Hover_End(DHUI_HoverEventArgs _hoverEvent)
 {
     base.Hover_End(_hoverEvent);
 }
Beispiel #19
0
 public virtual void Hover_Start(DHUI_HoverEventArgs _hoverEventArgs)
 {
     OnHoverStart?.Invoke(_hoverEventArgs);
     SentDroneToInitialPosition();
     SetupHapticRetargeting(_hoverEventArgs);
 }
Beispiel #20
0
 public virtual void Hover_End(DHUI_HoverEventArgs _hoverEventArgs)
 {
     OnHoverEnd?.Invoke(_hoverEventArgs);
     TouchableInternalState = TouchableInternalStates.Inactive;
 }