Greetings,
I wander if there’s a way to trigger rumble on vive controller when two obect (one attached to hand ) collides.
Thanks
Yes there is.
You can either use the interaction system OnHandHover, TriggerHapticPulse. Or, you can just use OnTriggerEnter by putting trigger colliders on the controllers and objects, then use TriggerHapticPulse. I don’t have the code for this memorized and I’m not at my workstation computer. If you look at Hand.cs and the interaction system you should be able to figure it out.
For anyone still looking to do this in SteamVR 2.0 this may help you get started
using UnityEngine;
using Valve.VR;
using Valve.VR.InteractionSystem;
public class HapticBump : MonoBehaviour
{
private Interactable interactable;
private SteamVR_Input_Sources hand;
void Start()
{
interactable = GetComponent<Interactable>();
}
void OnCollisionEnter(Collision other)
{
if (interactable.attachedToHand)
{
hand = interactable.attachedToHand.handType;
interactable.attachedToHand.TriggerHapticPulse(3500);
}
}
}
1 Like