Skip to content

Commit 3d38c91

Browse files
author
David Kline (ANALOG)
committed
add boundary sdk, move system from core, update example
1 parent a71604c commit 3d38c91

File tree

18 files changed

+356
-67
lines changed

18 files changed

+356
-67
lines changed

Assets/MixedRealityToolkit-Examples/Demos/Boundary/Scenes/BoundaryVisualization.unity

Lines changed: 181 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,80 @@ MeshFilter:
299299
m_PrefabInternal: {fileID: 0}
300300
m_GameObject: {fileID: 178275556}
301301
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
302+
--- !u!1 &197794320
303+
GameObject:
304+
m_ObjectHideFlags: 0
305+
m_PrefabParentObject: {fileID: 0}
306+
m_PrefabInternal: {fileID: 0}
307+
serializedVersion: 5
308+
m_Component:
309+
- component: {fileID: 197794321}
310+
- component: {fileID: 197794323}
311+
- component: {fileID: 197794322}
312+
m_Layer: 5
313+
m_Name: Subtitle (4)
314+
m_TagString: Untagged
315+
m_Icon: {fileID: 0}
316+
m_NavMeshLayer: 0
317+
m_StaticEditorFlags: 0
318+
m_IsActive: 1
319+
--- !u!224 &197794321
320+
RectTransform:
321+
m_ObjectHideFlags: 0
322+
m_PrefabParentObject: {fileID: 0}
323+
m_PrefabInternal: {fileID: 0}
324+
m_GameObject: {fileID: 197794320}
325+
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
326+
m_LocalPosition: {x: 0, y: 0, z: 1.3334941}
327+
m_LocalScale: {x: 0.00049999997, y: 0.00049999997, z: 0.00049999997}
328+
m_Children: []
329+
m_Father: {fileID: 424705611}
330+
m_RootOrder: 10
331+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
332+
m_AnchorMin: {x: 0.5, y: 0.5}
333+
m_AnchorMax: {x: 0.5, y: 0.5}
334+
m_AnchoredPosition: {x: -512.5875, y: -323.0831}
335+
m_SizeDelta: {x: 1107.8, y: 89.1924}
336+
m_Pivot: {x: 0.5, y: 0.5}
337+
--- !u!114 &197794322
338+
MonoBehaviour:
339+
m_ObjectHideFlags: 0
340+
m_PrefabParentObject: {fileID: 0}
341+
m_PrefabInternal: {fileID: 0}
342+
m_GameObject: {fileID: 197794320}
343+
m_Enabled: 1
344+
m_EditorHideFlags: 0
345+
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
346+
m_Name:
347+
m_EditorClassIdentifier:
348+
m_Material: {fileID: 0}
349+
m_Color: {r: 1, g: 1, b: 1, a: 1}
350+
m_RaycastTarget: 1
351+
m_OnCullStateChanged:
352+
m_PersistentCalls:
353+
m_Calls: []
354+
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
355+
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
356+
m_FontData:
357+
m_Font: {fileID: 12800000, guid: e3d8348b7d66bae4aa4b1f3ada3ef5fd, type: 3}
358+
m_FontSize: 40
359+
m_FontStyle: 0
360+
m_BestFit: 0
361+
m_MinSize: 4
362+
m_MaxSize: 101
363+
m_Alignment: 0
364+
m_AlignByGeometry: 0
365+
m_RichText: 1
366+
m_HorizontalOverflow: 0
367+
m_VerticalOverflow: 0
368+
m_LineSpacing: 1
369+
m_Text: VisualizePlayArea.cs
370+
--- !u!222 &197794323
371+
CanvasRenderer:
372+
m_ObjectHideFlags: 0
373+
m_PrefabParentObject: {fileID: 0}
374+
m_PrefabInternal: {fileID: 0}
375+
m_GameObject: {fileID: 197794320}
302376
--- !u!1 &291475168
303377
GameObject:
304378
m_ObjectHideFlags: 0
@@ -362,7 +436,7 @@ RectTransform:
362436
m_AnchorMin: {x: 0.5, y: 0.5}
363437
m_AnchorMax: {x: 0.5, y: 0.5}
364438
m_AnchoredPosition: {x: -512.42847, y: -322.63422}
365-
m_SizeDelta: {x: 471.4, y: 140.6}
439+
m_SizeDelta: {x: 480.4, y: 140.6}
366440
m_Pivot: {x: 0.5, y: 0.5}
367441
--- !u!114 &337857533
368442
MonoBehaviour:
@@ -396,7 +470,9 @@ MonoBehaviour:
396470
m_HorizontalOverflow: 0
397471
m_VerticalOverflow: 0
398472
m_LineSpacing: 1
399-
m_Text: Immersive headset
473+
m_Text: 'Windows Mixed Reality Immersive
474+
475+
OpenVR'
400476
--- !u!222 &337857534
401477
CanvasRenderer:
402478
m_ObjectHideFlags: 0
@@ -412,6 +488,7 @@ GameObject:
412488
m_Component:
413489
- component: {fileID: 353698135}
414490
- component: {fileID: 353698136}
491+
- component: {fileID: 353698137}
415492
m_Layer: 0
416493
m_Name: BoundaryVisualizer
417494
m_TagString: Untagged
@@ -447,6 +524,19 @@ MonoBehaviour:
447524
outOfBoundsMaterial: {fileID: 2100000, guid: 360c90aa3bc85c9438a05d511deb80ae, type: 2}
448525
inscribedRectangleMaterial: {fileID: 2100000, guid: 693646fbd4009244e9cc6a4cd5b72585,
449526
type: 2}
527+
--- !u!114 &353698137
528+
MonoBehaviour:
529+
m_ObjectHideFlags: 0
530+
m_PrefabParentObject: {fileID: 0}
531+
m_PrefabInternal: {fileID: 0}
532+
m_GameObject: {fileID: 353698134}
533+
m_Enabled: 1
534+
m_EditorHideFlags: 0
535+
m_Script: {fileID: 11500000, guid: 3bfc11696910c3a4a95bec35024e1ce0, type: 3}
536+
m_Name:
537+
m_EditorClassIdentifier:
538+
playAreaMaterial: {fileID: 2100000, guid: 693646fbd4009244e9cc6a4cd5b72585, type: 2}
539+
isPlayAreaVisualized: 1
450540
--- !u!1 &380504073
451541
GameObject:
452542
m_ObjectHideFlags: 0
@@ -558,6 +648,8 @@ RectTransform:
558648
- {fileID: 863370469}
559649
- {fileID: 1392119481}
560650
- {fileID: 711576058}
651+
- {fileID: 1260035424}
652+
- {fileID: 197794321}
561653
m_Father: {fileID: 291475169}
562654
m_RootOrder: 0
563655
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@@ -655,7 +747,7 @@ RectTransform:
655747
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
656748
m_AnchorMin: {x: 0.5, y: 0.5}
657749
m_AnchorMax: {x: 0.5, y: 0.5}
658-
m_AnchoredPosition: {x: -512.5875, y: -323.11316}
750+
m_AnchoredPosition: {x: -512.5875, y: -322.96317}
659751
m_SizeDelta: {x: 1107.8, y: 89.1924}
660752
m_Pivot: {x: 0.5, y: 0.5}
661753
--- !u!114 &711576059
@@ -690,7 +782,7 @@ MonoBehaviour:
690782
m_HorizontalOverflow: 0
691783
m_VerticalOverflow: 0
692784
m_LineSpacing: 1
693-
m_Text: Purple Rectangle and Spheres
785+
m_Text: ' Purple'
694786
--- !u!222 &711576060
695787
CanvasRenderer:
696788
m_ObjectHideFlags: 0
@@ -830,7 +922,7 @@ RectTransform:
830922
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
831923
m_AnchorMin: {x: 0.5, y: 0.5}
832924
m_AnchorMax: {x: 0.5, y: 0.5}
833-
m_AnchoredPosition: {x: -512.5875, y: -322.868}
925+
m_AnchoredPosition: {x: -512.5875, y: -322.81595}
834926
m_SizeDelta: {x: 1107.8, y: 89.1924}
835927
m_Pivot: {x: 0.5, y: 0.5}
836928
--- !u!114 &863370470
@@ -865,7 +957,7 @@ MonoBehaviour:
865957
m_HorizontalOverflow: 0
866958
m_VerticalOverflow: 0
867959
m_LineSpacing: 1
868-
m_Text: White Spheres
960+
m_Text: BoundaryVisualizationDemo.cs
869961
--- !u!222 &863370471
870962
CanvasRenderer:
871963
m_ObjectHideFlags: 0
@@ -932,6 +1024,80 @@ Transform:
9321024
m_Father: {fileID: 0}
9331025
m_RootOrder: 3
9341026
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1027+
--- !u!1 &1260035423
1028+
GameObject:
1029+
m_ObjectHideFlags: 0
1030+
m_PrefabParentObject: {fileID: 0}
1031+
m_PrefabInternal: {fileID: 0}
1032+
serializedVersion: 5
1033+
m_Component:
1034+
- component: {fileID: 1260035424}
1035+
- component: {fileID: 1260035426}
1036+
- component: {fileID: 1260035425}
1037+
m_Layer: 5
1038+
m_Name: Subtitle (3)
1039+
m_TagString: Untagged
1040+
m_Icon: {fileID: 0}
1041+
m_NavMeshLayer: 0
1042+
m_StaticEditorFlags: 0
1043+
m_IsActive: 1
1044+
--- !u!224 &1260035424
1045+
RectTransform:
1046+
m_ObjectHideFlags: 0
1047+
m_PrefabParentObject: {fileID: 0}
1048+
m_PrefabInternal: {fileID: 0}
1049+
m_GameObject: {fileID: 1260035423}
1050+
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
1051+
m_LocalPosition: {x: 0, y: 0, z: 1.3334941}
1052+
m_LocalScale: {x: 0.00049999997, y: 0.00049999997, z: 0.00049999997}
1053+
m_Children: []
1054+
m_Father: {fileID: 424705611}
1055+
m_RootOrder: 9
1056+
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
1057+
m_AnchorMin: {x: 0.5, y: 0.5}
1058+
m_AnchorMax: {x: 0.5, y: 0.5}
1059+
m_AnchoredPosition: {x: -512.5875, y: -323.02515}
1060+
m_SizeDelta: {x: 1107.8, y: 89.1924}
1061+
m_Pivot: {x: 0.5, y: 0.5}
1062+
--- !u!114 &1260035425
1063+
MonoBehaviour:
1064+
m_ObjectHideFlags: 0
1065+
m_PrefabParentObject: {fileID: 0}
1066+
m_PrefabInternal: {fileID: 0}
1067+
m_GameObject: {fileID: 1260035423}
1068+
m_Enabled: 1
1069+
m_EditorHideFlags: 0
1070+
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
1071+
m_Name:
1072+
m_EditorClassIdentifier:
1073+
m_Material: {fileID: 0}
1074+
m_Color: {r: 1, g: 1, b: 1, a: 1}
1075+
m_RaycastTarget: 1
1076+
m_OnCullStateChanged:
1077+
m_PersistentCalls:
1078+
m_Calls: []
1079+
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
1080+
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
1081+
m_FontData:
1082+
m_Font: {fileID: 12800000, guid: e3d8348b7d66bae4aa4b1f3ada3ef5fd, type: 3}
1083+
m_FontSize: 40
1084+
m_FontStyle: 0
1085+
m_BestFit: 0
1086+
m_MinSize: 4
1087+
m_MaxSize: 101
1088+
m_Alignment: 0
1089+
m_AlignByGeometry: 0
1090+
m_RichText: 1
1091+
m_HorizontalOverflow: 0
1092+
m_VerticalOverflow: 0
1093+
m_LineSpacing: 1
1094+
m_Text: ' White'
1095+
--- !u!222 &1260035426
1096+
CanvasRenderer:
1097+
m_ObjectHideFlags: 0
1098+
m_PrefabParentObject: {fileID: 0}
1099+
m_PrefabInternal: {fileID: 0}
1100+
m_GameObject: {fileID: 1260035423}
9351101
--- !u!1 &1289414259
9361102
GameObject:
9371103
m_ObjectHideFlags: 0
@@ -993,7 +1159,7 @@ RectTransform:
9931159
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
9941160
m_AnchorMin: {x: 0.5, y: 0.5}
9951161
m_AnchorMax: {x: 0.5, y: 0.5}
996-
m_AnchoredPosition: {x: -512.5875, y: -322.99188}
1162+
m_AnchoredPosition: {x: -512.5875, y: -322.89987}
9971163
m_SizeDelta: {x: 1107.8, y: 89.1924}
9981164
m_Pivot: {x: 0.5, y: 0.5}
9991165
--- !u!114 &1392119482
@@ -1028,7 +1194,7 @@ MonoBehaviour:
10281194
m_HorizontalOverflow: 0
10291195
m_VerticalOverflow: 0
10301196
m_LineSpacing: 1
1031-
m_Text: Cyan Spheres
1197+
m_Text: ' Cyan'
10321198
--- !u!222 &1392119483
10331199
CanvasRenderer:
10341200
m_ObjectHideFlags: 0
@@ -1494,29 +1660,13 @@ MonoBehaviour:
14941660
m_HorizontalOverflow: 0
14951661
m_VerticalOverflow: 0
14961662
m_LineSpacing: 1
1497-
m_Text: 'This scene demonstrates visualizing the boundary geometry and a rectangular
1498-
playspace inscribed within those bounds.
1499-
1500-
1501-
1502-
1503-
1504-
1505-
The area outside of the boundary geometry.
1506-
1507-
1508-
1509-
1510-
1511-
1512-
The area within the boundary geometry (aka TrackedArea).
1513-
1514-
1515-
1516-
1517-
1518-
1519-
The area within the inscribed rectangle (aka PlayArea).'
1663+
m_Text: "This scene demonstrates visualizing the boundary geometry and a rectangular
1664+
play area inscribed within those bounds.\n\n\nDisplays spheres that indicate areas
1665+
within and outside of the boundary geometry.\n\n\n The area within the boundary
1666+
geometry (aka TrackedArea).\n\n\n The area within the inscribed rectangle
1667+
(aka PlayArea).\n\n\n The area outside of the boundary geometry.\n\n\nVisualizes
1668+
the inscribed rectangular play area. This visualization can be toggled on and
1669+
off in the inspector and via script.\n\n\n"
15201670
--- !u!222 &1906982568
15211671
CanvasRenderer:
15221672
m_ObjectHideFlags: 0

