aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2024-12-13 21:28:27 +0100
committerJAROWMR <jarorutjes07@gmail.com>2024-12-13 21:28:27 +0100
commit47cc992a4892d4f3de5702668033ad45ea43dd73 (patch)
tree387c89b6c20226213ea87b26309a56827afd238f
parent64e74c336baa1e69a2ad0d9a3bd9e5393e6f436a (diff)
removed comment and reverted if
-rw-r--r--src/crepe/system/CollisionSystem.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp
index 6dc1597..496224e 100644
--- a/src/crepe/system/CollisionSystem.cpp
+++ b/src/crepe/system/CollisionSystem.cpp
@@ -193,13 +193,13 @@ CollisionSystem::collision_handler(CollisionInternal & data1, CollisionInternal
} else if (resolution.x != 0) {
resolution_direction = Direction::X_DIRECTION;
//checks if the other velocity has a value and if this object moved
- if (data1.rigidbody.data.linear_velocity != vec2{0,0})
+ if (data1.rigidbody.data.linear_velocity.x != 0 && data1.rigidbody.data.linear_velocity.y != 0)
resolution.y = -data1.rigidbody.data.linear_velocity.y
* (resolution.x / data1.rigidbody.data.linear_velocity.x);
} else if (resolution.y != 0) {
resolution_direction = Direction::Y_DIRECTION;
//checks if the other velocity has a value and if this object moved
- if (data1.rigidbody.data.linear_velocity != vec2{0,0})
+ if (data1.rigidbody.data.linear_velocity.x != 0 && data1.rigidbody.data.linear_velocity.y != 0)
resolution.x = -data1.rigidbody.data.linear_velocity.x
* (resolution.y / data1.rigidbody.data.linear_velocity.y);
}
@@ -321,12 +321,6 @@ void CollisionSystem::static_collision_handler(CollisionInfo & info) {
//bounce
if (info.this_rigidbody.data.elastisity_coefficient > 0) {
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 {