AR camera distance measurement

hello!
I have a question, Could anyone help me please?
I want to know how to show the distance information(like centermeter…) between AR camera and target object. (Using Smartphone)
Can I do that in Unity ? Should I use AR Foundation? and with ARcore? How to write code?

Thank again!

  • You can use the ARRaycastManager to raycast against detected point clouds or tracked planes. Then can measure the distance between the camera position and raycast intersection with detected landmarks.
  • Or you use the TryAcquireEnvironmentDepthCpuImage() to get the depth information of each pixel. It is supported on all Android devices and on iOS devices with LiDAR sensor.