openvr icon indicating copy to clipboard operation
openvr copied to clipboard

[C# wrapper] TriggerHapticPulse - type of argument unDurationMicroSec should be ushort not char.

Open M-Ch opened this issue 10 years ago • 3 comments

When you try to call TriggerHapticPulse from .net code (full .net 4.6 x64 runtime, not mono) usDurationMicroSec parameter will not be interpreted correctly. After changing unDurationMicroSec type from 'char' to 'ushort' everything works as expected.

Here is a valid signature: internal delegate void _TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, uint usDurationMicroSec);

M-Ch avatar May 22 '16 20:05 M-Ch

Changing it from 'char' to 'ushort' does not fix it. However, changing it from 'char' to 'uint' does.

I also noticed that the vibration is still triggered when it is 'char' but it is almost undetectable. You have to literally put your ear up to the controller but you can hear the the faintest vibration when passing in char.MaxValue.

domisterwoozy avatar May 27 '16 20:05 domisterwoozy

I have changed it to this: internal delegate void _TriggerHapticPulse(uint unControllerDeviceIndex, uint unAxisId, ushort usDurationMicroSec); It works.

xiaoyang-git avatar Dec 13 '16 09:12 xiaoyang-git

Please fix this! This shit made me build the Unreal Engine and compare the code...

ErlerPhilipp avatar Dec 16 '16 11:12 ErlerPhilipp