diff --git a/MathLib/Vector3.h b/MathLib/Vector3.h index 41b19ecc963425a024e085616adf441fa99cc3b6..1b98887e2069c13a517312003e3f90cb52df9939 100644 --- a/MathLib/Vector3.h +++ b/MathLib/Vector3.h @@ -114,6 +114,8 @@ public: /// Returns a normalized version of this vector TemplateVector3<double> getNormalizedVector() const { + if (getSqrLength() == 0) + return TemplateVector3<double>(0,0,0); TemplateVector3<double> norm_vec (this->_x[0], this->_x[1], this->_x[2]); norm_vec.normalize(); return norm_vec;