How to use Ruler Feature
This tutorial will guide you on how to use a ruler feature using Banuba API. The API provides ready-made documented methods making it easy for developers to call AR features in their apps.
note
The ruler feature requires a distance to phone feature and face tracking feature. Please, make sure your licence plan includes both by contacting your sales manager or fill in the website form to request it.
#
Resource preparation#
Get Test Ruler effect- Contact your sales manager to get test_Ruler effect.
#
Integrating Face Ruler feature into your iOS appUse the
test_Ruler
effect or your version of this effect to enable ruler feature.note
You also need to disable ARKit on sdk initializing:
Set Offline mode for Face Tracking feature, so Ruler feature will be able to estimate distance up to 3 meters.
Create Listener to read Ruler feature result. For this you can use this example code:
Create Listener instance
and subscribe it to Ruler Value changes:
don't forget to unsubscribe the Listener before changing effect:
Now you can run your application to test the Ruler Feature values in application log.
note
Put face in frame to find distance using Ruler Feature. Without face in frame, getter will fail and write error in log.