A downloadable game for Windows

VR Baseball is a prototype for a baseball game made for the HTC Vive and steamVR. In this prototype you can hit balls with you bat and catch then using your glove.

  • created using unity3D
  • made within 48 hours

Controls

Hit the ball with your bat.

Press the trigger at the right moment to catch the ball with your glove.


Code Sample

Here you can find the code behind the catching mechanic. To catch a ball the player must pull the trigger right after the ball lands in the glove to hold it. To implement this mechanic I used a trigger collider to detect the ball.





When a ball enters the trigger collider and the player is not pressing the trigger the script invokes the OnCatch method after 0.2 seconds.

If the player hasn't pressed the trigger within these 0.2 second the ball is released.

While the player is holding a ball and releases the trigger the ball is also released.


The ball is released using this method:


Download

Download
VrBaseballBuild.rar 63 MB