Skip to content

Commit 77a667d

Browse files
committed
fix(SDK): remove erroneous parameter from boundary methods
A few of the SDK Boundary methods required a playArea GameObject to be passed into them, however many of the internal methods didn't use this GameObject as they can access the cached version of the play area or simply make the same `GetPlayArea()` call which was being used to pass the playArea object into the method in the first place.
1 parent 0c3b73e commit 77a667d

File tree

11 files changed

+96
-117
lines changed

11 files changed

+96
-117
lines changed

Assets/VRTK/SDK/Base/SDK_BaseBoundaries.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,20 @@ public abstract class SDK_BaseBoundaries : SDK_Base
2727
/// <summary>
2828
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
2929
/// </summary>
30-
/// <param name="playArea">The GameObject containing the play area representation.</param>
3130
/// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
32-
public abstract Vector3[] GetPlayAreaVertices(GameObject playArea);
31+
public abstract Vector3[] GetPlayAreaVertices();
3332

3433
/// <summary>
3534
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
3635
/// </summary>
37-
/// <param name="playArea">The GameObject containing the play area representation.</param>
3836
/// <returns>The thickness of the drawn border.</returns>
39-
public abstract float GetPlayAreaBorderThickness(GameObject playArea);
37+
public abstract float GetPlayAreaBorderThickness();
4038

4139
/// <summary>
4240
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
4341
/// </summary>
44-
/// <param name="playArea">The GameObject containing the play area representation.</param>
4542
/// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
46-
public abstract bool IsPlayAreaSizeCalibrated(GameObject playArea);
43+
public abstract bool IsPlayAreaSizeCalibrated();
4744

4845
/// <summary>
4946
/// The GetDrawAtRuntime method returns whether the given play area drawn border is being displayed.

Assets/VRTK/SDK/Daydream/SDK_DaydreamBoundaries.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,29 +51,26 @@ public override Transform GetPlayArea()
5151
/// <summary>
5252
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
5353
/// </summary>
54-
/// <param name="playArea">The GameObject containing the play area representation.</param>
5554
/// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
56-
public override Vector3[] GetPlayAreaVertices(GameObject playArea)
55+
public override Vector3[] GetPlayAreaVertices()
5756
{
5857
return null;
5958
}
6059

6160
/// <summary>
6261
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
6362
/// </summary>
64-
/// <param name="playArea">The GameObject containing the play area representation.</param>
6563
/// <returns>The thickness of the drawn border.</returns>
66-
public override float GetPlayAreaBorderThickness(GameObject playArea)
64+
public override float GetPlayAreaBorderThickness()
6765
{
6866
return 0.1f;
6967
}
7068

7169
/// <summary>
7270
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
7371
/// </summary>
74-
/// <param name="playArea">The GameObject containing the play area representation.</param>
7572
/// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
76-
public override bool IsPlayAreaSizeCalibrated(GameObject playArea)
73+
public override bool IsPlayAreaSizeCalibrated()
7774
{
7875
return true;
7976
}

Assets/VRTK/SDK/Fallback/SDK_FallbackBoundaries.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,26 @@ public override Transform GetPlayArea()
3131
/// <summary>
3232
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
3333
/// </summary>
34-
/// <param name="playArea">The GameObject containing the play area representation.</param>
3534
/// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
36-
public override Vector3[] GetPlayAreaVertices(GameObject playArea)
35+
public override Vector3[] GetPlayAreaVertices()
3736
{
3837
return null;
3938
}
4039

4140
/// <summary>
4241
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
4342
/// </summary>
44-
/// <param name="playArea">The GameObject containing the play area representation.</param>
4543
/// <returns>The thickness of the drawn border.</returns>
46-
public override float GetPlayAreaBorderThickness(GameObject playArea)
44+
public override float GetPlayAreaBorderThickness()
4745
{
4846
return 0f;
4947
}
5048

5149
/// <summary>
5250
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
5351
/// </summary>
54-
/// <param name="playArea">The GameObject containing the play area representation.</param>
5552
/// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
56-
public override bool IsPlayAreaSizeCalibrated(GameObject playArea)
53+
public override bool IsPlayAreaSizeCalibrated()
5754
{
5855
return false;
5956
}

