summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author2shady4u <jd16581556@gmail.com>2019-12-27 14:28:42 +0100
committer2shady4u <jd16581556@gmail.com>2019-12-27 14:28:42 +0100
commit9e573b6947387f945af2af71ae50dfb4a3bea717 (patch)
tree5d5be7c2bcd401aa8ec52d82468be448373227fc
parent7cbb846417acf0154a786bcaee8a5b1d7b40df57 (diff)
downloadredot-cpp-9e573b6947387f945af2af71ae50dfb4a3bea717.tar.gz
Added bounce to vector2.hpp
-rw-r--r--include/core/Vector2.hpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/core/Vector2.hpp b/include/core/Vector2.hpp
index 72c5c78..99ac60f 100644
--- a/include/core/Vector2.hpp
+++ b/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;
}