Skip to content

Commit 5b39f22

Browse files
author
von Horstig Carl
committed
Adapting SpatialMappingObserver as lined out in Issue #557
1 parent 2139e99 commit 5b39f22

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

Assets/HoloToolkit/SpatialMapping/Scripts/SpatialMappingObserver.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ public class SpatialMappingObserver : SpatialMappingSource
3939
[Tooltip("How long to wait (in sec) between Spatial Mapping updates.")]
4040
public float TimeBetweenUpdates = 3.5f;
4141

42+
/// <summary>
43+
/// The origin of the observation volume.
44+
/// </summary>
45+
private Vector3 origin = Vector3.zero;
46+
4247
/// <summary>
4348
/// Indicates the current state of the Surface Observer.
4449
/// </summary>
@@ -239,6 +244,35 @@ public bool SetObserverOrigin(Vector3 origin)
239244
return originUpdated;
240245
}
241246

247+
/// <summary>
248+
/// Can be called to override the default extents as an axis aligned box for the observed volume. Can only be called while observer has been started.
249+
/// </summary>
250+
public bool SetObserverExtentsAxisAligned(Vector3 extents)
251+
{
252+
bool extentsUpdated = false;
253+
if (observer != null)
254+
{
255+
observer.SetVolumeAsAxisAlignedBox(origin, extents);
256+
Extents = extents;
257+
extentsUpdated = true;
258+
}
259+
return extentsUpdated;
260+
}
261+
262+
/// <summary>
263+
/// Can be called to override the default extents as an oriented box for the observed volume. Can only be called while observer has been started.
264+
/// </summary>
265+
public bool SetObserverExtentsOrientedBox(Vector3 extents, Quaternion orientation)
266+
{
267+
bool extentsUpdated = false;
268+
if (observer != null)
269+
{
270+
observer.SetVolumeAsOrientedBox(origin, extents, orientation);
271+
extentsUpdated = true;
272+
}
273+
return extentsUpdated;
274+
}
275+
242276
/// <summary>
243277
/// Handles the SurfaceObserver's OnDataReady event.
244278
/// </summary>

0 commit comments

Comments
 (0)