Sensor.ISensor
A Sensor that detects Sources and provides information about the reading of each.
Properties
forward
forward: Vector3
The world-space "forward" direction describing which direction the sensor is facing.
readings
readings: object
An observable used to get information about assocated ISources added with ISensor.addSource
{ /** * Start receiving updates about the current set of sources added to this sensor. * @param observer - the observer to receive sensor reading updates */ subscribe(observer: ISensorObserver): ISubscription; }
Methods
addSource
addSource(sources: Sensor.ISource[]): void
Add a source, to add its readings to the set of readings provided by .subscribe.
| Parameter | Type |
|---|---|
| sources | Sensor.ISource[] the sources to add to this sensor |
showDebug
showDebug(show: boolean): void
Show debug visuals for this sensor. Existing visuals are disposed.
| Parameter | Type |
|---|---|
| show | boolean whether to show or hide debug visuals |
subscribe
Start receiving updates when properties of this sensor change, e.g. origin or forward, not its readings.
Subscribe to readings to receive updates about associated ISources
| Parameter | Type |
|---|---|
| observer | IObserver<DataT> | ObserverCallback<DataT> |
Returns: ISubscription