Forum Discussion
Criterium
9 years agoHonored Guest
Weird issue when using haptics on both Touch controllers
I've been implementing haptic feedback for our Touch game. It's gotten to the state where we our quite happy with it.
One issue, however, we are having is that if haptic feedback is active on both controllers at the same time it acts pretty strange.
If only one controller is generating haptic feedback at a time, it successfully generates it every frame.
However when both controllers are generating haptic feedback at the same time, it seems that instead of both controllers generating haptic feedback every frame, it only randomly generates haptic feedback for either controller each frame. So, when frame it might only be generating haptic feedback on the left controller, next frame it might only be generating haptic feedback on the right controller.
Here's a summary of the code we are using
We are using Unity 5.5.0f3 and the newest OVR Unity integration.
Any help would be greatly appreciated.
EDIT: Don't know if it's relevant or not, but we are using Touch engineering samples.
One issue, however, we are having is that if haptic feedback is active on both controllers at the same time it acts pretty strange.
If only one controller is generating haptic feedback at a time, it successfully generates it every frame.
However when both controllers are generating haptic feedback at the same time, it seems that instead of both controllers generating haptic feedback every frame, it only randomly generates haptic feedback for either controller each frame. So, when frame it might only be generating haptic feedback on the left controller, next frame it might only be generating haptic feedback on the right controller.
Here's a summary of the code we are using
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TouchInput : MonoBehaviour
{
public enum ControllerSide { Left, Right };
public ControllerSide controllerSide;
void Start()
{
HapticsClips = new OVRHapticsClip(10);
}
public void ApplyHapticFeedback(byte force)
{
HapticsClips.Reset();
HapticsClips.WriteSample(converted);
if (controllerSide == ControllerSide.Left)
OVRHaptics.LeftChannel.Preempt(HapticsClips);
else if (controllerSide== ControllerSide.Right)
OVRHaptics.RightChannel.Preempt(HapticsClips);
}
}We are using Unity 5.5.0f3 and the newest OVR Unity integration.
Any help would be greatly appreciated.
EDIT: Don't know if it's relevant or not, but we are using Touch engineering samples.
6 Replies
Replies have been turned off for this discussion
- kerskMeta EmployeeIt looks like you are reusing the same haptics clip when submitting to the left and right channels. When you call Reset() to add new Left channel data, that is resetting any data already in the pipe for the Right channel as well, and vice versa. Try having a dedicated backing haptics clip for each channel.
- CriteriumHonored GuestThanks for the answer!
I do actually believe I have a dedicated haptics clip for each channel. What I perhaps failed to mention in my post is that there are two instances of the above script active, one for the left controller (and thus the left channel) and one for the right controller/channel.
So there are 2 different haptics clips created in Start() and used for each channel. - kerskMeta EmployeeIs it possible to provide a small project that reproduces the issue?
- CriteriumHonored GuestAttached is a sample project reproducing the issue.
I've set up a Scene called "Haptics Test", with the above mentioned script attached to the "LeftHandAnchor" and "RightHandAnchor" transforms.
Holding in the index trigger on the touch controllers generates haptic feedback for that controller.
So, for me holding both index trigger reproduces the issue.
Thanks for checking into this. - kerskMeta EmployeeAwesome, thank you for the sample project. I can confirm the issue repros here. It appears to be an issue specifically with submitting a very small number of samples in a clip to both controllers simultaneously. As a workaround to unblock you, try padding the clip with trailing 0's. I'll continue investigating the underlying issue. Thanks for the repro!HapticsClip.Reset();
HapticsClip.WriteSample(255);
HapticsClip.WriteSample(0);
HapticsClip.WriteSample(0);
HapticsClip.WriteSample(0);
HapticsClip.WriteSample(0); - CriteriumHonored GuestWonderful. Thanks for the workaround and all the help!
Much appreciated.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device