Summary

A 2-dimensional vector. Typically represents a position or size in 2D space.

Properties

Degrees Return the angle of this vector in degrees, always between 0 and 360
IsNearZeroLength Returns true if the squared length is less than 1e-8 (which is really near zero)
Length Returns the magnitude of the vector
LengthSquared This is faster than Length, so is better to use in certain circumstances
Normal Return the same vector but with a length of one
Perpendicular Returns a vector that runs perpendicular to this one
x X component of this Vector.
y Y component of this Vector.

Methods

Abs Returns a new vector with all values positive. -5 becomes 5, etc.
AlmostEqual
Clamp
ComponentMax
ComponentMin
LerpTo
SnapToGrid
WithX
WithY

Static Properties

Down Returns a 2D vector with Y set to -1. This represents the downwards direction in 2D space.
Left Returns a 2D vector with X set to 1. This represents the left hand direction in 2D space.
One Returns a 2D vector with every component set to 1
Random Uniformly samples a 2D position from all points with distance at most 1 from the origin.
Right Returns a 2D vector with X set to -1. This represents the right hand direction in 2D space.
Up Returns a 2D vector with Y set to 1. This represents the upwards direction in 2D space.
Zero Returns a 2D vector with every component set to 0

Static Methods

Direction
Distance
DistanceBetween
DistanceBetweenSquared
DistanceSquared
Dot
FromDegrees
FromRadians
Lerp
Max
Min
Parse
TryParse
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.