Category: Built-In Types
Vector class, which performs basic 3D vector math operations.
- :ref:`float<class_float>` x - X component of the vector.
- :ref:`float<class_float>` y - Y component of the vector.
- :ref:`float<class_float>` z - Z component of the vector.
- AXIS_X = 0 --- Enumerated value for the X axis. Returned by functions like max_axis or min_axis.
- AXIS_Y = 1 --- Enumerated value for the Y axis.
- AXIS_Z = 2 --- Enumerated value for the Z axis.
Vector3 is one of the core classes of the engine, and includes several built-in helper functions to perform basic vector math operations.
- :ref:`Vector3<class_vector3>` Vector3 ( :ref:`float<class_float>` x, :ref:`float<class_float>` y, :ref:`float<class_float>` z )
Returns a Vector3 with the given components.
- :ref:`Vector3<class_vector3>` abs ( )
Returns a new vector with all components in absolute values (i.e. positive).
- :ref:`float<class_float>` angle_to ( :ref:`Vector3<class_vector3>` to )
- :ref:`Vector3<class_vector3>` ceil ( )
Returns a new vector with all components rounded up.
Return the cross product with b.
- :ref:`Vector3<class_vector3>` cubic_interpolate ( :ref:`Vector3<class_vector3>` b, :ref:`Vector3<class_vector3>` pre_a, :ref:`Vector3<class_vector3>` post_b, :ref:`float<class_float>` t )
Perform a cubic interpolation between vectors pre_a, a, b, post_b (a is current), by the given amount (t).
- :ref:`float<class_float>` distance_squared_to ( :ref:`Vector3<class_vector3>` b )
Return the squared distance (distance minus the last square root) to b. Prefer this function over distance_to if you need to sort vectors or need the squared distance for some formula.
- :ref:`float<class_float>` distance_to ( :ref:`Vector3<class_vector3>` b )
Return the distance to b.
Return the dot product with b.
- :ref:`Vector3<class_vector3>` floor ( )
Returns a new vector with all components rounded down.
- :ref:`Vector3<class_vector3>` inverse ( )
Returns the inverse of the vector. This is the same as Vector3( 1.0 / v.x, 1.0 / v.y, 1.0 / v.z )
- :ref:`float<class_float>` length ( )
Return the length of the vector.
- :ref:`float<class_float>` length_squared ( )
Return the length of the vector, squared. Prefer this function over "length" if you need to sort vectors or need the squared length for some formula.
- :ref:`Vector3<class_vector3>` linear_interpolate ( :ref:`Vector3<class_vector3>` b, :ref:`float<class_float>` t )
Linearly interpolates the vector to a given one (b), by the given amount (t).
- :ref:`int<class_int>` max_axis ( )
Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the largest.
- :ref:`int<class_int>` min_axis ( )
Returns AXIS_X, AXIS_Y or AXIS_Z depending on which axis is the smallest.
- :ref:`Vector3<class_vector3>` normalized ( )
Return a copy of the normalized vector to unit length. This is the same as v / v.length().
- :ref:`Vector3<class_vector3>` reflect ( :ref:`Vector3<class_vector3>` by )
Like "slide", but reflects the Vector instead of continuing along the wall.
- :ref:`Vector3<class_vector3>` rotated ( :ref:`Vector3<class_vector3>` axis, :ref:`float<class_float>` phi )
Rotates the vector around some axis by phi radians.
Slides the vector along a wall.
- :ref:`Vector3<class_vector3>` snapped ( :ref:`float<class_float>` by )
Return a copy of the vector, snapped to the lowest neared multiple.