Display values in vector/quaternion math function errors

This can help track down the source of the error more easily.
This commit is contained in:
Hugo Locurcio 2024-01-17 17:30:04 +01:00
parent 17e7f85c06
commit 0437db0106
No known key found for this signature in database
GPG key ID: 39E8F8BE30B0A49C
6 changed files with 26 additions and 27 deletions

View file

@ -33,8 +33,8 @@
#include "core/error/error_macros.h"
#include "core/math/math_funcs.h"
#include "core/string/ustring.h"
class String;
struct Basis;
struct Vector2;
struct Vector3i;
@ -512,7 +512,7 @@ void Vector3::zero() {
// slide returns the component of the vector along the given plane, specified by its normal vector.
Vector3 Vector3::slide(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector3(), "The normal Vector3 must be normalized.");
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector3(), "The normal Vector3 " + p_normal.operator String() + " must be normalized.");
#endif
return *this - p_normal * this->dot(p_normal);
}
@ -523,7 +523,7 @@ Vector3 Vector3::bounce(const Vector3 &p_normal) const {
Vector3 Vector3::reflect(const Vector3 &p_normal) const {
#ifdef MATH_CHECKS
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector3(), "The normal Vector3 must be normalized.");
ERR_FAIL_COND_V_MSG(!p_normal.is_normalized(), Vector3(), "The normal Vector3 " + p_normal.operator String() + " must be normalized.");
#endif
return 2.0f * p_normal * this->dot(p_normal) - *this;
}