Esempio n. 1
0
        public static ViveRoleProperty New(string typeFullName, string valueName)
        {
            var prop = new ViveRoleProperty();

            prop.m_roleTypeFullName = typeFullName;
            prop.m_roleValueName    = valueName;

            Type roleType;

            if (ViveRoleEnum.ValidViveRoleTable.TryGetValue(typeFullName, out roleType))
            {
                var roleInfo  = ViveRoleEnum.GetInfo(roleType);
                var roleIndex = roleInfo.GetElementIndexByName(valueName);
                if (roleIndex >= 0)
                {
                    prop.m_roleValueInt = roleInfo.GetRoleValueByElementIndex(roleIndex);
                }
                else
                {
                    prop.m_roleValueInt = roleInfo.InvalidRoleValue;
                }
            }

            return(prop);
        }
Esempio n. 2
0
        public static ViveRoleProperty New(string typeFullName, string valueName)
        {
            var prop = new ViveRoleProperty();

            prop.m_roleTypeFullName = typeFullName;
            prop.m_roleValueName    = valueName;
            return(prop);
        }
Esempio n. 3
0
 private void Reset()
 {
     m_inputs.Add(new InputEntry()
     {
         viveRole = ViveRoleProperty.New(HandRole.RightHand),
         button   = ControllerButton.Trigger,
     });
 }
            public void Update(ViveRoleProperty role)
            {
                UpdateFieldString <ControllerButton>(ref buttonPressedFields, ViveInput.GetPress(role), buttonPressed);

                foreach (ControllerAxis i in axisValue.Enums)
                {
                    axisValue[i] = ViveInput.GetAxis(role, i);
                }
            }
        public static ViveRoleProperty GetTarget(FieldInfo fieldInfo, SerializedProperty property)
        {
            var obj = fieldInfo.GetValue(property.serializedObject.targetObject);

            if (obj == null)
            {
                return(null);
            }

            ViveRoleProperty actualObject = null;

            if (obj.GetType().IsArray)
            {
                var index = Convert.ToInt32(new string(property.propertyPath.Where(c => char.IsDigit(c)).ToArray()));
                actualObject = ((ViveRoleProperty[])obj)[index];
            }
            else
            {
                actualObject = obj as ViveRoleProperty;
            }
            return(actualObject);
        }
Esempio n. 6
0
 public static float GetAxis(ViveRoleProperty role, ControllerAxis axis, bool usePrevState = false)
 {
     return(GetAxisEx(role.roleType, role.roleValue, axis, usePrevState));
 }
Esempio n. 7
0
 /// <summary>
 /// Returns raw analog value of the trigger button on the controller identified by role
 /// </summary>
 public static float GetTriggerValue(ViveRoleProperty role, bool usePrevState = false)
 {
     return(GetTriggerValueEx(role.roleType, role.roleValue, usePrevState));
 }
 public static Vector3 GetAngularVelocity(ViveRoleProperty role, Transform origin = null)
 {
     return(GetAngularVelocity(role.GetDeviceIndex(), origin));
 }
Esempio n. 9
0
 /// <summary>
 /// Return amount of clicks in a row for the button on the controller identified by role
 /// Set ViveInput.clickInterval to configure click interval
 /// </summary>
 public static int ClickCount(ViveRoleProperty role, ControllerButton button)
 {
     return(ClickCountEx(role.roleType, role.roleValue, button));
 }
Esempio n. 10
0
 public static void AddListener(ViveRoleProperty role, ControllerButton button, Action callback)
 {
     AddListenerEx(role.roleType, role.roleValue, button, ButtonEventType.Press, callback);
 }
Esempio n. 11
0
 /// <summary>
 /// Trigger vibration of the controller identified by role
 /// </summary>
 public static void TriggerHapticPulse(ViveRoleProperty role, ushort durationMicroSec = 500)
 {
     TriggerHapticPulseEx(role.roleType, role.roleValue, durationMicroSec);
 }
 public static void AddListener(ViveRoleProperty role, ControllerButton button, ButtonEventType eventType, RoleValueEventListener callback)
 {
     AddListenerEx(role.roleType, role.roleValue, button, eventType, callback);
 }
