Fix Vector's Bounce Reflect

Fixes Vector 2 and 3 bounce and reflect methods to match gdscript

Co-Authored-By: Bruno Campos <brunocu@msn.com>

Move calculation to reflect

fix commit

squash

fix style
This commit is contained in:
NHodgesVFX
2020-02-04 16:33:43 -05:00
parent aba8766618
commit a2e6f7a5ef
2 changed files with 4 additions and 4 deletions

View File

@@ -238,8 +238,8 @@ struct Vector3 {
return v;
}
inline Vector3 reflect(const Vector3 &by) const {
return by - *this * this->dot(by) * 2.f;
inline Vector3 reflect(const Vector3 &p_normal) const {
return -(*this - p_normal * this->dot(p_normal) * 2.f);
}
inline Vector3 rotated(const Vector3 &axis, const real_t phi) const {