namespace Sandbox;
partial class Controller
{
internal HapticEffect ActiveHapticEffect = new();
///
/// Stop all vibration events on this controller.
///
public void StopAllVibrations()
{
StopAllHaptics();
}
internal void UpdateHaptics()
{
ActiveHapticEffect?.Update( this );
}
///
/// Trigger a vibration based on a predefined .
/// All s are normalized (start at 0, peak at 1).
///
/// The pattern to use
/// The amount to scale the pattern's length by.
/// The amount to scale the pattern's frequency by.
/// The amount to scale the pattern's amplitude by.
public void TriggerHapticEffect( HapticEffect effect, float lengthScale = 1.0f, float frequencyScale = 1.0f, float amplitudeScale = 1.0f )
{
ActiveHapticEffect = effect;
ActiveHapticEffect.Reset();
ActiveHapticEffect.FrequencyScale = frequencyScale;
ActiveHapticEffect.AmplitudeScale = amplitudeScale;
ActiveHapticEffect.LengthScale = lengthScale;
}
}