aboutsummaryrefslogtreecommitdiff
path: root/src/crepe
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe')
-rw-r--r--src/crepe/system/CollisionSystem.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp
index 8377823..3c6f22e 100644
--- a/src/crepe/system/CollisionSystem.cpp
+++ b/src/crepe/system/CollisionSystem.cpp
@@ -153,7 +153,12 @@ void CollisionSystem::static_collision_handler(CollisionInfo& info){
std::cout << "INFO: x:" << info.first.transform.position.x << "y:" << info.first.transform.position.y << std::endl;
info.first.transform.position += info.move_back_value;
if(info.first.rigidbody.data.bounce) {
- info.first.rigidbody.data.linear_velocity = -info.first.rigidbody.data.linear_velocity * info.first.rigidbody.data.bouncie_factor;
+ if(info.move_back_value.x != 0) {
+ info.first.rigidbody.data.linear_velocity.x = -info.first.rigidbody.data.linear_velocity.x * info.first.rigidbody.data.bouncie_factor;
+ }
+ if(info.move_back_value.y != 0) {
+ info.first.rigidbody.data.linear_velocity.y = -info.first.rigidbody.data.linear_velocity.y * info.first.rigidbody.data.bouncie_factor;
+ }
}
else {
info.first.rigidbody.data.linear_velocity = {0,0};