public void Vibrate(SteamVR_Input_Sources handType, float delay, float length) { vibration.Execute(delay, length, defaultFrequency, 1, handType); }
/// <summary>True if the device bound to this action was connected during the previous update</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public bool GetLastDeviceIsConnected(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].lastDeviceIsConnected); }
/// <summary>The tracking state for this pose during the previous update</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public ETrackingResult GetLastTrackingResult(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].lastTrackingState); }
/// <summary>The local velocity of this pose relative to the universe origin</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public Vector3 GetVelocity(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].velocity); }
/// <summary>The local rotation for this pose during the previous update</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public Quaternion GetLastLocalRotation(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].lastLocalRotation); }
/// <summary>Stops executing the function setup by the corresponding AddListener</summary> /// <param name="functionToStopCalling">The local function that you've setup to receive update events</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void RemoveOnUpdateListener(SteamVR_Input_Sources inputSource, UpdateHandler functionToStopCalling) { sourceMap[inputSource].onUpdate -= functionToStopCalling; }
/// <summary> /// SteamVR keeps a log of past poses so you can retrieve old poses or estimated poses in the future by passing in a secondsFromNow value that is negative or positive. /// </summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> /// <param name="secondsFromNow">The time offset in the future (estimated) or in the past (previously recorded) you want to get data from</param> /// <returns>true if the call succeeded</returns> public bool GetPoseAtTimeOffset(SteamVR_Input_Sources inputSource, float secondsFromNow, out Vector3 localPosition, out Quaternion localRotation, out Vector3 velocity, out Vector3 angularVelocity) { return(sourceMap[inputSource].GetPoseAtTimeOffset(secondsFromNow, out localPosition, out localRotation, out velocity, out angularVelocity)); }
/// <summary>Executes a function when the Vector2 value of the action is non-zero.</summary> /// <param name="functionToCall">A local function that receives the boolean action who's state has changed, the corresponding input source, and the new value</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void AddOnAxisListener(AxisHandler functionToCall, SteamVR_Input_Sources inputSource) { sourceMap[inputSource].onAxis += functionToCall; }
/// <summary>Stops executing the function setup by the corresponding AddListener</summary> /// <param name="functionToStopCalling">The local function that you've setup to receive update events</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void RemoveOnAxisListener(AxisHandler functionToStopCalling, SteamVR_Input_Sources inputSource) { sourceMap[inputSource].onAxis -= functionToStopCalling; }
//Vibracion del Haptico public void Pulse(float duration, float frequency, float amplitude, SteamVR_Input_Sources source) { m_haptic.Execute(0, duration, frequency, amplitude, source); print("Pulso from " + source.ToString()); }
/// <summary>Executes a function when the active state of this action (with the specified inputSource) changes. This happens when the action is bound or unbound</summary> /// <param name="functionToCall">A local function that receives the boolean action who's active state changes and the corresponding input source</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void AddOnActiveBindingChangeListener(ActiveChangeHandler functionToCall, SteamVR_Input_Sources inputSource) { sourceMap[inputSource].onActiveBindingChange += functionToCall; }
private void Controller_onAxis(SteamVR_Action_Vector2 fromAction, SteamVR_Input_Sources fromSource, Vector2 axis, Vector2 delta) { Debug.Log($"User is touching point {axis.x}, {axis.y} : {delta.x}, {delta.y}"); }
private void UpPressAction(SteamVR_Action_Boolean action, SteamVR_Input_Sources source) { Debug.Log($"User pressed up on {source.ToString()}"); }
public void Vibrate(SteamVR_Input_Sources handType, float delay, float length, int frequency, float amplitude) { frequency = (int)Mathf.Clamp(frequency, 0, 320); amplitude = (float)Mathf.Clamp(amplitude, 0, 1); vibration.Execute(delay, length, frequency, amplitude, handType); }
/// <summary>Executes a function when the state of this action (with the specified inputSource) changes</summary> /// <param name="functionToCall">A local function that receives the boolean action who's state has changed, the corresponding input source, and the new value</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void AddOnChangeListener(SteamVR_Input_Sources inputSource, ChangeHandler functionToCall) { sourceMap[inputSource].onChange += functionToCall; }
/// <summary> /// <strong>[Should not be called by user code]</strong> Sets up the internals of the action source before SteamVR_Standalone has been initialized. /// </summary> public override void Preinitialize(SteamVR_Action wrappingAction, SteamVR_Input_Sources forInputSource) { base.Preinitialize(wrappingAction, forInputSource); vector2Action = (SteamVR_Action_Vector2)wrappingAction; }
/// <summary>Executes a function when the state of this action (with the specified inputSource) is updated.</summary> /// <param name="functionToCall">A local function that receives the boolean action who's state has changed, the corresponding input source, and the new value</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void AddOnUpdateListener(SteamVR_Input_Sources inputSource, UpdateHandler functionToCall) { sourceMap[inputSource].onUpdate += functionToCall; }
/// <summary>The current Vector2 value of the action</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public Vector2 GetAxis(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].axis); }
/// <summary> /// SteamVR keeps a log of past poses so you can retrieve old poses or estimated poses in the future by passing in a secondsFromNow value that is negative or positive. /// </summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> /// <param name="secondsFromNow">The time offset in the future (estimated) or in the past (previously recorded) you want to get data from</param> /// <returns>true if the call succeeded</returns> public bool GetVelocitiesAtTimeOffset(SteamVR_Input_Sources inputSource, float secondsFromNow, out Vector3 velocity, out Vector3 angularVelocity) { return(sourceMap[inputSource].GetVelocitiesAtTimeOffset(secondsFromNow, out velocity, out angularVelocity)); }
/// <summary>The Vector2 value difference between this update and the previous update.</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public Vector2 GetAxisDelta(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].delta); }
/// <summary> /// Update a transform's local position and local roation to match the pose from the most recent update /// </summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> /// <param name="transformToUpdate">The transform of the object to be updated</param> public virtual void UpdateTransform(SteamVR_Input_Sources inputSource, Transform transformToUpdate) { sourceMap[inputSource].UpdateTransform(transformToUpdate); }
/// <summary>Stops executing the function setup by the corresponding AddListener</summary> /// <param name="inputSource">The device you would like to remove an event from. Any if the action is not device specific.</param> /// <param name="functionToStopCalling">The method you would like to stop calling when tracking has changed. Should take a SteamVR_Action_Pose as a param</param> public void RemoveOnTrackingChanged(SteamVR_Input_Sources inputSource, TrackingChangeHandler functionToStopCalling) { sourceMap[inputSource].onTrackingChanged -= functionToStopCalling; }
/// <summary>The local position for this pose during the previous update</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public Vector3 GetLastLocalPosition(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].lastLocalPosition); }
/// <summary>Fires an event when the device now has a valid pose or no longer has a valid pose</summary> /// <param name="inputSource">The device you would like to add an event to. Any if the action is not device specific.</param> /// <param name="functionToCall">The method you would like to be called when the pose has become valid or invalid. Should take a SteamVR_Action_Pose as a param</param> public void AddOnValidPoseChanged(SteamVR_Input_Sources inputSource, ValidPoseChangeHandler functionToCall) { sourceMap[inputSource].onValidPoseChanged += functionToCall; }
/// <summary>The angular velocity for this pose during the previous update</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public Vector3 GetLastAngularVelocity(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].lastAngularVelocity); }
/// <summary>Stops executing the function setup by the corresponding AddListener</summary> /// <param name="inputSource">The device you would like to remove an event from. Any if the action is not device specific.</param> /// <param name="functionToStopCalling">The method you would like to stop calling when the pose has become valid or invalid. Should take a SteamVR_Action_Pose as a param</param> public void RemoveOnValidPoseChanged(SteamVR_Input_Sources inputSource, ValidPoseChangeHandler functionToStopCalling) { sourceMap[inputSource].onValidPoseChanged -= functionToStopCalling; }
/// <summary>True if the pose was valid during the previous update</summary> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public bool GetLastPoseIsValid(SteamVR_Input_Sources inputSource) { return(sourceMap[inputSource].lastPoseIsValid); }
/// <summary>Stops executing the function setup by the corresponding AddListener</summary> /// <param name="functionToStopCalling">The local function that you've setup to receive update events</param> /// <param name="inputSource">The device you would like to get data from. Any if the action is not device specific.</param> public void RemoveOnActiveChangeListener(SteamVR_Input_Sources inputSource, ActiveChangeHandler functionToStopCalling) { sourceMap[inputSource].onActiveChange -= functionToStopCalling; }
/// <summary> /// <strong>[Should not be called by user code]</strong> Sets up the internals of the action source before SteamVR has been initialized. /// </summary> public override void Preinitialize(SteamVR_Action wrappingAction, SteamVR_Input_Sources forInputSource) { base.Preinitialize(wrappingAction, forInputSource); poseAction = wrappingAction as SteamVR_Action_Pose; }
public void Vibrate(SteamVR_Input_Sources handType) { vibration.Execute(0, vibrationDefaultLength, defaultFrequency, 1, handType); }