VR Drums

VR Drums project with immersive sound.

I created this in Unity as inspired by Valem's tutorial.

  • Using XR Interaction Toolkit
  • Drum Sounds
  • Randomized Pitch
  • Velocity Estimator to find velocity of drumsticks

Video Demonstration:



Screenshots:





Code Sample:

private void OnTriggerEnter(Collider other){                                
    if(other.CompareTag(targetTag)){
        VelocityEstimator estimator = other.GetComponent(); 
            if(estimator && useVelocity){
            float v = estimator.GetVelocityEstimate().magnitude;
    
            if(randomizePitch)
                source.pitch = Random.Range(minPitch, maxPitch);
    
            source.PlayOneShot(clip, volume);
            }else{
                if(randomizePitch)
                    source.pitch = Random.Range(minPitch, maxPitch);
                    
                    source.PlayOneShot(clip);
                }
            }
        }