Assets/MixedRealityToolkit-Examples/Demos/Boundary/Scripts/BoundaryVisualizationDemo.cs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ public class BoundaryVisualizationDemo : MonoBehaviour
2929
private Material outOfBoundsMaterial = null;
3030

3131
/// <summary>
32-
/// The material used to display the inscribed rectangle and the indicators that are within it.
32+
/// The material used to display the indicators that are within the inscribed rectangle..
3333
/// </summary>
3434
[SerializeField]
35-
[Tooltip("Material used to display the inscribed rectangle and the indicators that are within it.")]
35+
[Tooltip("Material used to display the indicators that are within the inscribed rectangle.")]
3636
private Material inscribedRectangleMaterial = null;
3737

3838
/// <summary>
@@ -45,39 +45,10 @@ private void Start()
4545
{
4646
if (MixedRealityManager.HasActiveProfile && MixedRealityManager.Instance.ActiveProfile.IsBoundarySystemEnabled)
4747
{
48-
AddQuad();
4948
AddIndicators();
5049
}
5150
}
5251

53-
/// <summary>
54-
/// Displays the boundary as a quad primitive.
55-
/// </summary>
56-
private void AddQuad()
57-
{
58-
// Get the rectangular bounds.
59-
Vector2 center;
60-
float angle;
61-
float width;
62-
float height;
63-
if ((BoundaryManager == null) || !BoundaryManager.TryGetRectangularBoundsParams(out center, out angle, out width, out height))
64-
{
65-
// No rectangular bounds, therefore do not render the quad.
66-
return;
67-
}
68-
69-
// Render the rectangular bounds.
70-
if (EdgeUtilities.IsValidPoint(center))
71-
{
72-
GameObject quad = GameObject.CreatePrimitive(PrimitiveType.Quad);
73-
quad.transform.SetParent(transform);
74-
quad.transform.Translate(new Vector3(center.x, 0.005f, center.y)); // Add fudge factor to avoid z-fighting
75-
quad.transform.Rotate(new Vector3(90, -angle, 0));
76-
quad.transform.localScale = new Vector3(width, height, 1.0f);
77-
quad.GetComponent<Renderer>().sharedMaterial = inscribedRectangleMaterial;
78-
}
79-
}
80-
8152
/// <summary>
8253
/// Displays the boundary as an array of spheres where spheres in the
8354
/// bounds are a different color.

Assets/MixedRealityToolkit-Examples/Demos/Boundary/Scripts/BoundaryVisualizationDemo.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit/Boundary.meta renamed to Assets/MixedRealityToolkit-SDK/Features/Boundary.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit-SDK/Features/Boundary/Components.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)