From b57b61e06e6c0f1c7dfc939ef3bf52799749cfa0 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Fri, 13 Dec 2024 20:54:50 +0100 Subject: improved readablity --- src/crepe/system/CollisionSystem.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/crepe') 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); } -- cgit v1.2.3