Zephyrnet Logo

Bowling in VR!

Date:

The bowling ball: By pressing the trigger on the controller, the user can pick up, hold, and release the ball. The weight and speed of the ball mimics the movement that a regular bowling ball would have. After it is thrown, the ball will respawn in the starting position by hitting the backstop, or through a manual reset from the user pressing the “reset ball” button.

The pins: Once hit by bowling ball, the pins will fall down after the collision. Once all of the pins are hit, they will respawn to reset the game. The pins can also be manually be reset through the button as seen in the image above on the right hand side. The design of the both the ball and pins were already pre-created in the asset store which are available for free.

The asset store is your friend!

The lane: With a wood flooring, the lane has two walls on either side with a backstop, simulating bumpers that would be regularly seen bowling.

1. The Possibility of AR on the Urban Space

2. Enter The Monarchy

3. The Exciting Applications of AR and VR in Automotive

4. The Best VR Events and Concerts Planned for 2021

Here’s a look into how the game actually works!

The Physics:

These are the components added on the bowling ball for functionality in collision and interactivity. The rigid body and mesh collider are also applied to the bowling pins, with the only change in mass (the pins are 1, while the ball is 3), and the OVR Grabbable script.

Rigid body: This makes sure the laws of physics and gravity are applied upon the game objects, and lets you apply forces and control it in a realistic way.

Mesh Collider: The checkmark on “Convex” indicates that this mesh collider object will collide with other mesh collider objects so that they don’t fall through the floor!

OVR Grabbable: From the free oculus integration in the asset store, the ovr grabbable script was already pre-made, allowing user interactiveness.

Pin and Ball Reset:

To reset both the pins and the ball, the user can click on these floating buttons in order to do so. I followed this tutorial (step 4 & 5) to add the buttons, but the most important step is integrating the Tilia package along with all the prefabs (fully configured game objects that have already been created for your use).

Installing the Tilia package into Unity: navigate to the manifest.json file in finder (go to the actual folder in your computer). After opening it up, there will be a section that says “dependencies”. At the bottom of this section, add in “io.extendreality.tilia.input.unityinputmanager”: “1.3.16”. The code below is a shortened version of what the dependencies would look like, and all the tilia extensions I added to complete this project.

 "dependencies": {
"com.unity.xr.legacyinputhelpers": "2.1.7",
"com.unity.xr.management": "3.2.17",
"com.unity.xr.oculus": "1.6.1",
"com.unity.xr.openvr.standalone": "2.0.5",
"com.unity.modules.xr": "1.0.0",

//Above are a few of the dependencies already installed, while the tilia extensions below were manually added

"io.extendreality.tilia.input.unityinputmanager": "1.3.16",
"io.extendreality.tilia.indicators.objectpointers.unity": "1.6.7",
"io.extendreality.tilia.camerarigs.trackedalias.unity": "1.5.7",
"io.extendreality.tilia.camerarigs.unityxr": "1.4.9",
"io.extendreality.tilia.camerarigs.spatialsimulator.unity": "1.2.31",
"io.extendreality.tilia.interactions.interactables.unity": "1.15.7",
"io.extendreality.tilia.interactions.spatialbuttons.unity": "1.2.3"
}

For the code behind the reset, here is a look into the C# script for the pins:

The Awake() call is used to load certain set up necessary prior to the game scene.

The SavePositions() method is called, where all the starting positions of the pins are logged in an array.

The ResetPositions() method contains a for loop, and goes through each of the pins to set the position and rotation to the original value saved previously. The velocity is also flattened on the pins, in the case that it spun out after being knocked over.

Oculus Integration:

The Hierarchy!

Once again, the asset store comes in really handy! The free oculus integration is compiled of pre-made scripts and functions, such as the OVR Player Controller that includes the camera rig for the oculus and the controller visibility. To properly set it up with controller integration, I followed this tutorial that is also mentioned underneath the resources below. I had to turn on developer mode on the oculus app and connect my computer to the headset with the USB-C charging cable.

Some awesome resources that helped me out:

Checkout PrimeXBT
Trade with the Official CFD Partners of AC Milan
Source: https://arvrjourney.com/bowling-in-vr-46e7047e2cc7?source=rss—-d01820283d6d—4

spot_img

Latest Intelligence

spot_img

Chat with us

Hi there! How can I help you?