Vector3 also supports the same access methods as Vector2, with an additional z
component.
Vector3 objects can be constructed by either:
x, y, z
components as floats.Vector3::ZERO
, Vector3::UNIT_X
, and similar instead of creating new objects initialized to those values.
Dot
Magnitude
MagnitudeFast
, which omits the slower square root function call.Distance
Cross
, which can either return a new Vector3 or apply to the current one depending on the arguments.Angle
Project
, always returns a new object, taking the length
and direction
as Vector3 objectsPerpendicular
, always returns a new object, taking the length
and direction
as Vector3 objectsReflection
, always return a new object, taking an existing Vector3 and a normal as Vector3 objects.Note that the typical !=, ==, *= operators are all implemented for this class.