Esempio n. 13
0
 public static Vector2 GetPadTouchDelta(ViveRoleProperty role)
 {
     return(GetPadTouchDeltaEx(role.roleType, role.roleValue));
 }
 public static bool IsOutOfRange(ViveRoleProperty role)
 {
     return(IsOutOfRange(role.GetDeviceIndex()));
 }
 public static void RemoveListener(ViveRoleProperty role, ControllerButton button, ButtonEventType eventType, Action callback)
 {
     RemoveListenerEx(role.roleType, role.roleValue, button, eventType, callback);
 }
 public static bool IsCalibrating(ViveRoleProperty role)
 {
     return(IsCalibrating(role.GetDeviceIndex()));
 }
 /// <summary>
 /// Set target pose to tracking pose of the device identified by role relative to the origin
 /// </summary>
 public static void SetPose(Transform target, ViveRoleProperty role, Transform origin = null)
 {
     SetPose(target, role.GetDeviceIndex(), origin);
 }
 /// <summary>
 /// Returns tracking pose of the device identified by role
 /// </summary>
 public static RigidPose GetPose(ViveRoleProperty role, Transform origin = null)
 {
     return(GetPose(role.GetDeviceIndex(), origin));
 }
Esempio n. 19
0
 /// <summary>
 /// Returns raw analog value of the touch pad  on the controller identified by role
 /// </summary>
 public static Vector2 GetPadAxis(ViveRoleProperty role, bool usePrevState = false)
 {
     return(GetPadAxisEx(role.roleType, role.roleValue, usePrevState));
 }
 /// <summary>
 /// Trigger vibration of the controller identified by role
 /// </summary>
 public static void TriggerHapticVibration(ViveRoleProperty role, float durationSeconds = 0.01f, float frequency = 85f, float amplitude = 0.125f, float startSecondsFromNow = 0f)
 {
     TriggerHapticVibrationEx(role.roleType, role.roleValue, durationSeconds, frequency, amplitude, startSecondsFromNow);
 }
Esempio n. 21
0
 public static Vector2 GetPadPressVector(ViveRoleProperty role)
 {
     return(GetPadPressVectorEx(role.roleType, role.roleValue));
 }
Esempio n. 22
0
 public void Set(ViveRoleProperty prop)
 {
     Set(prop.m_roleTypeFullName, prop.m_roleValueName);
 }
Esempio n. 23
0
 public static Vector2 GetScrollDelta(ViveRoleProperty role, ScrollType scrollType, Vector2 scale, ControllerAxis xAxis = ControllerAxis.PadX, ControllerAxis yAxis = ControllerAxis.PadY)
 {
     return(GetScrollDeltaEx(role.roleType, role.roleValue, scrollType, scale, xAxis, yAxis));
 }
 /// <summary>
 /// Returns true if tracking data of the device identified by role has valid value.
 /// </summary>
 public static bool HasTracking(ViveRoleProperty role)
 {
     return(HasTracking(role.GetDeviceIndex()));
 }
Esempio n. 25
0
 public static void RemoveListener(ViveRoleProperty role, ControllerButton button, RoleValueEventListener callback)
 {
     RemoveListenerEx(role.roleType, role.roleValue, button, ButtonEventType.Press, callback);
 }
Esempio n. 26
0
 /// <summary>
 /// Returns time of the last frame that user pressed down the button on the controller identified by role
 /// </summary>
 public static float LastPressDownTime(ViveRoleProperty role, ControllerButton button)
 {
     return(LastPressDownTimeEx(role.roleType, role.roleValue, button));
 }
 public VivePointerEventData(Pointer3DRaycaster ownerRaycaster, EventSystem eventSystem, HandRole hand, ControllerButton viveButton, InputButton mouseButton) : base(ownerRaycaster, eventSystem)
 {
     viveRole        = ViveRoleProperty.New(hand);
     this.viveButton = viveButton;
     button          = mouseButton;
 }
 public static bool IsUninitialized(ViveRoleProperty role)
 {
     return(IsUninitialized(role.GetDeviceIndex()));
 }
Esempio n. 29
0
 public bool Equals(ViveRoleProperty prop)
 {
     return(this == prop);
 }
Esempio n. 30
0
 /// <summary>
 /// Returns true during the frame the user releases the button on the controller identified by role
 /// </summary>
 public static bool GetPressUp(ViveRoleProperty role, ControllerButton button)
 {
     return(GetPressUpEx(role.roleType, role.roleValue, button));
 }