Verctor3 Information And Methods Flashcards
Vector3
Representation of 3D vectors and points.
This structure is used throughout unity to pass 3D positions and directions around. It also contains functions for doing common vector operations.
Other classes can be used to manipulate vectors and points as well. For example Quaternion and Matrix4x4 classes are useful for rotating or transforming vectors and points.
Vector3 Static Properties list
Back (0.0-1)
Down(0.-1.0)
Forward(0.0.1)
Left(-1.0.0)
NegativeInfinity( Shorthand for writing Vector3, float.NegavtiveInfinity, float.NegavtiveInfinity, float.NegavtiveInfinity)
One, shorthand for writing Vector3 (1.1.1)
PositiveInfinity, shorthand for writing Vector3 (float.PositiveInfinity, float.PositiveInfinity, float.PositiveInfinity)
Right, shorthand for writing Vector3 (1.0.0)
Up(0.1.0)
Zero(0.0.0)
Vector3 is a Constructor that creates a new vector with given x, y, z components
Properties
Magnitude, returns the length of this vector (read only)
Normalized, returns this vector with a magnitude of 1 (read only)
SqrMagnitude, returns the squared length of this vector(read only)
This[int], Access the x, y, z components using[0],[1],[2] respectively
X, x component of the vector
Y, y component of the vector
Z, z component of the vector
Operators in unity
- subtracts one vector from another
! = Returns true of vectors are different - Multiplies a vector by a number
/ Divides a vector by a number
+ Adds two vectors
== Returns true of two vectors are approximately equal.