Unity Sdk

by 3Glasses
+

This is the Unity SDK for 3Glasses Devices, this repository is Unity3D project

( Updated 5 hours ago )

+STYLE:

[[./README/icon.png]]

** How to Use Select 3Glasses>EnableHeadDisplay from the main menu.

[[./README/EnableHeadDisplay.png]]

Make sure the EnableHeadDisplay is selected in the 3Glasses drop-down box.

Now the Three3GlassesManager script is bind in your main camera, and there are some Properties can control the HeadDisplay's behavior.

[[./README/TreeGlassesCameraProperty.png]] * Properties:

+ATTR_HTML: :border 2 :rules all :frame border

| Property: | Discription | |-------------------------+------------------------------------------------------------------------------| | FreezePosition | freeze the headdisplay's position | | FreezeRotation | freeze the headdisplay's rotation | | Hmd Anti Aliasing Level | RenderTexture's Anti Aliasing Level | | Eye Distance | The distance between the left and right camera in the HeadDisplay. | | Layer Mask | Includes or omits layers of objects to be rendered by the HeadDisplay device | | Enable JoyPad | Enable the 3Glasses Wand | | Only Head Display | If checked it will cancel the display of the maincamera |

** Get HMD Info

  • Get HMD's position and rotation

    +BEGIN_SRC csharp

    using ThreeGlasses;

    //...

    Vector3 pos = TGInput.GetPosition(InputType.HMD); Quaternion rotate = TGInput.GetRotation(InputType.HMD);

    +END_SRC

  • Get HMD's button and touchpad info

    +BEGIN_SRC csharp

    // if the HMD's Menu Button is pressed TGInput.GetKey(InputType.HMD, InputKey.HmdMenu);

    // get touchpad info,rang is [-1.0~1.0] Vector2 v = TGInput.GetHMDTouchPad();

    +END_SRC

    Get Wand Input There are two ways to get wand's info: * Get The InputExtendMethods class definit some methods for get the wand's info. you can get the info like this:

    +BEGIN_SRC csharp

    using ThreeGlasses;

//...

// get the back key status (down is true) TGInput.GetKey(InputType.LeftWand, InputKey.WandBack); // get the stick's info,Both the X axis and the Y axis are limited to between -1 and 1. Vector2 v = TGInput.GetStick(InputType.LeftWand);

+END_SRC

* Bind Script Bind the ThreeGlassesWandBind.cs on your wand object.

[[./README/TreeGlassesWandBindProperty.png]]

Option

+ATTR_HTML: :border 2 :rules all :frame border

| Option | Description | |------------------+----------------------------------| | Type | wand's type | | Send To Children | send wand's info to all children | | Update Self | update the position and rotation | | Move Scale | scale wand's position | | Update Type | update local or world |

The children of the object who bind the ThreeGlassesWandBind.cs can implement OnWandChange for get the wand's info.

+BEGIN_SRC csharp

void OnWandChange(ThreeGlassesWand.Wand pack)
{
    // do somethng
    // pack.position or rotation
    // pack.GetKey(InputKey.xxx);
}

+END_SRC