Developed a Virtual Reality racing app, incorporating 3D physics and immersive gameplay to create an engaging and interactive driving experience.
Concept:
Developed a virtual reality driving game using Unity where the user drives around a track.
Technical:
Collision Detection and Impact Feedback
Implemented a collision detection system that provides real-time feedback when the player's vehicle collides with objects, enhancing the realism of the experience.
1public class PlayImpact : MonoBehaviour
2{
3 public AudioSource ImpactSound;
4 public float ImpactMinSpeed;
5
6 void OnCollisionEnter(Collision MyPlayer)
7 {
8 if (MyPlayer.gameObject.CompareTag("Player"))
9 {
10 if (Mathf.Abs(ApplicationData.CurrentYVelocity) > ImpactMinSpeed)
11 {
12 ImpactSound.Play();
13 }
14 }
15 }
16}
17
PlayImpact
class detects collisions between the player's vehicle and other objects. If the collision speed exceeds a minimum threshold (ImpactMinSpeed
), an impact sound is played to alert the player.Dynamic Vehicle Sound and Speed Display
Created a dynamic sound controller and speed display to simulate realistic engine sounds based on the vehicle's speed. This feature helps students gauge their speed and enhances immersion.
1public class SoundController : MonoBehaviour
2{
3 public AudioSource CarSound;
4
5 void Update()
6 {
7 CarSound.volume = Mathf.Abs(ApplicationData.CurrentZVelocity / 20.0f);
8 CarSound.pitch = Mathf.Abs(ApplicationData.CurrentZVelocity / 20.0f) + 0.3f;
9 }
10}
11
SoundController
adjusts the car's engine sound volume and pitch relative to the vehicle's current speed (CurrentZVelocity
), providing auditory feedback that reflects acceleration and deceleration.Impact