haptic feedback
This commit is contained in:
1 parent
bf64766083
commit
ee82c726e0
2 files changed
+25
No files matched your search
@@ -13,6 +13,11 @@ public class iamagun : MonoBehaviour
|
||||
private Vector3 offsetPosition;
|
||||
private Quaternion offsetRotation;
|
||||
|
||||
// Vibration variables
|
||||
private float vibrationDelay = 0.05f; // Delay before the vibration starts
|
||||
private float vibrationDuration = 0.5f; // Duration of the vibration
|
||||
private float vibrationIntensity = 1.0f; // Intensity of the vibration
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -45,6 +50,24 @@ public class iamagun : MonoBehaviour
|
||||
{
|
||||
simpleShoot.StartShoot();
|
||||
audio.Play();
|
||||
|
||||
// Trigger delayed and intense vibration feedback
|
||||
StartCoroutine(TriggerVibration());
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator TriggerVibration()
|
||||
{
|
||||
// Wait for the specified delay before starting the vibration
|
||||
yield return new WaitForSeconds(vibrationDelay);
|
||||
|
||||
// Trigger vibration with the specified intensity
|
||||
OVRInput.SetControllerVibration(1, vibrationIntensity, OVRInput.Controller.RTouch);
|
||||
|
||||
// Wait for the specified duration
|
||||
yield return new WaitForSeconds(vibrationDuration);
|
||||
|
||||
// Stop the vibration
|
||||
OVRInput.SetControllerVibration(0, 0, OVRInput.Controller.RTouch);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user