Marker Tracking
You can use the "Magic Leap Marker Tracking" plugin to detect and locate fiducial markers in your project.
The plugin can be enabled from the plugin browser. In the Unreal editor, select Edit -> Plugins. Enable "Magic Leap Hand Interaction" to enable the plugin.
To build an application that run natively on MagicLeap 2 with marker tracking, you will need to request the com.magicleap.permission.MARKER_TRACKING
permission. See the Permissions guide for details regarding how to configure permission in an Unreal application.
The MagicLeap 2 marker tracker is able to track ArUco markers, AprilTags, and QR codes, as well as standard barcodes. See the Marker Tracker feature guide for details.
Magic Leap Marker Tracking Component
The marker tracking plugin includes a single scene component that can be used to configure the marker tracker, as well as detect and locate markers in space.
The component exposes two events that you can use to get information about detected markers.
Events-
Event | Description |
---|---|
FMagicLeapMarkerTrackingResultDelegateMulticast ResultDelegate | Raised on every frame when at least one marker was detected. Event handlers are passed a reference to an array that contains data for all markers that are currently detected by the tracker. |
FMagicLeapMarkerTrackingDeltaDelegateMulticast DeltaDelegate | Raised on frames where either new markers were detected or previously detected markers were lost, compared to the previous frame. This event will only be raised if bTrackUnique is set true. |
Fields-
Field | Description |
---|---|
FMagicLeapMarkerTrackingConfig DetectorConfig | Contains the desired tracker configuration |
bool bTrackUnique | If true, the Delta event will be raised when new markers are detected or previously detected markers were lost, compared to the previous frame. |
The DetectorConfig field exposes the various properties that you can use to configure the behavior of the tracker for your application. See the Marker Tracker feature guide for details.
Usage
Here is an example blueprint script that renders a coordinate axis at the location of ArUco codes detected by the marker tracker-
Note that the Delta event outputs lists of marker ids that were added or removed compared to the previous frame. You will need to store the results of a Result event in order to recall any additional marker data when you handle the Delta event.
Here is an example of a blueprint that handles the Delta and Result events in order to draw green and red spheres when markers are first detected and when they are removed.