Sponsored By

Featured Blog | This community-written post highlights the best of what the game industry has to offer. Read more like it on the Game Developer Blogs.

VR Tutorial Breakdown: Fallout VR VATS Mechanic

A walkthrough of FusedVR's implementation of the Fallout VR VATS mechanic.

FusedVR Team, Blogger

July 5, 2017

4 Min Read

Tutorial Recap: Fallout VATS Live Stream

Fallout VR is one of the biggest AAA game announcements for VR yet! With the game launching soon, the FusedVR team decided to build a prototype of the VATS mechanic. Slow time. Line up your shots. Enjoy!

Implementation

Before we dive into the details, let’s clarify our prototype approach.

  • Our prototype slows time, highlights body parts, and shoots bullets.

  • Our prototype skips the VATS percentage system. For more, check out the Future Improvements section.

  • We prototyped the Bloody Mess perk sans blood!

Slowing time can be accomplished by changing the Time.timeScale value. We called ToggleVats on the press of the touchpad and learned a timeScale value of 0.05f-0.1f works great for VATS.

The next challenge was highlighting body parts. That’s where VRTK, a Unity VR interaction toolkit developed by the Stone Fox, really shined. To summarize, all we really had to do was add the VRTK_InteractableObject component to a GameObject and call ToggleHighlight at the right time. Check out our video for a step-by-step walkthrough.

Shooting bullets required spawning a GameObject and adding a force. To get Bloody Mess to work, we created a basic rig then applied an explosion force at random if a bullet hit. For a complete VATS implementation, only colliders on the targeted body should be subject to the explosion force.

We used the default code for adding an explosion force, which you can find on Unity's online docs. Configuring the explosion force depends on the rig and rigidbodies you use but, once you’re set, the results look great!

Future Improvements

If we kept working on our prototype, we’d consider explosions, bullet trails, and more physics tweaks. We would also give the percentage system a try. Originally, we believed the percentage system would remove the joy in lining up a shot. Why aim only to miss?

On second thought, the percentage system definitely adds valuable suspense. If you want to try a percentage system, here’s a simple approach:

  • Add a float called hitProbability that starts at value 1f to the VatsHandler script.

  • For every consecutive shot during VATS mode, decrement hitProbabilityby a fixed amount.

  • Randomly generate a number between 0f and 1f. If that number is greater than hitProbability, turn off the bullet’s collider.

  • When you leave VATS mode, reset hitProbability to 1.

  • Extra Credit: use a raycast to check what body part the bullet is targeting and modify the hitProbability accordingly.

To Conclude

Our prototype was further evidence of a lesson we’ve seen over and over. Playing with physics and time in VR is a very simple way to create a fun experience. We’re not sure why but we have some guesses:

  • Delight in a virtual world is all about setting expectations for a user and making good on those expectations. When the world works the way you expect, you’re stoked! When the world does not, you’re sad. In that way, someone trying your VR experience for the first time is a lot like a baby learning about the real world. Physics simulations are among the easiest ways to let anyone test a world — real or virtual.

  • Playing with time in VR enables you to experience something you’ve never seen in real life but have always imagined. That’s living the dream — literally!

It’s never easy to take on a beloved mechanic, but the process is a blast! Check out our tutorial, share your thoughts on how VATS should work in VR, and let us know if you create any extensions so we can showcase your work. Happy building!

Read more about:

Featured Blogs

About the Author(s)

Daily news, dev blogs, and stories from Game Developer straight to your inbox

You May Also Like