0
\$\begingroup\$

I'm in the middle of developing a game in Augmented Reality using Unity and ARToolkit plugin. I wanted to measure the approximate distance between the AR marker and the position of camera. Can anyone help me with a solution to this problem? Thanks in advance.

\$\endgroup\$
0
\$\begingroup\$

if AR marker have Transform Component attached, then you can measure the distance.

  public Transform ARMarker;   //attach ar marker gameObject here
  float dist;
  void calDistance(){
  dist=Vector3.Distance(ARMarker.position,transform.position);
  Debug.Log("Distance is:"+dist);
  }

Attach this script to Camera.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.