# GvrHeadset Class Reference

# GvrHeadset

Main entry point for Standalone headset APIs.

## Summary

To use this API, use the [GvrHeadset](https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset) prefab. There can be only one such prefab in a scene, since this is a singleton object.

### Inheritance

Inherits from: MonoBehaviour  
Direct Known Subclasses:[GoogleVR.Beta.GvrBetaHeadset](https://developers.google.com/vr/reference/unity/class/GoogleVR/Beta/GvrBetaHeadset)

| ### Properties ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1aa7dc3f459a5a9e334762e7b97bce9ad6` | `static https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1a6a16bfcfc9bb56725605d658b91d9741` Event handlers for `OnRecenter`. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1a3826be2e4642a12a76b6244b344f4ebe` | `static https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1a1ad56550087ac8ccc79ca0241d83d2bb` Event handlers for `OnSafetyRegionChange`. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1ac956673bafb745c0e6a01c0b596d6014` | `bool` Gets a value indicating whether this headset provides an Editor Emulator. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1aae8dcbc79ff4b94be4f612a5b92e763e` | `static bool` Gets a value indicating whether this headset supports 6DoF positional tracking. |

| ### Protected functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1a01b683d7fe98cacd5fb6462314931303()` | ` `` Initializes a new instance of the https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset class. ` |

| ### Public functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1a6a16bfcfc9bb56725605d658b91d9741(GvrRecenterEventType recenterType, GvrRecenterFlags recenterFlags, Vector3 recenteredPosition, Quaternion recenteredOrientation)` | `delegate void` This delegate is called after the headset is recentered. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1a1ad56550087ac8ccc79ca0241d83d2bb(bool enter)` | `delegate void` This delegate is called when the headset crosses the safety region boundary. |

| ### Public static functions ||
|---|---|
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1abfb42c3222e5f2a0d7ce95e8cb2f511a(ref float floorHeight)` | `bool` Populates `floorHeight` with the detected height, if one is available. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1ac83f2e9da05e04dad0c528837d1854c2(ref Vector3 position, ref Quaternion rotation)` | `bool` Populates position and rotation with the last recenter transform, if one is available. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1a1be8e8e2be168726a57769d76156392b(ref float innerRadius)` | `bool` Populates `innerRadius` with the safety cylinder inner radius, if one is available. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1add13c8dfb45ec68a3ae6d0366c39b751(ref float outerRadius)` | `bool` Populates `outerRadius` with the safety cylinder outer radius, if one is available. |
| `https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset_1ae10654fc4c55e10505572a46c654081d(ref GvrSafetyRegionType safetyType)` | `bool` Populates `safetyType` with the safety region type, if one is available. |

## Properties

### OnRecenter

```c#
static OnRecenterEvent OnRecenter
```
Event handlers for `OnRecenter`.

Triggered when a recenter command has been issued by the user.

### OnSafetyRegionChange

```c#
static OnSafetyRegionEvent OnSafetyRegionChange
```
Event handlers for `OnSafetyRegionChange`.

Triggered when the safety region has been entered or exited.

### ProvidesEditorEmulator

```c#
bool ProvidesEditorEmulator
```
Gets a value indicating whether this headset provides an Editor Emulator.

Value `true` if this headset provides an Editor Emulator, or `false` otherwise.

### SupportsPositionalTracking

```c#
static bool SupportsPositionalTracking
```
Gets a value indicating whether this headset supports 6DoF positional tracking.

Value `true` if this headset supports 6DoF positional tracking, or `false` if only 3DoF rotation-based head tracking is supported.

## Protected functions

### GvrHeadset

```c#
 GvrHeadset()
```
Initializes a new instance of the [GvrHeadset](https://developers.google.com/vr/reference/unity/class/GvrHeadset#classGvrHeadset) class.

## Public functions

### OnRecenterEvent

```c#
delegate void OnRecenterEvent(
  GvrRecenterEventType recenterType,
  GvrRecenterFlags recenterFlags,
  Vector3 recenteredPosition,
  Quaternion recenteredOrientation
)
```
This delegate is called after the headset is recentered.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `recenterType` | Indicates the reason recentering occurred. | | `recenterFlags` | Flags related to recentering. See \|GvrRecenterFlags\|. | | `recenteredPosition` | The positional offset from the session start pose. | | `recenteredOrientation` | The rotational offset from the session start pose. | |

### OnSafetyRegionEvent

```c#
delegate void OnSafetyRegionEvent(
  bool enter
)
```
This delegate is called when the headset crosses the safety region boundary.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `enter` | Set to `true` if the safety region is being entered, or `false` if the safety region is being exited. | |

## Public static functions

### TryGetFloorHeight

```c#
bool TryGetFloorHeight(
  ref float floorHeight
)
```
Populates `floorHeight` with the detected height, if one is available.

This may be unavailable if the underlying GVR API call fails.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `floorHeight` | If this call returns `true`, this value is set to the retrieved `floorHeight`. Otherwise leaves the value unchanged. | |
| **Returns** | Returns `true` if value retrieval was successful, `false` otherwise (depends on tracking state). |

### TryGetRecenterTransform

```c#
bool TryGetRecenterTransform(
  ref Vector3 position,
  ref Quaternion rotation
)
```
Populates position and rotation with the last recenter transform, if one is available.

This may be unavailable if the underlying GVR API call fails.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `position` | If this call returns `true`, this value is set to the retrieved position. | | `rotation` | If this call returns `true`, this value is set to the retrieved rotation. | |
| **Returns** | Returns `true` if value retrieval was successful, `false` otherwise. |

### TryGetSafetyCylinderInnerRadius

```c#
bool TryGetSafetyCylinderInnerRadius(
  ref float innerRadius
)
```
Populates `innerRadius` with the safety cylinder inner radius, if one is available.

This is the radius at which safety management (e.g. safety fog) may cease taking effect.

If the safety region is of type `GvrSafetyRegionType.Cylinder`, populates `innerRadius` with the inner radius size of the safety cylinder in meters. Before using, confirm that the safety region type is `GvrSafetyRegionType.Cylinder`. This may be unavailable if the underlying GVR API call fails.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `innerRadius` | If this call returns `true`, this value is set to the retrieved `innerRadius`. | |
| **Returns** | Returns `true` if value retrieval was successful, `false` otherwise. |

### TryGetSafetyCylinderOuterRadius

```c#
bool TryGetSafetyCylinderOuterRadius(
  ref float outerRadius
)
```
Populates `outerRadius` with the safety cylinder outer radius, if one is available.

If the safety region is of type `GvrSafetyRegionType.Cylinder`, populates `outerRadius` with the outer radius size of the safety cylinder in meters. Before using, confirm that the safety region type is `GvrSafetyRegionType.Cylinder`. This may be unavailable if the underlying GVR API call fails.

This is the radius at which safety management (e.g. safety fog) may start to take effect.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `outerRadius` | If this call returns `true`, this value is set to the retrieved `outerRadius`. | |
| **Returns** | Returns `true` if value retrieval was successful, `false` otherwise. |

### TryGetSafetyRegionType

```c#
bool TryGetSafetyRegionType(
  ref GvrSafetyRegionType safetyType
)
```
Populates `safetyType` with the safety region type, if one is available.

Populates `safetyType` with the available safety region feature on the currently-running device. This may be unavailable if the underlying GVR API call fails.

<br />

| Details ||
|---|---|
| Parameters | |---|---| | `safetyType` | If this call returns `true`, this value is set to the retrieved `safetyType`. | |
| **Returns** | Returns `true` if value retrieval was successful, `false` otherwise. |