haptic feedback
This commit is contained in:
		
							parent
							
								
									bf64766083
								
							
						
					
					
						commit
						ee82c726e0
					
				@ -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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -139,6 +139,8 @@ PlayerSettings:
 | 
			
		||||
  bundleVersion: 0.1
 | 
			
		||||
  preloadedAssets:
 | 
			
		||||
  - {fileID: 11400000, guid: 29d72bf9f28086693968cedbdc8f08cd, type: 2}
 | 
			
		||||
  - {fileID: 11400000, guid: 541751c4fa90967d68ef779a22ee43f3, type: 2}
 | 
			
		||||
  - {fileID: -3127938587913570544, guid: 8eb28e39ec717d0799039f01965f0533, type: 2}
 | 
			
		||||
  metroInputSource: 0
 | 
			
		||||
  wsaTransparentSwapchain: 0
 | 
			
		||||
  m_HolographicPauseOnTrackingLoss: 1
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user