diff options
| author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-01-24 13:51:25 +0100 |
|---|---|---|
| committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2020-01-24 14:19:23 +0100 |
| commit | a002b93d860887a219aa40d7a5cc65fc3a5272c1 (patch) | |
| tree | 3fc1e8c3c4ad5e2b353737ae860674acdb13adc0 /core/math/vector2.cpp | |
| parent | 97cc2e53f6fbba7e85a2cbb79f38e077a6e511f7 (diff) | |
| download | redot-engine-a002b93d860887a219aa40d7a5cc65fc3a5272c1.tar.gz | |
Add explanations for errors related to Vector/Quat normalization
Diffstat (limited to 'core/math/vector2.cpp')
| -rw-r--r-- | core/math/vector2.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index b306ad3d09..f4259e388b 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -187,7 +187,7 @@ Vector2 Vector2::move_toward(const Vector2 &p_to, const real_t p_delta) const { // slide returns the component of the vector along the given plane, specified by its normal vector. Vector2 Vector2::slide(const Vector2 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V(!p_normal.is_normalized(), Vector2()); + ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 must be normalized."); #endif return *this - p_normal * this->dot(p_normal); } @@ -198,7 +198,7 @@ Vector2 Vector2::bounce(const Vector2 &p_normal) const { Vector2 Vector2::reflect(const Vector2 &p_normal) const { #ifdef MATH_CHECKS - ERR_FAIL_COND_V(!p_normal.is_normalized(), Vector2()); + ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector2(), "The normal Vector2 must be normalized."); #endif return 2.0 * p_normal * this->dot(p_normal) - *this; } |
