diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-13 20:54:50 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-13 20:54:50 +0100 |
commit | b57b61e06e6c0f1c7dfc939ef3bf52799749cfa0 (patch) | |
tree | c424a3ab20439b5c3eb8b65b9a9b3578baf42284 /src/crepe/system/CollisionSystem.cpp | |
parent | d5904cb53bb7cc3a33894cb30746433b724f5634 (diff) |
improved readablity
Diffstat (limited to 'src/crepe/system/CollisionSystem.cpp')
-rw-r--r-- | src/crepe/system/CollisionSystem.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp index 5c49983..938ae82 100644 --- a/src/crepe/system/CollisionSystem.cpp +++ b/src/crepe/system/CollisionSystem.cpp @@ -188,18 +188,18 @@ CollisionSystem::collision_handler(CollisionInternal & data1, CollisionInternal } Direction resolution_direction = Direction::NONE; - if (resolution.x != 0 && resolution.y != 0) { + if (resolution != vec2{0,0}) { resolution_direction = Direction::BOTH; } 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.y != 0 && data1.rigidbody.data.linear_velocity.x != 0) + if (data1.rigidbody.data.linear_velocity != vec2{0,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.x != 0 && data1.rigidbody.data.linear_velocity.y != 0) + if (data1.rigidbody.data.linear_velocity != vec2{0,0}) resolution.x = -data1.rigidbody.data.linear_velocity.x * (resolution.y / data1.rigidbody.data.linear_velocity.y); } |