Forum Discussion
star14
7 years agoExplorer
Problem with buffered haptics (ovr_SubmitControllerVibration)
In my app I want to produce tiny haptic pulses that start with as low latency as possible and have as short a duration as possible. Currently I am achieving this by calling ovr_SubmitControllerVibration() with a buffer containing just a single sample of varying amplitude. This is general works, but in cases were I am submitting a sample every frame (at 90hz) for both controllers (which can happen due to user behavior) neither controller vibrates at all.
If I submit 1 sample every 90hz frame for a single controller (either left or right) it buzzes consistently. However, if I submit 1 sample for both controllers each frame, neither vibrates at all.
I have reproduced this in the "Buffered Haptics" SDK sample. If you remove the code that is currently submitting a haptics buffer to the left controller and replace it with the the following, you can see this problem:
If I submit 1 sample every 90hz frame for a single controller (either left or right) it buzzes consistently. However, if I submit 1 sample for both controllers each frame, neither vibrates at all.
I have reproduced this in the "Buffered Haptics" SDK sample. If you remove the code that is currently submitting a haptics buffer to the left controller and replace it with the the following, you can see this problem:
unsigned char buffer[1] = { 255 };
ovrHapticsBuffer hapticsBuffer;
hapticsBuffer.SubmitMode = ovrHapticsBufferSubmit_Enqueue;
hapticsBuffer.SamplesCount = 1;
hapticsBuffer.Samples = buffer;
if (inputState.Buttons & ovrTouch_X) {
ovr_SubmitControllerVibration(Session, ovrControllerType_LTouch, &hapticsBuffer);
}
if (inputState.Buttons & ovrTouch_A) {
ovr_SubmitControllerVibration(Session, ovrControllerType_RTouch, &hapticsBuffer);
}
If you run the sample with this code, when you hold down X the left controller buzzes consistently, and likewise for A and the right controller. However if you hold down both buttons simultaneously, neither controller vibrates at all.
Why is this happening? I assume this is not intended behavior? I shouldn't be overflowing any buffers because I am submitting 1 sample at 90hz and the haptics samples are played at 320hz, I believe.
Thanks.
Why is this happening? I assume this is not intended behavior? I shouldn't be overflowing any buffers because I am submitting 1 sample at 90hz and the haptics samples are played at 320hz, I believe.
Thanks.
2 Replies
- star14ExplorerThanks!
Yes, I have read that documentation. I am aware that submitting one sample per frame at 90hz is not enough to keep the 320hz haptic buffer from emptying, but I am doing that intentionally because I want the "sharpest" haptic vibration I can get (and I also want the lowest latency). These haptic pulses are being used for instantaneous collisions with small objects, and they feel much better when they are as short as possible. - star14ExplorerThanks, I appreciate the detailed explanation.
The way samples are getting dropped on the floor right now is indeed not ideal for the lowest-possible-latency use case. I think I'm going to be able to hack around this by submitting 0-valued samples in front of the non-zero-valued ones I want to play when both controllers are vibrating continuously, but that seems brittle and also adds several frames of latency to the haptic response in that situation.
It seems like supporting low-latency haptics would be great for VR because it enables high fidelity interactive feedback rather than just playing back precomposed waveforms.
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 1 year ago
- 9 months ago
- 1 year ago