Focus! A VR Game About Writer’s Block – Part 4: Distracting Distractions

So in hindsight, some of the systems I had ideas for regarding distractions proved a lot more complex than I first imagined. I am 100% a fledgling coder, and half the time I don’t even understand the code I am writing, so I did my best to create the distractions I could.

One that I got fully working was the vibrating phone. I had the object situated right next to the player, and created a script using elements of one Sokol taught us during one of his classes. The phone was given a randomized timer, and whenever it reached zero, it would begin to emit an audio source(which I later turned ambisonic) and change it texture to show on the screen that someone was calling.

From there, the player would need to pick it up, and hit the trigger to silence it, with its continued presence increasing the global timescale to make the concentration go away faster.

The next, and much more challenging distraction, was the flies.

In conclusion, I was unable to make it work on time.

Initially, I was hoping to get it working by creating my own flocking system for the fly, allowing it to move in a random pattern around the player so then they could swat it out of the air.

I did try implementing this for a time, despite it being very complicated for me. However, all of that was lost when I got a critical error and my computer was made unresponsive.

After a restart, I had lost all the progress I had made towards it, and given how difficult it had been to code to begin with, I decided to scrap it for time. Currently, the flies are emitted through the use of a particle system, the particles being swattable. I tried to code a system to close off the particle system after a certain amount of particles were killed, and then respawning it at a different position, but was unable to get it working. I did however get the ambisonic sounds working, and it may be working TOO well as the sound of flies buzzing in one ear is actually distracting in game.

Finally, was the temperature system.

I was able with minimal complications to get the window in my scene openable, using an XR Grab Interactor, and a hinge joint.

The system is rather finicky, glitching out due to collisions rather often. Beyond that, I wasn’t able to find much regarding coding with the use of hinge joints, so the thermometer idea itself was eventually scrapped.

I kept the window function in however, as I thought it was a nice immersive touch, even without the distraction feature.

So yes, overall, I was only able to get one of my three distractions working properly. However, as said, I was very happy with how the phone functions as a distraction method, and with more time and experience coding, I believe I could have gotten the other two functions working properly.

Leave a Reply

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