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); }
public static ViveRoleProperty New(string typeFullName, string valueName) { var prop = new ViveRoleProperty(); prop.m_roleTypeFullName = typeFullName; prop.m_roleValueName = valueName; return(prop); }
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); }
public static float GetAxis(ViveRoleProperty role, ControllerAxis axis, bool usePrevState = false) { return(GetAxisEx(role.roleType, role.roleValue, axis, usePrevState)); }
/// <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)); }
/// <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)); }
public static void AddListener(ViveRoleProperty role, ControllerButton button, Action callback) { AddListenerEx(role.roleType, role.roleValue, button, ButtonEventType.Press, callback); }
/// <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); }
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)); }
/// <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); }
public static Vector2 GetPadPressVector(ViveRoleProperty role) { return(GetPadPressVectorEx(role.roleType, role.roleValue)); }
public void Set(ViveRoleProperty prop) { Set(prop.m_roleTypeFullName, prop.m_roleValueName); }
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())); }
public static void RemoveListener(ViveRoleProperty role, ControllerButton button, RoleValueEventListener callback) { RemoveListenerEx(role.roleType, role.roleValue, button, ButtonEventType.Press, callback); }
/// <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())); }
public bool Equals(ViveRoleProperty prop) { return(this == prop); }
/// <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)); }