Getting Started with the HoloPlay Unity Plugin

Overview

Using the HoloPlay Plugin for Unity is a very seamless way to add onto your existing Unity development workflow, whether you're an expert or a beginner.

Steps

1. Importing the HoloPlay Unity Package

Set your Looking Glass Display to Desktop Mode and import the HoloPlay Plugin for Unity into a New Project in Unity by either double clicking on the package in your downloads folder or importing the asset within Unity via Assets > Import Package > Custom Package.

That's it! you're ready to get started! Go ahead and click that awesome button and get started on your holographic journey!

2. Framing Content with HoloPlay

Let's open up the first example scene in the package "Framing Content with HoloPlay". This is an example demo scene with a really cute Island with two cute furry creatures (hamsters?).

Navigate to the HoloPlay Capture in the Hierarchy and then select toggle preview (or ctrl E) in the Inspector to view your scene in the capture box in your connected Looking Glass display.

Let's go over a few basics:

The HoloPlay Capture camera is pretty similar to the unity standard camera, but there are a few things are different.

Namely, it's a box. The pink square in the front center of this box is the point of focus in the Capture Box and thus the connected Looking Glass Display.

If we move the capture box back and forth, you can see wherever the square is becomes the most clear focal point in the scene.

3. . Adjusting Position, Rotation, Scale and FOV


Select the DEMO object in the example scene's hierarchy. Let's check out the cool script that, in play mode, allows you to see animations of position, scale rotation, clipping plane, and FOV of the HoloPlay Capture camera. Hit play and go through each selection to see what changing each does for your Looking Glass view.

While this DemoCaptureAnimator script is an example of ways you can animate these values in script, you don't have to do that. In Advanced Camera Settings on the HoloPlay Capture, you can change these settings manually.

4. Adding Interactions! (Easily) Interact with your Unity Holographic Scene


Go to the prefabs folder of the HoloPlay Plugin and add the 3d Cursor prefab to your scene. The 3d cursor is a great component that allows you to easily maneuver your scene.

Once you've got the 3d cursor added, go to the HoloPlay Capture and Add Component → OrbitControl to your camera.

Now that you've got the 3d cursor setup you can try it out in play mode with the following controls!

  • mouse click + drag to rotate the scene,

  • scroll up and down to zoom in and out of the scene,

  • scroll wheel down and mouse drag to pan the scene around

  • Double click any point of the model to focus the view at that point

Pull in your own models into the scene and interact with them with the 3D Cursor and Orbit Controls.

5. Recording your scene with HoloPlay Recorder

I made all of these amazing 3D scenes in Unity, you ask, but how to I pull them into HoloPlay Studio? You can quilt record your scenes to capture them as holograms to share!

In the HoloPlay Plugin Scripts folder, there is a script called HoloPlay Recorder. That script can be called in your Unity Project to record out quilts of specific views and timing you want. First add the HoloPlay Recorder as a component on the HoloPlay Capture box in your scene.

Keep the presets at default. Though the HoloPlay Recorder is now a component on the Capture camera, we still need to create a controller for it in the scene so that you can Play, Pause, Unpause, and Stop the recording how you'd like.

Here's a simple script we made that maps the HoloPlay Recorder functions to keys 1-4. You can create an empty GameObject (we named ours Recorder) and add the script below as a component to it.

Feel free to copy and paste:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using LookingGlass; // make sure you're using LookingGlass

public class recordQuilt : MonoBehaviour
{
public HoloplayRecorder recorder; // referencing HoloPlay Recorder
bool recording = false; 
bool pause = false;

// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
		//start recording with 1
    if (Input.GetKeyDown(KeyCode.Alpha1) && !recording)
    {
        recorder.StartRecord();
        recording = true;
        Debug.Log("recording");
    }

		//pause recording with 2
    if (Input.GetKeyDown(KeyCode.Alpha2) && recording)
    {
        recorder.PauseRecord();
        pause = true;
        Debug.Log("paused");
    }

		//resume from pause with 3
    if (Input.GetKeyDown(KeyCode.Alpha3) && recording && pause)
    {
        recorder.ResumeRecord();
        pause = false;
        recording = true;
        Debug.Log("resumed from pause");
    }

		//stop recording quilt 
    if (Input.GetKeyDown(KeyCode.Alpha4) && recording)
    {
        recorder.EndRecord();
        recording = false;
        pause = false;
        Debug.Log("stopped recording");
    }
}

}

Drag the HoloPlay Capture from the Hierarchy into the Recorder field to reference HoloPlay Recorder.

Now you can record a quilt, that will by default save to your general Project folder.

Something to note: as you record quilts, change the Output name field on the HoloPlay Recorder component of the HoloPlay Capture. If you don't change the name or move the saved quilt from the project folder, new recorded quilts with the same name will overwrite each other.

6. Share your Holograms with us!

We're always excited to see what you're making!

If you have any questions, please reach out to us! You can reach the team at Looking Glass Factory at [email protected]! Share with us your first quilt recording in Unity, either in the Discord, or by tweeting and tagging @lkgglass