In Unity, you can listen to several events that are emitted by VisionLib to react to them.
Event | Parameters | Description |
---|---|---|
TrackingManager.OnTrackerInitializing | Event which will be emitted once after calling the StartTracking function. | |
TrackingManager.OnTrackerInitialized | Event which will be emitted after the tracking configuration was loaded. | |
TrackingManager.OnTrackerRunning | Event which will be emitted once after the tracking was stopped or paused and is now running again. | |
TrackingManager.OnTrackerPaused | Event which will be emitted after the tracking was paused. | |
TrackingManager.OnTrackerStopped | Event which will be emitted after the tracking was stopped or the initialization of the tracker has failed. | |
TrackingManager.OnTrackingStates | TrackingState state | Event with the current tracking state of all tracked objects. This event will be emitted for each tracking frame. See also Tracking States in Unity. |
TrackingManager.OnPerformanceInfo | PerformanceInfo state | Event with the current tracking performance. This Event will be emitted for each tracking frame. |
TrackingManager.OnIssueTriggered | VLIssue issue | Event which will be emitted if an Issue was triggered. |
The VisionLib SDK for Unity provides two components that help to react on certain events by registering to them through the Inspector without the need to write a custom script:
TrackerEventProvider
component lets you react to OnTrackerInitialized
and OnTrackerStopped
TrackingAnchor
component lets you react to tracking state changes (Tracked
, Tracking Critical
, Tracking Lost
) of the given object, see Tracking States in UnityTo react to VisionLib events in your own MonoBehaviour script, register to them like seen below: