Exemplo n.º 1
0
 private void SetControllerListeners(GameObject controller)
 {
     if (controller && VRTK_SDK_Bridge.IsControllerLeftHand(controller))
     {
         ToggleControllerListeners(controller, leftController, ref leftSubscribed);
     }
     else if (controller && VRTK_SDK_Bridge.IsControllerRightHand(controller))
     {
         ToggleControllerListeners(controller, rightController, ref rightSubscribed);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// The IsControllerOfHand method is used to check if a given controller game object is of the hand type provided.
        /// </summary>
        /// <param name="checkController">The actual controller object that is being checked.</param>
        /// <param name="hand">The representation of a hand to check if the given controller matches.</param>
        /// <returns>Is true if the given controller matches the given hand.</returns>
        public static bool IsControllerOfHand(GameObject checkController, ControllerHand hand)
        {
            if (hand == ControllerHand.Left && VRTK_SDK_Bridge.IsControllerLeftHand(checkController))
            {
                return(true);
            }

            if (hand == ControllerHand.Right && VRTK_SDK_Bridge.IsControllerRightHand(checkController))
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
 /// <summary>
 /// The GetControllerHand method is used for getting the enum representation of ControllerHand for the given controller game object.
 /// </summary>
 /// <param name="controller">The controller game object to check the hand of.</param>
 /// <returns>A ControllerHand representing either the Left or Right hand.</returns>
 public static ControllerHand GetControllerHand(GameObject controller)
 {
     if (VRTK_SDK_Bridge.IsControllerLeftHand(controller))
     {
         return(ControllerHand.Left);
     }
     else if (VRTK_SDK_Bridge.IsControllerRightHand(controller))
     {
         return(ControllerHand.Right);
     }
     else
     {
         return(ControllerHand.None);
     }
 }