I have a problem. When i changing a distance between my camera and target, a distance between two objects is changing.

How i can calculate real distance between two objects?

**Keywords：java **

**Question: **

I have a problem. When i changing a distance between my camera and target, a distance between two objects is changing.

How i can calculate real distance between two objects?

**2 Answers: **

Considering you know the coordinates of both objects, you could use Pythagorean theorem twice (as stated here):

```
d = sqrt(x^2 + y^2 + z^2)
```

This is because the way you have set the World Center Mode in Vuforia. You can use the Unity Distance function and it should work fine. If not, try making one object a child of the other, so you can check the distance using the localPosition value of the child object like this:

```
d = sqrt(CHILD1.transform.localposition.x^2 + CHILD1.transform.localPosition.y^2 + CHILD1.transform.localPosition.z^2);
```