From 9e573b6947387f945af2af71ae50dfb4a3bea717 Mon Sep 17 00:00:00 2001 From: 2shady4u Date: Fri, 27 Dec 2019 14:28:42 +0100 Subject: [PATCH] Added bounce to vector2.hpp --- include/core/Vector2.hpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/core/Vector2.hpp b/include/core/Vector2.hpp index 72c5c789..99ac60f2 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; }