@@ -24,28 +24,27 @@ public enum ObserverStates
2424 Stopped = 1
2525 }
2626
27- /// <summary>
28- /// Spatial Mapping Volume Type
29- /// </summary>
30- public enum ObserverVolumeTypes
31- {
32- /// <summary>
33- /// The observed volume is an axis aligned box.
34- /// </summary>
35- AxisAlignedBox = 0 ,
36-
37- /// <summary>
38- /// The observed volume is an oriented box.
39- /// </summary>
40- OrientedBox = 1 ,
41-
42- /// <summary>
43- /// The observed volume is a sphere.
44- /// </summary>
45- Sphere = 2
46- }
47-
48-
27+ /// <summary>
28+ /// Spatial Mapping Volume Type
29+ /// </summary>
30+ public enum ObserverVolumeTypes
31+ {
32+ /// <summary>
33+ /// The observed volume is an axis aligned box.
34+ /// </summary>
35+ AxisAlignedBox = 0 ,
36+
37+ /// <summary>
38+ /// The observed volume is an oriented box.
39+ /// </summary>
40+ OrientedBox = 1 ,
41+
42+ /// <summary>
43+ /// The observed volume is a sphere.
44+ /// </summary>
45+ Sphere = 2
46+ }
47+
4948 /// <summary>
5049 /// The SpatialMappingObserver class encapsulates the SurfaceObserver into an easy to use
5150 /// object that handles managing the observed surfaces and the rendering of surface geometry.
@@ -54,34 +53,34 @@ public class SpatialMappingObserver : SpatialMappingSource
5453 {
5554 [ Tooltip ( "The number of triangles to calculate per cubic meter." ) ]
5655 public float TrianglesPerCubicMeter = 500f ;
57-
56+
5857 [ Tooltip ( "How long to wait (in sec) between Spatial Mapping updates." ) ]
5958 public float TimeBetweenUpdates = 3.5f ;
6059
6160 /// <summary>
6261 /// Indicates the current state of the Surface Observer.
6362 /// </summary>
6463 public ObserverStates ObserverState { get ; private set ; }
65-
66- /// <summary>
67- /// Indicates the current type of the observed volume
68- /// </summary>
69- private ObserverVolumeTypes observerVolumeType = ObserverVolumeTypes . AxisAlignedBox ;
70- public ObserverVolumeTypes ObserverVolumeType
71- {
72- get
73- {
74- return observerVolumeType ;
75- }
76- set
77- {
78- if ( observerVolumeType != value )
79- {
80- observerVolumeType = value ;
81- SwitchObservedVolume ( ) ;
82- }
83- }
84- }
64+
65+ /// <summary>
66+ /// Indicates the current type of the observed volume
67+ /// </summary>
68+ private ObserverVolumeTypes observerVolumeType = ObserverVolumeTypes . AxisAlignedBox ;
69+ public ObserverVolumeTypes ObserverVolumeType
70+ {
71+ get
72+ {
73+ return observerVolumeType ;
74+ }
75+ set
76+ {
77+ if ( observerVolumeType != value )
78+ {
79+ observerVolumeType = value ;
80+ SwitchObservedVolume ( ) ;
81+ }
82+ }
83+ }
8584
8685 /// <summary>
8786 /// Our Surface Observer object for generating/updating Spatial Mapping data.
@@ -111,8 +110,8 @@ public ObserverVolumeTypes ObserverVolumeType
111110 /// Used to track when the Observer was last updated.
112111 /// </summary>
113112 private float updateTime ;
114-
115- [ Tooltip ( "The extents of the observation volume." ) ]
113+
114+ [ Tooltip ( "The extents of the observation volume." ) ]
116115 private Vector3 extents = Vector3 . one * 10.0f ;
117116 public Vector3 Extents
118117 {
@@ -122,58 +121,58 @@ public Vector3 Extents
122121 }
123122 set
124123 {
125- if ( extents != value )
126- {
127- extents = value ;
128- SwitchObservedVolume ( ) ;
129- }
124+ if ( extents != value )
125+ {
126+ extents = value ;
127+ SwitchObservedVolume ( ) ;
128+ }
130129 }
131130 }
132-
131+
133132 /// <summary>
134133 /// The origin of the observation volume.
135134 /// </summary>
136135 private Vector3 origin = Vector3 . zero ;
137- public Vector3 Origin
138- {
139- get
140- {
141- return origin ;
142- }
143- set
144- {
145- if ( origin != value )
146- {
147- origin = value ;
148- SwitchObservedVolume ( ) ;
149- }
150- }
151- }
152-
153- /// <summary>
154- /// The direction of the observed volume if an oriented box is choosen.
155- /// </summary>
156- private Quaternion orientation = Quaternion . identity ;
157- public Quaternion Orientation
158- {
159- get
160- {
161- return orientation ;
162- }
163- set
164- {
165- if ( orientation != value )
166- {
167- orientation = value ;
168- // Only needs to be changed if the corresponding mode is active.
169- if ( ObserverVolumeType == ObserverVolumeTypes . OrientedBox )
170- {
171- SwitchObservedVolume ( ) ;
172- }
173- }
174- }
175- }
176-
136+ public Vector3 Origin
137+ {
138+ get
139+ {
140+ return origin ;
141+ }
142+ set
143+ {
144+ if ( origin != value )
145+ {
146+ origin = value ;
147+ SwitchObservedVolume ( ) ;
148+ }
149+ }
150+ }
151+
152+ /// <summary>
153+ /// The direction of the observed volume if an oriented box is choosen.
154+ /// </summary>
155+ private Quaternion orientation = Quaternion . identity ;
156+ public Quaternion Orientation
157+ {
158+ get
159+ {
160+ return orientation ;
161+ }
162+ set
163+ {
164+ if ( orientation != value )
165+ {
166+ orientation = value ;
167+ // Only needs to be changed if the corresponding mode is active.
168+ if ( ObserverVolumeType == ObserverVolumeTypes . OrientedBox )
169+ {
170+ SwitchObservedVolume ( ) ;
171+ }
172+ }
173+ }
174+ }
175+
177176 protected override void Awake ( )
178177 {
179178 base . Awake ( ) ;
@@ -198,7 +197,7 @@ private void Update()
198197
199198 SurfaceObject newSurface ;
200199 WorldAnchor worldAnchor ;
201-
200+
202201 if ( spareSurfaceObject == null )
203202 {
204203 newSurface = CreateSurfaceObject (
@@ -326,28 +325,28 @@ public void CleanupObserver()
326325
327326 /// <summary>
328327 /// Can be called to override the default origin for the observed volume. Can only be called while observer has been started.
329- /// Kept for compatibility with Examples/SpatialUnderstanding
328+ /// Kept for compatibility with Examples/SpatialUnderstanding
330329 /// </summary>
331- public bool SetObserverOrigin ( Vector3 _origin )
330+ public bool SetObserverOrigin ( Vector3 origin )
332331 {
333332 bool originUpdated = false ;
334333
335334 if ( observer != null )
336335 {
337- Origin = _origin ;
336+ Origin = origin ;
338337 originUpdated = true ;
339338 }
340339
341340 return originUpdated ;
342341 }
343342
344- /// <summary>
345- /// Change the observed volume according to ObserverVolumeType.
346- /// </summary>
347- private void SwitchObservedVolume ( )
348- {
349- if ( observer != null )
350- {
343+ /// <summary>
344+ /// Change the observed volume according to ObserverVolumeType.
345+ /// </summary>
346+ private void SwitchObservedVolume ( )
347+ {
348+ if ( observer != null )
349+ {
351350 switch ( observerVolumeType )
352351 {
353352 case ObserverVolumeTypes . AxisAlignedBox :
@@ -363,8 +362,8 @@ private void SwitchObservedVolume()
363362 observer . SetVolumeAsAxisAlignedBox ( origin , extents ) ;
364363 break ;
365364 }
366- }
367- }
365+ }
366+ }
368367
369368 /// <summary>
370369 /// Handles the SurfaceObserver's OnDataReady event.
0 commit comments