Skip to main content

Command Palette

Search for a command to run...

I Made a Game That Replicates Beat Saber — But on Mobile VR!

Step-by-step instructions for creating a Beat Saber clone on mobile VR with Unity on a budget.

Published
5 min read
I Made a Game That Replicates Beat Saber — But on Mobile VR!

Ever wanted to play Beat Saber but couldn’t justify spending a ton of money on a VR headset? Let me show you how I brought this popular game to life on a budget using just mobile VR.

The Challenge: Expensive VR Headsets

VR headsets like Meta Quest, Oculus, or the Apple Vision Pro can cost a fortune. Not everyone can afford them, and that’s a big barrier for those who want to enjoy VR gaming. So, I decided to make my own version of Beat Saber using a cheap mobile VR headset. I bought one that came with a remote, but when it arrived, the remote turned out to be trash — only two buttons worked. Still, I was determined to make it work!

Step-by-Step: Building the Lightsaber Game

Step 0: Setting Up the Project

The first step was choosing a game engine, and Unity was the obvious choice because I’m already familiar with it. I used Unity version 2021.3.43f1. To implement the VR, I started by integrating the Google Cardboard SDK, which allowed me to set up VR cameras in my scene. After creating the first build with a sample scene, I was thrilled to see that it worked perfectly!

This Tutorial Helped me a lot setting up this project 👇

When I built the first test with a sample scene, it worked perfectly!

VR Working Demo

Creating a New GVR Emulator

Since the original Google VR emulator was deprecated, I had to create my own GVR simulator to handle camera rotations. This allows testing VR interactions without a physical headset. I used a simple script that uses the mouse and keyboard for input.

Here’s the code for my custom GVR Emulator:

using UnityEngine;

public class GVREmulator : MonoBehaviour
{
    public float rotationSpeed = 3.0f;
    private bool isRotating;

    void Update()
    {
        if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
        {
            float mouseX = Input.GetAxis("Mouse X");
            float mouseY = Input.GetAxis("Mouse Y");

            RotateCamera(mouseX, mouseY);
            isRotating = true;
        }
        else
        {
            isRotating = false;
        }
    }

    void RotateCamera(float mouseX, float mouseY)
    {
        float rotationX = mouseY * rotationSpeed;
        float rotationY = mouseX * rotationSpeed;

        transform.Rotate(-rotationX, rotationY, 0);
    }

    void OnGUI()
    {
        // Display a message when Ctrl is held down and the mouse is moving
        if (isRotating)
        {
            GUI.Label(new Rect(10, 10, 200, 30), "GVR Emulator: Mouse Control");
        }
    }
}

This script lets me use the mouse to look around in the game while I’m developing and testing, just like how you’d move your head in VR. By holding the control key, I can move the camera with the mouse, making it easy to test without using a VR headset every time. It’s a quick and helpful way to check how things work.

GVR Simulator in Action

Problem Solved: Testing the Remote

To check which buttons were working, I wrote a simple C# script that showed which button was pressed on a text display in the game. This also helped me test the cheap VR remote that connects via Bluetooth. Not surprisingly, only two buttons worked, but I was ready to move forward without relying on it.

using UnityEngine;

public class ButtonPressController : MonoBehaviour
{
    public TextMesh textMesh;
    void Update()
    {
        if (Input.anyKeyDown || true)
        {
            foreach (KeyCode keyCode in System.Enum.GetValues(typeof(KeyCode)))
            {
                if (Input.GetKey(keyCode))
                {
                    textMesh.text = "Button Pressed: " + keyCode;
                }
            }
        }
    }
}

Checking Pressed Buttons

Step 1: Setting Up the Lightsaber

I made a platform for the player and added a lightsaber. I positioned it to slice incoming blocks and added colliders so it could detect when it hit other objects. For the slicing mechanics, I used the EzySlice Framework, which made slicing easy. I added some test cubes, and sure enough, the lightsaber sliced through them beautifully, dividing them into two pieces with a satisfying particle effect using Unity’s Particle System.

