VR
The OpenXR_VR demo is inspired by the popular rhythm game Beat Saber
The VR demo for Rhythm Timeline was built and tested for Meta Quest 3. Other headsets are not officially supported as we have no way of testing it directly ourselves. For this demo scene we decided to go with Unitys Meta OpenXR package since we are targetting Meta Quest specifically. Other VR/AR packages can work with Rhythm Timeline but we won’t have a demo scene available for those.
The following setup assumes you are setting up the VR demo for Meta Quest 3.
The VR demo showcases a gameplay in the style of “Beat Saber” one of the most popular Rhythm VR games in the world. Thanks to timeline you can make it your own by adding animated sequences, events and more to the timeline.
To slice the cubes we have chosen to use the open source package called ez-slice, instead of making our own as it comes with a lot of nice features (Thank you David Arayan for sharing this package): https://github.com/DavidArayan/ezy-slice
Setting up the headset
To get started with using VR with Rhythm Timeline you must first set your Quest 3 into developper mode. You can follow the steps from the official meta developer documentation: https://developers.meta.com/horizon/documentation/unity/unity-development-overview/
I recommend using the Link app to connect the headset to Unity and stream/play the game from editor play mode into the headset: https://developers.meta.com/horizon/documentation/unity/unity-env-device-setup#set-up-link
After downloading, installing and setting up your headset to your PC you can now start setting up the Unity project.
Setting up Unity for VR
You’ll need to download and install the following packages, from the package manager
Make sure to install the Open XR package to get started
- com.unity.xr.meta-openxr@2.0 V2.0.1+
- com.unity.xr.interaction.toolkit V3.0.7+
and their dependencies
You must download the starter Sample project from the Interaction Toolkit as some of the prefabs are used in our demo scene.
Once those packages are installed you can finally import the VR demo package from: Assets/Dypsloom/RhythmTimeline/Demos/OpenXR_VR
and open the VR demo scene “OpenXR_VR”
VR Demo components
The VR demo comes with components specific to triggering and cutting notes in VR.
VR Rhtyhm Input Manager & VR Rhythm Input Triggers
Very straight forward, this component takes in a list of VR Rhythme Input Triggers and manages interaction between the triggers and the notes
There are two RhythmInputTriggers
- VRRhythmInputColliderTrigger
- VRRhythmInputSliceTrigger
Both of these use an “Index”. This allows the VRNote to know which inputs are bad or should be ignored. For example blue sword shouldn’t be used to cut red blocks in demo scene. And the “Dodge Blocks” should ignore swords but hit the head collider.
VR Rhythm Input Collider Trigger
A simple OnTrigger input that sends an input event to the note if it enters the Trigger collider attached.
This is used in the demo scene for the head. With the idea that the player should dodge some obscales by moving.
VR Rhythm Input Slice Trigger
These are the components set on the swords which detect if you hit a note. We an interpolated set of raycasting to get better accuracy for fast movements. Each Fixed updated we check if any of the raycasts projected from interpolated previous and new positions hit any notes. This is more reliable than OnTrigger events which may miss the note when moving at extreme speeds
If need be increase the “RayInterpolationExtraSampleCount” but be mindful to not overdo it as it may tank the performance if set too high.
VR Rhythm Note
Similarly to the triggers there are two VR Rhythm Notes
- VRRhythmTriggerNote
- VRRhythmSliceableNote
The Dodge Block is a VRRhythmTriggerNote. It only triggers when entering the head as speficied by the Bad indexes
The Blue, Red and Mine Notes are VRRhythmSliceableNote. The differente good, bad indexes lets us easily specify which not should be hit by which trigger.
For the slicing effect to work make sure your 3D model is set to Read/Write. Otherwise you won’t be able to cut the mesh and it will throw a warning.