Explorar o código

Update vector math doc

In the section explaining about normalizing a vector. In the warning, it says we cannot normalize a vector with a length of 0. And doing so will result in an error.

But after testing out normalizing a vector ( via normalized() function ), no errors are reported. Also printing out to the console shows (0, 0, 0) as the output. Similarly, normalizing manually by dividing it by the length shows strange result if printed out, but still no error.

I think GDScript ( not tested with other languages ) handles normalization of vector in such a way that we don't have to worry about normalizing a vector of length 0 ( only when done through normalized() function ).
Arpit Srivastava %!s(int64=4) %!d(string=hai) anos
pai
achega
4b323d566e
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      tutorials/math/vector_math.rst

+ 2 - 1
tutorials/math/vector_math.rst

@@ -203,7 +203,8 @@ by its magnitude. Because this is such a common operation,
 
 .. warning:: Because normalization involves dividing by the vector's length,
              you cannot normalize a vector of length ``0``. Attempting to
-             do so will result in an error.
+             do so will result in an undefined value. Though while programming,
+             if using the normalized() function, it will return ``Vector3(0, 0, 0)``
 
 Reflection
 ----------