3/1/2021: Hand Collision Working and Compatibility

Over the weekend I worked quite a lot on the project. I created a blocky arm model that maps to the VR controllers. Because of this, I was able to attach a collider to the “hand” and successfully test for collisions with the moving cubes. As of now, I have a variable for score that goes up by one for each block hit (as seen in the console window within Unity in the attached video). If blocks are not hit, they despawn shortly after they pass the player. In the future I will make scoring more interesting. For now, I have hardcoded Carly Rae Jepsen’s Call Me Maybe as the song that plays after a two second delay. Within the game object that controls the cubes spawning I have hardcoded the spawn time variable to be 0.5 since Call Me Maybe is 120 beats per minute (one cube every half second). I chose Call Me Maybe to test because it has a constant beat (except right at the end), 0.5 is a nice, round number for spawning the cubes, and because the song slaps. Once I learn more about beat detection, I plan on storing the milliseconds between each beat of the song in an array, and this spawn time variable will use these millisecond values for each succeeding beat. This will account for songs that speed up or slow down. To make sure the song is synced with when players hit the cubes, all I have to do is wait to start playing the music until the first cube is about an arm’s length away. For my next step, I plan on creating the user interface. While I am doing this I also plan on looking into beat detection, as that is the next step after creating the UI. Here is a live demo of the project so far! Enjoy.

On a side note, I also migrated my project from an older version of Unity. This enabled me to install the OpenVR plugin to my project, which lets the game run through SteamVR. This allows a wide range of headsets (other than my Oculus Rift) to be able to play the game. One side effect of doing this, however, was that my controller model that is mapped to the VR controllers was rotated 90 degrees. So, when the game would start the blocky controller models would be pointing straight up instead of pointing away from me. To fix this, I had to adjust the positioning and rotation of the two blocks within the model asset itself. An adequate amount of time was spent doing all of this, but now my game can be played on every mainstream VR headset. Woohoo!

Leave a Reply

Your email address will not be published. Required fields are marked *