Virtual reality is coming and coming fast. In the recent months my best friend/design partner Austin McCasland and I have been studying and exploring virtual reality and how UX design relates to it with ferver. We had toyed around with some Google Cardboard projects to get a small sense of what VR could bring and were instantly hooked on it. Austin managed to get ahold of the incredible HTC Vive and we began getting our hands dirty with some real VR design.
We sat down for a weekend hackathon with the desire to create something fun to play and to get familiar with developing for the device. Being able to move freely throughout the room and use controlers tracked in real-time adds a new dimension of engagement and reality to the experience that we needed to take into consideration while designing. We began by playing around with the physics of some simple shapes and ened up with an experience that lets the user swing a lightsaber at a lively swarm of spheres flying around you in space. Getting to the final product was a great experience and a great first step into thinking about designing in VR.
The workstream of our project was a tandem design. For the majority of our work together, I would wear the device and call out suggested edits to verious environmental elements such as the gravitational strength, the explosive strength of a strike, and other various aspects of the experience. We would switch off between who was editing and who was testing, and when one of us would make suggestions, the other would adjust the properties or scripts driving the environment. The majority of the engineering was performed by Austin.
To get started we began exploring the physics engine in Unity and created a script to tell objects to be gravitationally attracted to another object. We attached the gravitatonal source to our controller and played around with some of the settings, fine tuning our way to an interesting swarm affect. We then attached flat plane to our other controller and swatted at the swarming objects. The resulting effect was really entertaining.
We really enjoyed the smacking the pellets around and thought that it would be fun to turn our large plank into a sword. The awesome people at Video Copilot released a Star Wars Asset Pack containing some fantastic 3D models, so we thought it a good opportunity to make our hand into a lightsaber. After some more tinkering and laying the foundation of the game mechanics, we began creating the environment. Soon we had a functioning lightwaber and a swarm attacking us in a space ship hangar. One issue you may notice in the video below is the replication speed of a hit ball. Without any peramiters in our "spawn on hit" script a new ball will spawn every frame. When you're running at 60-90 FPS you can easily spawn too many balls and crash the game. To counter this, we implemented a cool-down period for the newly-spawned ball where spawning is limited to one new ball every few seconds. We utilized this by making the original parent ball which was struck to change states and be able to be "sucked up" by our left hand for a short perdiod of time. This lets the player control the amount of balls in the swarm and creates the goal of maintaining order in the swarm for the player.
The hilt of the saber is tracked to our Vive controler and can be activated or deactivated by pulling the trigger. The light saber has a light emitter inside which serves as the only light source in the environment – making for a spooky and isolating scene.
The force hand.
To give the player a more engaging experience we thought it would be fun to allow the player to take control of the swarm by using a "force grab" like a Jedi. Our solution to this was actually quite simple: Attached to the left controler is an object with strong gravity that is toggled on and off with the controler's trigger. The object is pinned to the controler so it moves around the space with the controler, but it's fixed at a position a few meters away from the controler. When the player pulls the trigger, the swarm is attracted to the object in the distance and can be flung around the room. By rapidly rotating our controler around the room and strategically turning the force grab on and off, we can make the swarm of balls fling through the environment at high speeds, making for a really fun challenge to hit the balls.