Assets/VRTK/SDK/Oculus/SDK_OculusBoundaries.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,8 @@ public override Transform GetPlayArea()
4949
/// <summary>
5050
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
5151
/// </summary>
52-
/// <param name="playArea">The GameObject containing the play area representation.</param>
5352
/// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
54-
public override Vector3[] GetPlayAreaVertices(GameObject playArea)
53+
public override Vector3[] GetPlayAreaVertices()
5554
{
5655
var area = new OVRBoundary();
5756
if (area.GetConfigured())
@@ -79,19 +78,17 @@ public override Vector3[] GetPlayAreaVertices(GameObject playArea)
7978
/// <summary>
8079
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
8180
/// </summary>
82-
/// <param name="playArea">The GameObject containing the play area representation.</param>
8381
/// <returns>The thickness of the drawn border.</returns>
84-
public override float GetPlayAreaBorderThickness(GameObject playArea)
82+
public override float GetPlayAreaBorderThickness()
8583
{
8684
return 0.1f;
8785
}
8886

8987
/// <summary>
9088
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
9189
/// </summary>
92-
/// <param name="playArea">The GameObject containing the play area representation.</param>
9390
/// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
94-
public override bool IsPlayAreaSizeCalibrated(GameObject playArea)
91+
public override bool IsPlayAreaSizeCalibrated()
9592
{
9693
return true;
9794
}

Assets/VRTK/SDK/Simulator/SDK_SimBoundaries.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ public override Transform GetPlayArea()
3939
/// <summary>
4040
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
4141
/// </summary>
42-
/// <param name="playArea">The GameObject containing the play area representation.</param>
4342
/// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
44-
public override Vector3[] GetPlayAreaVertices(GameObject playArea)
43+
public override Vector3[] GetPlayAreaVertices()
4544
{
4645
float inner = 0.9f;
4746
float outer = 1f;
@@ -63,19 +62,17 @@ public override Vector3[] GetPlayAreaVertices(GameObject playArea)
6362
/// <summary>
6463
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
6564
/// </summary>
66-
/// <param name="playArea">The GameObject containing the play area representation.</param>
6765
/// <returns>The thickness of the drawn border.</returns>
68-
public override float GetPlayAreaBorderThickness(GameObject playArea)
66+
public override float GetPlayAreaBorderThickness()
6967
{
7068
return 0.1f;
7169
}
7270

7371
/// <summary>
7472
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
7573
/// </summary>
76-
/// <param name="playArea">The GameObject containing the play area representation.</param>
7774
/// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
78-
public override bool IsPlayAreaSizeCalibrated(GameObject playArea)
75+
public override bool IsPlayAreaSizeCalibrated()
7976
{
8077
return true;
8178
}

Assets/VRTK/SDK/SteamVR/SDK_SteamVRBoundaries.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ public override Transform GetPlayArea()
6060
/// <summary>
6161
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
6262
/// </summary>
63-
/// <param name="playArea">The GameObject containing the play area representation.</param>
6463
/// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
65-
public override Vector3[] GetPlayAreaVertices(GameObject playArea)
64+
public override Vector3[] GetPlayAreaVertices()
6665
{
6766
SteamVR_PlayArea area = GetCachedSteamVRPlayArea();
6867
if (area != null)
@@ -75,9 +74,8 @@ public override Vector3[] GetPlayAreaVertices(GameObject playArea)
7574
/// <summary>
7675
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
7776
/// </summary>
78-
/// <param name="playArea">The GameObject containing the play area representation.</param>
7977
/// <returns>The thickness of the drawn border.</returns>
80-
public override float GetPlayAreaBorderThickness(GameObject playArea)
78+
public override float GetPlayAreaBorderThickness()
8179
{
8280
SteamVR_PlayArea area = GetCachedSteamVRPlayArea();
8381
if (area != null)
@@ -90,9 +88,8 @@ public override float GetPlayAreaBorderThickness(GameObject playArea)
9088
/// <summary>
9189
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
9290
/// </summary>
93-
/// <param name="playArea">The GameObject containing the play area representation.</param>
9491
/// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
95-
public override bool IsPlayAreaSizeCalibrated(GameObject playArea)
92+
public override bool IsPlayAreaSizeCalibrated()
9693
{
9794
SteamVR_PlayArea area = GetCachedSteamVRPlayArea();
9895
return (area != null && area.size == SteamVR_PlayArea.Size.Calibrated);
@@ -139,7 +136,7 @@ protected virtual SteamVR_PlayArea GetCachedSteamVRPlayArea()
139136
protected virtual Vector3[] ProcessVertices(Vector3[] vertices)
140137
{
141138
//If there aren't enough vertices or the play area is calibrated then just return
142-
if (vertices.Length < 8 || IsPlayAreaSizeCalibrated(null))
139+
if (vertices.Length < 8 || IsPlayAreaSizeCalibrated())
143140
{
144141
return vertices;
145142
}

Assets/VRTK/SDK/VRTK_SDK_Bridge.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -527,19 +527,19 @@ public static Transform GetPlayArea()
527527
return GetBoundariesSDK().GetPlayArea();
528528
}
529529

530-
public static Vector3[] GetPlayAreaVertices(GameObject playArea)
530+
public static Vector3[] GetPlayAreaVertices()
531531
{
532-
return GetBoundariesSDK().GetPlayAreaVertices(playArea);
532+
return GetBoundariesSDK().GetPlayAreaVertices();
533533
}
534534

535-
public static float GetPlayAreaBorderThickness(GameObject playArea)
535+
public static float GetPlayAreaBorderThickness()
536536
{
537-
return GetBoundariesSDK().GetPlayAreaBorderThickness(playArea);
537+
return GetBoundariesSDK().GetPlayAreaBorderThickness();
538538
}
539539

540-
public static bool IsPlayAreaSizeCalibrated(GameObject playArea)
540+
public static bool IsPlayAreaSizeCalibrated()
541541
{
542-
return GetBoundariesSDK().IsPlayAreaSizeCalibrated(playArea);
542+
return GetBoundariesSDK().IsPlayAreaSizeCalibrated();
543543
}
544544

545545
public static bool GetDrawAtRuntime()

Assets/VRTK/SDK/Ximmerse/SDK_XimmerseBoundaries.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,10 @@ public override Transform GetPlayArea()
4848
/// <summary>
4949
/// The GetPlayAreaVertices method returns the points of the play area boundaries.
5050
/// </summary>
51-
/// <param name="playArea">The GameObject containing the play area representation.</param>
5251
/// <returns>A Vector3 array of the points in the scene that represent the play area boundaries.</returns>
53-
public override Vector3[] GetPlayAreaVertices(GameObject playArea)
52+
public override Vector3[] GetPlayAreaVertices()
5453
{
55-
var area = playArea.GetComponentInChildren<PlayAreaRenderer>();
54+
var area = GetPlayArea().GetComponentInChildren<PlayAreaRenderer>();
5655
if (area)
5756
{
5857
return area.corners;
@@ -63,11 +62,10 @@ public override Vector3[] GetPlayAreaVertices(GameObject playArea)
6362
/// <summary>
6463
/// The GetPlayAreaBorderThickness returns the thickness of the drawn border for the given play area.
6564
/// </summary>
66-
/// <param name="playArea">The GameObject containing the play area representation.</param>
6765
/// <returns>The thickness of the drawn border.</returns>
68-
public override float GetPlayAreaBorderThickness(GameObject playArea)
66+
public override float GetPlayAreaBorderThickness()
6967
{
70-
var area = playArea.GetComponentInChildren<PlayAreaRenderer>();
68+
var area = GetPlayArea().GetComponentInChildren<PlayAreaRenderer>();
7169
if (area)
7270
{
7371
return area.borderThickness;
@@ -78,9 +76,8 @@ public override float GetPlayAreaBorderThickness(GameObject playArea)
7876
/// <summary>
7977
/// The IsPlayAreaSizeCalibrated method returns whether the given play area size has been auto calibrated by external sensors.
8078
/// </summary>
81-
/// <param name="playArea">The GameObject containing the play area representation.</param>
8279
/// <returns>Returns true if the play area size has been auto calibrated and set by external sensors.</returns>
83-
public override bool IsPlayAreaSizeCalibrated(GameObject playArea)
80+
public override bool IsPlayAreaSizeCalibrated()
8481
{
8582
return true;
8683
}

Assets/VRTK/Scripts/Internal/VRTK_RoomExtender_PlayAreaGizmo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ protected virtual void DrawWireframe()
5656
return;
5757
}
5858

59-
var vertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);
59+
var vertices = VRTK_SDK_Bridge.GetPlayAreaVertices();
6060
if (vertices == null || vertices.Length == 0)
6161
{
6262
return;

Assets/VRTK/Scripts/Pointers/VRTK_PlayAreaCursor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ protected virtual void InitPlayAreaCursor()
232232
return;
233233
}
234234

235-
Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices(playArea.gameObject);
235+
Vector3[] cursorDrawVertices = VRTK_SDK_Bridge.GetPlayAreaVertices();
236236
if (validLocationObject != null)
237237
{
238238
GeneratePlayAreaCursorFromPrefab(cursorDrawVertices);
@@ -323,7 +323,7 @@ protected virtual void GeneratePlayAreaCursor(Vector3[] cursorDrawVertices)
323323
{
324324
if (playAreaCursorDimensions != Vector2.zero)
325325
{
326-
var customAreaPadding = VRTK_SDK_Bridge.GetPlayAreaBorderThickness(playArea.gameObject);
326+
var customAreaPadding = VRTK_SDK_Bridge.GetPlayAreaBorderThickness();
327327

328328
cursorDrawVertices[btmRightOuter] = new Vector3(playAreaCursorDimensions.x / 2, 0f, (playAreaCursorDimensions.y / 2) * -1);
329329
cursorDrawVertices[btmLeftOuter] = new Vector3((playAreaCursorDimensions.x / 2) * -1, 0f, (playAreaCursorDimensions.y / 2) * -1);

0 commit comments

Comments
 (0)