Vec3.DistanceSq
static float DistanceSq(Vec3 a, Vec3 b)
Calculates the distance between two points in space, but leaves them squared! Make sure they’re in the same coordinate space! This is a fast function :)
Vec3 a | The first point. |
Vec3 b | And the second point! |
RETURNS: float | Distance between the two points, but squared! |
Examples
Vec3 pointA = new Vec3(3, 2, 5);
Vec3 pointB = new Vec3(3, 2, 8);
float distanceSquared = Vec3.DistanceSq(pointA, pointB);
if (distanceSquared < 4*4) {
Log.Info("Distance is less than 4");
}
Found an issue with these docs, or have some additional questions? Create an Issue on Github!