Vibrate the controller and no effect
Version of Unity3D : 5.5.2f1 & 2017.1.1f1 Version of ViveInputUtility : 1.7.3
Question : I want to trigger the vibration of the controller by using the api called "ViveInput.TriggerHapticPulse" but there is no effect. I have read the VRModuleManager and checked out the "m_activatedModuleBase" is UnityEngineVRModule, the method "TriggerViveControllerHaptic" is a virtual method and there is no implementation in UnityEngineVRModule. So I feedback this situation, or is there something wrong in my project setting?
Hi Fishsama,
Currently you still need the SteamVR plugin for haptics The new new Input System from Unity is still a work in progress and we'll add support asap.
Got it, thanks
Hi! Could you please suggest me which part of the SteamVR plugin I have to include to let the vibration works properly? (if possible, I don't want to include the entire plugin) Thanks!
this is very cool ,thank you!
@NickZangus Sorry, actually I have changed the plan when got that news, so I haven't tried to use steamVR.
To resolve the issue. you just import steam plugin from unity assetstore then call ViveInput.TriggerHapticPulse(HandRole.LeftHand); , and evething will be fine;
@NickZangus
Hi guys, Hi @Zvirtuosity
I imported SteamVR plugin, used ViveInput.TriggerHapticPulse(HandRole.LeftHand);
But there is still no effect
I ve noticed the VIU_STEAMVR_1_2_3_OR_NEWER in the compile header
To be sure that the compile header was taken in account, I forced the recompilation. But still no vibration on the controllers :(
Do you have any idea why ? I have version 1.9 and Unity 2017.4.14f1
Edit :
I found the solution, thanks to @chengnay, we need to use a previous version of SteamVR while the team is working on the issue. https://github.com/ViveSoftware/ViveInputUtility-Unity/issues/54#issue-363904294
For anyone else having issues this took me awhile to figure out too especially since a lot of things were updated/outdated since the last time I touched this.
Currently I'm running Unity 2018.2.16f1, SteamVR Plugin 2.0.1, and the Vive Input Utility from the improve/steamvr200support branch at https://github.com/ViveSoftware/ViveInputUtility-Unity/tree/improve/steamvr200support
To trigger haptic feedback ViveInput.TriggerHapticPulse(HandRole.LeftHand); still doesn't work but what I did as a test was created a new script and added the following in:
using UnityEngine;
using Valve.VR;
public class ControllerFeedback : MonoBehaviour
{
[SteamVR_DefaultAction("Haptic")]
public SteamVR_Action_Vibration hapticAction;
public float microSecondsDuration = 1000;
public SteamVR_Input_Sources handType;
private void OnCollisionEnter(Collision collision)
{
float seconds = (float)microSecondsDuration / 1000000f;
hapticAction.Execute(0, seconds, 1f / seconds, 1, handType);
}
}
This triggers the haptics fine, just make sure in the inspector you set the Haptic Action to "\actions\default\out\Haptic" assuming you've set up the SteamVR Inputs.
(I'm building a project off of the Vive Input Utility and I've only imported SteamVR for the haptic feedback as an fyi)
I fixed haptics problem and pushed the latest commit d6223377f9b12cb8cafdd7dfb7bd4f15df84f899 Also add new input API:
ViveInput.TriggerHapticVibrationEx<TRole>(
TRole role,
float durationSeconds = 0.01f,
float frequency = 85f,
float amplitude = 0.125f,
float startSecondsFromNow = 0f)
Notice that this commit have added new actions, so you need to apply VIU Action Set again. Let us know if it works! Thanks!
@lawwong Thanks a lot, i will try it later