Class BaseSpatialObserver
Class providing a base implementation of the IMixedRealitySpatialAwarenessObserver interface.
Inheritance
Implements
Inherited Members
Namespace: Microsoft.MixedReality.Toolkit.SpatialAwareness
Assembly: cs.temp.dll.dll
Syntax
public abstract class BaseSpatialObserver : BaseDataProvider<IMixedRealitySpatialAwarenessSystem>, IMixedRealitySpatialAwarenessObserver, IMixedRealityDataProvider, IMixedRealityService, IDisposable, IMixedRealityEventSource, IEqualityComparer
Constructors
BaseSpatialObserver(IMixedRealityServiceRegistrar, IMixedRealitySpatialAwarenessSystem, String, UInt32, BaseMixedRealityProfile)
Constructor.
Declaration
[Obsolete("This constructor is obsolete (registrar parameter is no longer required) and will be removed in a future version of the Microsoft Mixed Reality Toolkit.")]
protected BaseSpatialObserver(IMixedRealityServiceRegistrar registrar, IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem, string name = null, uint priority = 10U, BaseMixedRealityProfile profile = null)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealityServiceRegistrar | registrar | The IMixedRealityServiceRegistrar instance that loaded the observer. |
IMixedRealitySpatialAwarenessSystem | spatialAwarenessSystem | The IMixedRealitySpatialAwarenessSystem to which the observer is providing data. |
String | name | The friendly name of the data provider. |
UInt32 | priority | The registration priority of the data provider. |
BaseMixedRealityProfile | profile | The configuration profile for the data provider. |
BaseSpatialObserver(IMixedRealitySpatialAwarenessSystem, String, UInt32, BaseMixedRealityProfile)
Constructor.
Declaration
protected BaseSpatialObserver(IMixedRealitySpatialAwarenessSystem spatialAwarenessSystem, string name = null, uint priority = 10U, BaseMixedRealityProfile profile = null)
Parameters
Type | Name | Description |
---|---|---|
IMixedRealitySpatialAwarenessSystem | spatialAwarenessSystem | The IMixedRealitySpatialAwarenessSystem to which the observer is providing data. |
String | name | The friendly name of the data provider. |
UInt32 | priority | The registration priority of the data provider. |
BaseMixedRealityProfile | profile | The configuration profile for the data provider. |
Fields
DefaultSpatialAwarenessLayer
Default dedicated layer for spatial awareness layer used by most components in MRTK
Declaration
public const int DefaultSpatialAwarenessLayer = 31
Field Value
Type | Description |
---|---|
Int32 |
Properties
DefaultPhysicsLayer
Get or sets the default Unity Physics Layer on which to set the spatial object.
Declaration
public int DefaultPhysicsLayer { get; }
Property Value
Type | Description |
---|---|
Int32 |
IsRunning
Is the observer running (actively accumulating spatial data)?
Declaration
public bool IsRunning { get; protected set; }
Property Value
Type | Description |
---|---|
Boolean |
IsStationaryObserver
Should the observer remain stationary in the scene?
Declaration
public bool IsStationaryObserver { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
Set IsStationaryObserver to false to move the volume with the user. If set to true, the origin will be 0,0,0 or the last known location.
ObservationExtents
Gets or sets the extents( 1/2 size) of the volume, in meters per axis, from which individual observations will be made.
Declaration
public Vector3 ObservationExtents { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
Remarks
When used when ObserverVolumeType is set to Sphere. The X value of the extents will be used as the radius.
ObserverOrigin
Declaration
public Vector3 ObserverOrigin { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
ObserverRotation
Gets or sets the orientation of the volume in World Space.
Declaration
public Quaternion ObserverRotation { get; set; }
Property Value
Type | Description |
---|---|
Quaternion |
Remarks
This is only used when ObserverVolumeType is set to UserAlignedCube
ObserverVolumeType
Gets or sets the type of volume the observer should operate in.
Declaration
public VolumeType ObserverVolumeType { get; set; }
Property Value
Type | Description |
---|---|
VolumeType |
SourceId
The unique source id of this event source.
Declaration
public uint SourceId { get; }
Property Value
Type | Description |
---|---|
UInt32 |
SourceName
The name of this event source.
Declaration
public string SourceName { get; }
Property Value
Type | Description |
---|---|
String |
SpatialAwarenessSystem
The spatial awareness system that is associated with this observer.
Declaration
protected IMixedRealitySpatialAwarenessSystem SpatialAwarenessSystem { get; }
Property Value
Type | Description |
---|---|
IMixedRealitySpatialAwarenessSystem |
StartupBehavior
Indicates the developer's intended startup behavior.
Declaration
public AutoStartBehavior StartupBehavior { get; set; }
Property Value
Type | Description |
---|---|
AutoStartBehavior |
UpdateInterval
Gets or sets the frequency, in seconds, at which the spatial observer should update.
Declaration
public float UpdateInterval { get; set; }
Property Value
Type | Description |
---|---|
Single |
Methods
CleanupObserver()
Ensures that the spatial observer has been stopped and destroyed.
Declaration
protected virtual void CleanupObserver()
ClearObservations()
Clears the observer's collection of observations.
Declaration
public virtual void ClearObservations()
Remarks
If the observer is currently running, calling ClearObservations will suspend it.
CreateObserver()
Creates the spatial observer and handles the desired startup behavior.
Declaration
protected virtual void CreateObserver()
Destroy()
Optional Destroy function to perform cleanup of the service before the Mixed Reality Toolkit is destroyed.
Declaration
public override void Destroy()
Overrides
Disable()
Optional Disable function to pause the service.
Declaration
public override void Disable()
Overrides
Dispose(Boolean)
Cleanup resources used by the object
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | Are we fully disposing the object? True will release all managed resources, unmanaged resources are always released. |
Overrides
Enable()
Optional Enable function to enable / re-enable the service.
Declaration
public override void Enable()
Overrides
Equals(Object)
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Boolean |
Overrides
GetHashCode()
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
Int32 |
Overrides
GetHashCode(Object)
Declaration
public int GetHashCode(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj |
Returns
Type | Description |
---|---|
Int32 |
Initialize()
Creates the observer.
Declaration
public override void Initialize()
Overrides
Reset()
Suspends the observer, clears observations, cleans up the observer, then re-initializes.
Declaration
public override void Reset()
Overrides
Resume()
Start | resume the observer.
Declaration
public virtual void Resume()
Suspend()
Stop | pause the observer
Declaration
public virtual void Suspend()