# unity distance between 2 vectors 2d unity get distance between two objects distance between two objects unity 2d

**The solution for “unity distance between 2 vectors 2d unity get distance between two objects distance between two objects unity 2d” can be found here. The following code will assist you in solving the problem.**

```
Vector2.Distance(vector1.position, vector2.position);// Vector3.Distance is the same as (a-b).magnitude
```float distance = Vector3.Distance(a.transform.position, b.transform.position);public GameObject object1;

public GameObject object2;

void Update()

{

Vector2 Pos1 = object1.transform.position;

Vector2 Pos2 = object2.transform.position;

float x1 = Pos1.x, x2 = Pos2.x, y1 = Pos1.y, y2 = Pos2.y;

// Distance between X coordinates

float xDif = Mathf.Abs((Mathf.Max(x1,x2) – Mathf.Min(x1,x2));

// Distance between Y coordinates

float xDif = Mathf.Abs((Mathf.Max(y1,y2) – Mathf.Min(y1,y2));

// Pythagorean theorem

float finalDistance = Mathf.Sqrt(xDif * xDif + yDif * yDif);

Debug.Log(“Distance Between Object1 And Object2 Is ” + finalDistance);

}

```
```

` `

**More questions on [categories-list]**

- tss from gene granges
- ixl ansers ixl ansers
- get coin prices node-binance
- how to setup netflix workflow worker
- spritesheets in pyqt spritesheets in pyqt
- cahokia mounds pictures cahokia mounds pictures cahokia mounds pictures
- python 2 decimal places how to get decimal part of a double in python set number of decimals python
- how to find nuber of tweets per day using python how to find nuber of tweets per day using python how to find nuber of tweets per day using python how to find nuber of tweets per day using python how to find nuber of tweets per day using python
- haskell get specific elements of a String
- vb net code snippets for storing password
- error TS2307: Cannot find module ‘@ngx-meta/core’.
- inline scripts encapsulated in tags