// HyperealVR Boundaries|SDK_HyperealVR|005
namespace VRTK
{
#if VRTK_DEFINE_SDK_HYPEREALVR
using UnityEngine;
using Hypereal;
#endif
///
/// The HyperealVR Boundaries SDK script provides a bridge to the HyperealVR SDK play area.
///
[SDK_Description(typeof(SDK_HyperealVRSystem))]
public class SDK_HyperealVRBoundaries
#if VRTK_DEFINE_SDK_HYPEREALVR
: SDK_BaseBoundaries
#else
: SDK_FallbackBoundaries
#endif
{
#if VRTK_DEFINE_SDK_HYPEREALVR
protected HyRender cachedHyperealVRPlayArea;
private const float thickness = 0.1f;
///
/// The InitBoundaries method is run on start of scene and can be used to initialse anything on game start.
///
public override void InitBoundaries()
{
}
///
/// The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene.
///
/// A transform of the object representing the play area in the scene.
public override Transform GetPlayArea()
{
cachedPlayArea = GetSDKManagerPlayArea();
if (cachedPlayArea == null)
{
GameObject myHeadGO = VRTK_SharedMethods.FindEvenInactiveGameObject(null, true);
cachedPlayArea = (myHeadGO != null ? myHeadGO.transform.parent : null);
}
return cachedPlayArea;
}
///
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
///
/// A Vector3 array of the points in the scene that represent the play area boundaries.
public override Vector3[] GetPlayAreaVertices()
{
int count = 0;
HyperealApi.GetPlayAreaVertexCount(ref count);
if (count > 0)
{
float outer = 1f;
float inner = outer - thickness;
Vector3[] vertices = new Vector3[8];
vertices[0] = new Vector3(inner, 0f, -inner);
vertices[1] = new Vector3(-inner, 0f, -inner);
vertices[2] = new Vector3(-inner, 0f, inner);
vertices[3] = new Vector3(inner, 0f, inner);
vertices[4] = new Vector3(outer, 0f, -outer);
vertices[5] = new Vector3(-outer, 0f, -outer);
vertices[6] = new Vector3(-outer, 0f, outer);
vertices[7] = new Vector3(outer, 0f, outer);
return vertices;
}
return null;
}
///
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
///
/// The thickness of the drawn border.
public override float GetPlayAreaBorderThickness()
{
return thickness;
}
///
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
///
/// Returns true if the play area size has been auto calibrated and set by external sensors.
public override bool IsPlayAreaSizeCalibrated()
{
return true;
}
///
/// The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.
///
/// Returns true if the drawn border is being displayed.
public override bool GetDrawAtRuntime()
{
return false;
}
///
/// The SetDrawAtRuntime method sets whether the given play area drawn border should be displayed at runtime.
///
/// The state of whether the drawn border should be displayed or not.
public override void SetDrawAtRuntime(bool value)
{
}
#endif
}
}