Steamworks.NET-Test icon indicating copy to clipboard operation
Steamworks.NET-Test copied to clipboard

Any example on how to use TriggerSimpleHapticEvent function?

Open stoora opened this issue 2 years ago • 7 comments

SteamInputTest.cs Line 270: //SteamInput.TriggerSimpleHapticEvent() // TODO Thanks in advance.

stoora avatar May 22 '23 18:05 stoora

Yeah i have no idea how to use that as well

ramunator avatar Jun 05 '23 08:06 ramunator

Hi, add a function to the "Controller.cs" and test/uncomment the method that works with your controller. public async Task TriggerVibration() { //SteamInput.Internal.Legacy_TriggerHapticPulse( Handle, SteamControllerPad.Right, ushort.MaxValue ); //SteamInput.Internal.Legacy_TriggerRepeatedHapticPulse( Handle, SteamControllerPad.Left, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, uint.MaxValue ); //SteamInput.Internal.TriggerSimpleHapticEvent( Handle, ControllerHapticLocation.Both, byte.MaxValue, char.MaxValue, byte.MaxValue, char.MaxValue ); //SteamInput.Internal.Legacy_TriggerHapticPulse( Handle, SteamControllerPad.Left, ushort.MaxValue ); //SteamInput.Internal.TriggerVibration( Handle, ushort.MinValue, ushort.MinValue ); //SteamInput.Internal.TriggerVibration( Handle, ushort.MaxValue / 500, ushort.MaxValue / 500 ); //SteamInput.Internal.TriggerSimpleHapticEvent( Handle, ControllerHapticLocation.Both, byte.MaxValue, char.MaxValue, byte.MaxValue, char.MaxValue ); SteamInput.Internal.TriggerSimpleHapticEvent( Handle, ControllerHapticLocation.Both, byte.MaxValue, char.MaxValue, byte.MaxValue, char.MaxValue ); //SteamInput.Internal.TriggerVibration( Handle, ushort.MaxValue, ushort.MinValue); //SteamInput.Internal.TriggerVibrationExtended( Handle, ushort.MinValue, ushort.MinValue, ushort.MaxValue, ushort.MaxValue); // SteamInput.Internal.Legacy_TriggerHapticPulse( Handle, SteamControllerPad.Right, 50000 ); //SteamInput.Internal.Legacy_TriggerRepeatedHapticPulse( Handle, SteamControllerPad.Left, ushort.MaxValue, ushort.MinValue, ushort.MaxValue, uint.MinValue ); //SteamInput.Internal.Legacy_TriggerRepeatedHapticPulse( Handle, SteamControllerPad.Right, 50000, 50000, 10, 0 ); }

Use: await Task.Run(() => { yourcontroller.TriggerVibration().Wait(); } ); also check out this link: https://tenebrisstudio.itch.io/your-computer-might-be-at-risk/devlog/452070/steaminput-implementation

stoora avatar Jun 05 '23 11:06 stoora

Oh sorry,I forgot to mention, that example is with Facepunch.Steamworks and not Steamworks.NET

stoora avatar Jun 05 '23 11:06 stoora

Shouldnt there be some await inside the triggerVibration Func?

Mine looks like this inside controller.cs

public async Task TriggerVibration( ushort leftSpeed, ushort rightSpeed ) { SteamInput.Internal.TriggerVibration( Handle, leftSpeed, rightSpeed ); }

ramunator avatar Jun 05 '23 15:06 ramunator

I'm awaiting the calling thread, so that the game is not blocked waiting for steaminput calls. await Task.Run(() => yourAsyncSIAPIMethod())

stoora avatar Jun 05 '23 15:06 stoora

Would you mind showing me a basic example you dont need to explain anything just the code you have in the dll and in you unity project. I really appreciate your help seems like no one is using steam input :)

ramunator avatar Jun 05 '23 16:06 ramunator

add me on linked in (see my full name in my github profile) I'll share my screen and explain the process...

stoora avatar Jun 05 '23 17:06 stoora