Spatial Experience SDK API Reference
Welcome to the Spatial Experience SDK API Reference. The SDK provides a powerful, high-performance, and extensible Unity API designed to help developers create immersive, elastic in-car experiences that synchronize seamlessly with real-world vehicle motion, position, and map data.
Key Core APIs
1. Vehicle Sensor State & Tracking
The core tracking pipeline is managed by the StateReceiver class. Through it, developers can query the current VehicleSensorState to access real-time telemetry from the Spatial Perception Engine, including:
- Speed & Heading:
Speed_Mps(mps),VehicleHeading_Deg(heading slope in degrees). - Vessel Motions:
longitudinal,lateral, andverticalaccelerations, as well as vehiclepitchandrollangles. - Localization Status: Track whether GPS and sensors have successfully established a high-fidelity localization lock.
2. Shifting Coordinate Systems
To bypass floating-point precision limitations in large world spaces, the SDK uses a dynamic origin-shifting manager. All coordinates are handled via the GlobalPosition struct, which cleanly converts between double-precision geographical coordinates and local single-precision Unity world spaces.
3. Procedural Pipeline Control
The ElasticSceneGenerator drives the runtime generation loop, compiling the node graph, requesting map tiles, and invoking lifecycle callbacks (such as OnGenerationStarted and OnGenerationFinished).
User Extensibility & Custom Nodes
Spawners, Maps, and custom operators are fully user-extensible. By creating custom scripts that subclass our pipeline base classes or implement our interfaces, you can seamlessly plug your own logic directly into the generation pipeline:
1. Custom Mappers & Data Access
By implementing IWorkerMapper<T>, you can create custom mappers to retrieve, filter, and expose raw node data from the graph to outside MonoBehaviours.
2. High-Performance Sampling (O(1) Complexity)
Our MapWorker data structures pre-allocate flat float arrays on the CPU. Functions like GetCPUReadBufferValueInterpolated and GetGradientAngleAtPosition perform direct index calculations and basic bilinear interpolations with O(1) time complexity and zero GC allocations, enabling hundreds of ultra-fast spatial lookups per frame in your custom scripts.
3. Custom Node Graph Elements
Derive from classes like MapNode, SpawnerNode, or PoseSetNode to create custom nodes that appear directly inside the graph editor’s right-click context menu. You can find example implementations inside the package directory under:
Packages/com.holoride.elasticsdk/Runtime/Graph/Nodes/