diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-13 21:00:33 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-13 21:00:33 +0100 |
commit | 64e74c336baa1e69a2ad0d9a3bd9e5393e6f436a (patch) | |
tree | 16f6148bbfdb1bbd9bdb1207a041291bf4b41277 | |
parent | bdebe07d265eb009fe3b3d04371a449feff19325 (diff) |
fixed bug
-rw-r--r-- | src/crepe/system/CollisionSystem.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp index 7cafe82..6dc1597 100644 --- a/src/crepe/system/CollisionSystem.cpp +++ b/src/crepe/system/CollisionSystem.cpp @@ -188,7 +188,7 @@ CollisionSystem::collision_handler(CollisionInternal & data1, CollisionInternal } Direction resolution_direction = Direction::NONE; - if (resolution != vec2{0,0}) { + if (resolution.x != 0 && resolution.y != 0) { resolution_direction = Direction::BOTH; } else if (resolution.x != 0) { resolution_direction = Direction::X_DIRECTION; @@ -320,12 +320,13 @@ void CollisionSystem::static_collision_handler(CollisionInfo & info) { case Direction::BOTH: //bounce if (info.this_rigidbody.data.elastisity_coefficient > 0) { - info.this_rigidbody.data.linear_velocity.y - = -info.this_rigidbody.data.linear_velocity.y - * info.this_rigidbody.data.elastisity_coefficient; - info.this_rigidbody.data.linear_velocity.x - = -info.this_rigidbody.data.linear_velocity.x - * info.this_rigidbody.data.elastisity_coefficient; + info.this_rigidbody.data.linear_velocity = -info.this_rigidbody.data.linear_velocity * info.this_rigidbody.data.elastisity_coefficient; + // info.this_rigidbody.data.linear_velocity.y + // = -info.this_rigidbody.data.linear_velocity.y + // * info.this_rigidbody.data.elastisity_coefficient; + // info.this_rigidbody.data.linear_velocity.x + // = -info.this_rigidbody.data.linear_velocity.x + // * info.this_rigidbody.data.elastisity_coefficient; } //stop movement else { |