Explorar o código

Added bounce to vector2.hpp

2shady4u %!s(int64=5) %!d(string=hai) anos
pai
achega
9e573b6947
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      include/core/Vector2.hpp

+ 4 - 0
include/core/Vector2.hpp

@@ -176,6 +176,10 @@ struct Vector2 {
 		return p_vec - *this * this->dot(p_vec);
 	}
 
+	inline Vector2 bounce(const Vector2 &p_normal) const {
+		return -reflect(p_normal);
+	}
+
 	inline Vector2 reflect(const Vector2 &p_vec) const {
 		return p_vec - *this * this->dot(p_vec) * 2.0;
 	}