Sensor Data
In the Spatial Experience SDK environment, the vehicle is moving through the virtual world based on real-world tracking and motion sensor data. It is important to understand how this data is accessed programmatically to drive custom gameplay, particle effects, loose object simulation, or UI readouts.
Accessing Sensor Data
The live sensor data is transmitted from our service to the Spatial Experience SDK at runtime.
To obtain these structured service values programmatically, the StateReceiver API is used:
var sensorState = StateReceiver.CurrentBackend.VehicleSensorState;
Additionally, a custom IStateReceiverLocalizationEventListener can be registered to receive notifications whenever new sensor data packets arrive from the service.
Vehicle Sensor State Structure
The vehicle sensor state data is structured as follows:
| Data | Type | Description |
|---|---|---|
| GeoCoordinate | GeoCoordinate | Latitude, longitude and altitude of the vehicle. |
| VehicleSpeed_Kmh | float | Vehicle speed in kilometers per hour. |
| VehicleHeading_Deg | double | Heading amount provided by the GPS in degrees. |
| YawRate_DegPerSec | double | Vehicle yaw rate in degrees/s. |
| LateralAcceleration_ms2 | float | Lateral (centrifugal) acceleration in m/s^2. |
| LongitudinalAcceleration_ms2 | float | Longitudinal acceleration in the vehicle in m/s^2 |
| VerticalAcceleration_ms2 | float | Vertical acceleration of the vehicle in m/s^2. |
| VehiclePitch_Deg | float | Vehicle pitch amount in degrees. |
| VehicleRoll_Deg | float | Vehicle roll amount in degrees. |
| LocalizationStatus | VehicleLocalizationStatus | The current LocalizationStatus. |