EzySlice Github Page

Step 2: Spawning the Blocks

Then came the real fun. I created a scene where endless cubes spawn and rush towards the player. The player can rotate their head to move the lightsaber and slice the cubes mid-air. I wrote a C# script that continuously spawns cubes, directs them towards the player, and deletes them from the scene after a few seconds to keep everything running smoothly without overwhelming the system.

Blocks Spawning

Final Touches: Adding Score and Game Modes

Finally, I added a user interface with Unity Canvas, including score and high score systems via C# scripts. I also created a main menu with two modes:

  • Game Over Mode: Miss 10 blocks, and it’s game over.

  • Infinite Mode: Slice as many blocks as you want without limits.

Since the phone is mounted in the headset, I couldn’t rely on touch inputs. So, I made a script that lets the player select menu options by looking at them for 3 seconds. This was done using raycasting to track where the player is looking, with a countdown to show when a button will be pressed.

Game Demo

Wrap-Up

To sum it up, I successfully created a mobile VR version of Beat Saber using Google Cardboard and Unity. Despite the hiccups with the cheap remote, I was able to deliver a fun and engaging experience without breaking the bank. If you’re looking to try VR gaming without the high costs, this project shows that all you need is some creativity and determination. Ready to take on your own VR challenge? Grab a budget headset and start slicing!

💡
If you're enjoying this journey and want to explore more cool projects, make sure to follow me on GitHub! Don't miss out on new updates and projects — let's connect and build awesome things together!
Z
zgd1y ago

We are willing to pay a high price to acquire the source code of a mobile game that is compatible with both Android and iOS platforms, for the purpose of learning and research. The game must meet the following criteria: it should be developed by a top-tier gaming company within the past 5 years, fully completed and matured, and preferably of the multiplayer online MMORPG or ARPG genre. If your game meets our interest, we will proceed with the transaction promptly and offer an upfront payment as a gesture of goodwill. Contact me q791864008q@gmail.com

Z
zgd1y ago

Who has access to the source code for a completed, large-scale multiplayer online Android and iOS game developed by a major gaming company? The game must have top-notch graphics. large-scale multiplayer online mobile game developed by a major gaming company? I will not accept games developed by individuals. We are located in Vietnam, and I am willing to pay a high fee to purchase it for learning and research purposes. I am sincere in my intention to buy, If I like your game,I can make a deposit first. Contact me q791864008q@gmail.com

H

Who has the source code of a mature and large-scale multiplayer online mobile game from a major game company? It is required that the game must have mature commercialization and in-app purchases. Players can directly become stronger by purchasing in-app purchases. We are in Vietnam and I am willing to pay super high fees to buy. Contact me q791864008q@gmail.com

Z
zgd1y ago

Who has the source code for mature large-scale mobile multiplayer online games from major gaming companies? I am willing to pay a reasonable fee for high-quality source code You can contact me q791864008q@gmail.com

H

Who has the source code for mature large-scale mobile multiplayer online games from major gaming companies? I am willing to pay a reasonable fee for high-quality source code You can contact me q791864008q@gmail.com

Z
zgd1y ago

Who has the source code for mature large-scale mobile multiplayer online games from major gaming companies? I am willing to pay a reasonable fee for high-quality source code You can contact me q791864008q@gmail.com

Z
zgd1y ago

I am passionate about game development and am looking for a multiplayer online mobile game source code for personal learning and communication to deepen my understanding of game architecture and backend technology. I highly respect intellectual property rights and am willing to pay reasonable compensation for high-quality source code to express my sincerity and gratitude. If you have this resource and would like to share it, I would greatly appreciate it. Please contact me through the following methods q791864008q@gmail.

H

Sincerely seeking the source code of a multiplayer online mobile game for learning and exchange purposes. Our budget is between 50,000and100,000 USD, and prices are negotiable. Interested parties, please reach out to me for further discussion. Transactions can be arranged at your convenience. Please contact my email as soon as possible vlin791864008@gmail.com

More from this blog

Subh's Hub

6 posts