Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Any example on how to use TriggerSimpleHapticEvent function? #18

Open
stoora opened this issue May 22, 2023 · 7 comments
Open

Any example on how to use TriggerSimpleHapticEvent function? #18

stoora opened this issue May 22, 2023 · 7 comments

Comments

@stoora
Copy link

stoora commented May 22, 2023

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

@ramunator
Copy link

Yeah i have no idea how to use that as well

@stoora
Copy link
Author

stoora commented Jun 5, 2023

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
Copy link
Author

stoora commented Jun 5, 2023

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

@ramunator
Copy link

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 );
}

@stoora
Copy link
Author

stoora commented Jun 5, 2023

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

@ramunator
Copy link

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 :)

@stoora
Copy link
Author

stoora commented Jun 5, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants