/// <summary>Sets the value of <see cref="playAreaSize">playAreaSize</see> and propagates that information to the scene.</summary> /// <param name="size">The dimensions of the Play Area to apply.</param> public void setPlayAreaSize(PlayAreaSize size) { Instance._playAreaSize = size; if (hasImmerseumPlayArea) { _playArea.setPlayAreaSize(size); } }
/// <summary>Sets the <see cref="size">size</see> of the Play Area based on a collection of vertex points that define the boundary.</summary> /// <param name="vertices">A <see cref="!:https://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx">List</see> of <see cref="!:https://docs.unity3d.com/ScriptReference/Vector3.html">Vector3</see> points in worldspace that represent the vertexes of the (possibly /// irregularly-shaped) Play Area boundary.</param> public void setPlayAreaSize(List <Vector3> vertices) { _size = PlayAreaSize.Custom; verticesList = vertices; for (int x = 0; x < 8; x++) { cornerVertices[x] = Vector3.zero; } renderVertices(verticesList.ToArray()); }
/// <summary>Sets the <see cref="size">size</see> of the Play Area, supporting the use of custom dimensions.</summary> /// <param name="size">The <see cref="PlayAreaSize" /> that the Play Area should adopt.</param> /// <param name="dimensions">If <strong>size</strong> is equal to <see cref="PlayAreaSize.Custom" />, the dimensions (width along the x-axis, depth along the z-axis) of the custom-sized Play Area /// expressed as a <see cref="!:https://docs.unity3d.com/ScriptReference/Vector2.html">Vector2</see>.</param> public void setPlayAreaSize(PlayAreaSize size, Vector2 dimensions) { if (size != PlayAreaSize.Custom) { setPlayAreaSize(size); return; } _size = size; setDimensions(dimensions); }
/// <summary>Sets the <see cref="size">size</see> of the Play Area to one of the preconfigured <see cref="PlayAreaSize" /> values.</summary> /// <param name="value">The <see cref="PlayAreaSize" /> that the Play Area should adopt.</param> public void setPlayAreaSize(PlayAreaSize value) { _size = value; switch (value) { case PlayAreaSize.NotApplicable: if (PlayAreaManager.isPlayAreaDisplayedAlways && HMDSimulator.isUsingSteamRig && HMDSimulator.isHMDConnected) { if (HMDSimulator.logDiagnostics) { Debug.LogWarning("[ImmerseumSDK] Applying Play Area size and rendering properties from the SteamVR_PlayArea attached to the Camera Rig."); } applySteamPlayAreaSettings(); break; } else if (PlayAreaManager.isPlayAreaDisplayedAlways && HMDSimulator.isUsingSteamRig) { Debug.LogWarning("[ImmerseumSDK] Play Area is set to always display, but size has been set to Not Applicable and calibration is unavailable without a headset connected. Falling back to a default Play Area of 3m x 2.25m."); goto case PlayAreaSize._300x225; } else if (PlayAreaManager.isPlayAreaDisplayedAlways) { Debug.LogWarning("[ImmerseumSDK] Play Area is set to always display, but size has been set to Not Applicable. The Oculus Rift does not have a default play area to fallback to, so no Play Area will be displayed."); } gameObject.SetActive(false); break; case PlayAreaSize._200x150: setDimensions(2f, 1.5f); break; case PlayAreaSize._300x225: setDimensions(3f, 2.25f); break; case PlayAreaSize._400x300: setDimensions(4f, 3f); break; case PlayAreaSize.Calibrated: setDimensions(); break; case PlayAreaSize.Custom: Vector2 dimensions = PlayAreaManager.customPlayAreaDimensions; setDimensions(dimensions); break; } }
/// <summary> /// <para>Sets the <see cref="size">size</see> of the Play Area based on provided dimensions.</para> /// <innovasys:widget type="Info Box" layout="block" xmlns:innovasys="http://www.innovasys.com/widgets"> /// <innovasys:widgetproperty layout="block" name="Content">If the dimensions provided correspond to one of the existing standard <see cref="PlayAreaSize" /> values, that /// value will be applied. Otherwise, a Custom size will be applied.</innovasys:widgetproperty> /// </innovasys:widget> /// </summary> /// <param name="dimensions">The dimensions of the Play Area, expressed as a <see cref="!:https://docs.unity3d.com/ScriptReference/Vector2.html">Vector2</see> where width /// (along the x-axis) is the X position and depth (along the z-axis) is the Y position.</param> public void setPlayAreaSize(Vector2 dimensions) { if (dimensions.x == 2f && dimensions.y == 1.5f) { _size = PlayAreaSize._200x150; } else if (dimensions.x == 3f && dimensions.y == 2.25f) { _size = PlayAreaSize._300x225; } else if (dimensions.x == 4f && dimensions.y == 3f) { _size = PlayAreaSize._400x300; } else { _size = PlayAreaSize.Custom; } setDimensions(dimensions); }