Exemple #1
0
 protected virtual void UpdateDirectionIndicator()
 {
     if (directionIndicator != null && pointerRenderer != null)
     {
         RaycastHit destinationHit = pointerRenderer.GetDestinationHit();
         directionIndicator.SetPosition((IsPointerActive() && destinationHit.collider != null), destinationHit.point);
     }
 }
 /// <summary>
 /// The PointerEnter method emits a DestinationMarkerEnter event when the pointer first enters a valid object, it emits a DestinationMarkerHover for every following frame that the pointer stays over the valid object.
 /// </summary>
 /// <param name="givenHit">The valid collision.</param>
 public virtual void PointerEnter(RaycastHit givenHit)
 {
     if (enabled && givenHit.transform != null && (!ControllerRequired() || VRTK_ControllerReference.IsValid(controllerReference)))
     {
         SetHoverSelectionTimer(givenHit.collider);
         DestinationMarkerEventArgs destinationEventArgs = SetDestinationMarkerEvent(givenHit.distance, givenHit.transform, givenHit, givenHit.point, controllerReference, false, GetCursorRotation());
         if (pointerRenderer != null && givenHit.collider != pointerRenderer.GetDestinationHit().collider)
         {
             OnDestinationMarkerEnter(destinationEventArgs);
         }
         else
         {
             OnDestinationMarkerHover(destinationEventArgs);
         }
         StartUseAction(givenHit.transform);
     }
 }
Exemple #3
0
 protected virtual void SelectionButtonAction(object sender, ControllerInteractionEventArgs e)
 {
     if (EnabledPointerRenderer() && (IsPointerActive() || wasActivated))
     {
         wasActivated    = false;
         controllerIndex = e.controllerIndex;
         RaycastHit destinationHit = pointerRenderer.GetDestinationHit();
         AttemptUseOnSet(destinationHit.transform);
         if (destinationHit.transform && IsPointerActive() && pointerRenderer.ValidPlayArea() && !PointerActivatesUseAction(pointerInteractableObject))
         {
             OnDestinationMarkerSet(SetDestinationMarkerEvent(destinationHit.distance, destinationHit.transform, destinationHit, destinationHit.point, controllerIndex));
         }
     }
 }
Exemple #4
0
 protected virtual void ExecuteSelectionButtonAction()
 {
     if (EnabledPointerRenderer() && CanSelect() && (IsPointerActive() || wasActivated))
     {
         wasActivated = false;
         RaycastHit destinationHit = pointerRenderer.GetDestinationHit();
         AttemptUseOnSet(destinationHit.transform);
         if (destinationHit.transform && IsPointerActive() && pointerRenderer.ValidPlayArea() && !PointerActivatesUseAction(pointerInteractableObject) && pointerRenderer.IsValidCollision())
         {
             ResetHoverSelectionTimer(destinationHit.collider);
             ResetSelectionTimer();
             OnDestinationMarkerSet(SetDestinationMarkerEvent(destinationHit.distance, destinationHit.transform, destinationHit, destinationHit.point, controllerIndex));
         }
     }
 }