static float Distance( Vector2& a, Vector2& b )
float Distance( Vector2 target )

book_4_sparkGenerated
code_blocksInput

Description

The Vector2.Distance method calculates the Euclidean distance between two 2D vectors. This method is static and can be used to determine how far apart two points are in a 2D space.

Usage

To use the Vector2.Distance method, pass two Vector2 references as parameters. The method will return a float representing the distance between the two vectors.

Example

Vector2 pointA = new Vector2(1.0f, 2.0f);
Vector2 pointB = new Vector2(4.0f, 6.0f);
float distance = Vector2.Distance(ref pointA, ref pointB);
// distance will be approximately 5.0