The TriggerHaptics
method is used to initiate a haptic feedback effect on a VR controller. This method allows you to specify the type of haptic effect and scale its length, frequency, and amplitude to customize the feedback experience.
The TriggerHaptics
method is used to initiate a haptic feedback effect on a VR controller. This method allows you to specify the type of haptic effect and scale its length, frequency, and amplitude to customize the feedback experience.
To use the TriggerHaptics
method, you need to provide the following parameters:
effect
: An instance of Sandbox.HapticEffect
that defines the type of haptic feedback to be triggered.lengthScale
: A float
value that scales the duration of the haptic effect.frequencyScale
: A float
value that scales the frequency of the haptic effect.amplitudeScale
: A float
value that scales the amplitude of the haptic effect.This method does not return a value.
// Example of triggering a haptic effect on a VR controller VRController controller = new VRController(); HapticEffect effect = HapticEffect.Pulse; float lengthScale = 1.0f; float frequencyScale = 1.0f; float amplitudeScale = 1.0f; // Trigger the haptic feedback controller.TriggerHaptics(effect, lengthScale, frequencyScale, amplitudeScale);