float Distance( Vector2Int other )
float Distance( Vector2 other )

book_4_sparkGenerated
code_blocksInput

Description

The Distance method calculates the Euclidean distance between the current Vector2Int instance and another specified Vector2Int instance. This method is useful for determining how far apart two points are in a 2D integer grid.

Usage

To use the Distance method, you need to have two Vector2Int instances. Call the method on one instance and pass the other instance as a parameter. The method will return a float representing the distance between the two vectors.

Example

Vector2Int pointA = new Vector2Int(3, 4);
Vector2Int pointB = new Vector2Int(7, 1);

float distance = pointA.Distance(pointB);
// distance will be 5.0, which is the Euclidean distance between the points (3,4) and (7,1)