Skip to main content
The Keyword

Daydream Labs: Interactive scenes with Blocks objects

Article's hero media

Since the launch of Blocks, people have been enthusiastically creating and sharing their amazing models with the community. So we asked ourselves: what would it be like to use Blocks objects to create an entire interactive scene?

Turns out it’s possible. In an experiment our team built recently, we created a system that lets people make their own "Escape the Room" experience in VR. Every object in the game is made from Blocks objects, including typical stuff like a flashlight, desk, bookcase, and the obligatory keypad, but also even the room itself.

Throw in some lighting, and the result is a scene with exactly the cartoonishly spooky vibe we were going for. Not a room you'd want to be trapped in for too long!

BlockScene

To get everything to work, we had to define how objects interact. We could’ve just written that directly in our code, but our goal was to allow anybody to create these experiences—no programming knowledge required. So we created a simple system of triggers and actions that allows the creator to indicate what happens next in response to certain events.

The system can express concepts such as "when the battery object collides with the flashlight object, activate the light object." The light happens to be a spotlight located at the tip of the flashlight object, so when the player places the battery in the right place, a cone of light will shine forward and move with the flashlight.

Using this simple trigger/action system, we built a number of other puzzles in the room, like opening a locked chest with a key, placing a book in a sliding bookcase and figuring out the combination to enter on a keypad.

Blockscenegif

Combining Blocks objects to create interactive scenes was a lot of fun. Because Blocks has a consistent low-poly visual style, the result of our efforts was an engaging environment where everything fit well together, even though objects were made by many different people on our team.

We learned a few other things along the way. First, the ability to add interactivity to a scene is super important, and a wide range of interactive scenes can be built from the simple primitives we had set up with our trigger and action system. Most of the interactions could be expressed as collisions (key and lock, battery and flashlight, book and bookcase) and simple actions like showing/hiding or animating particular objects.

Next, setting up the rendering was almost no work at all, because Blocks objects are low-poly and work well with simple materials. We just used the standard diffuse shaders for the opaque surfaces and a simple translucent one for the glass surfaces. Combining that with an ambient light and a spotlight achieved the rendering effect that we wanted.

Last, we set up a simple animation system where we pre-recorded the motions of certain objects and expressed them as a sequence of transformations (position, rotation, scale). This rudimentary animation system worked well when moving solid objects like a bookcase or the lid of a chest, but we’d need something more elaborate if we were to do character animation, perhaps using what we learned from our experiments on animating Blocks models. What’s more, adjusting the colliders for the objects to ensure they interacted correctly required some manual tweaks. In order to scale this, it might be worth looking into automatically generating simple colliders for objects.

Scene building and interactivity with Blocks objects are exciting areas for experimentation, and we're looking forward to seeing what other applications developers will come up with in this space.

Let’s stay in touch. Get the latest news from Google in your inbox.

Subscribe