diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-06 12:31:38 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-06 12:31:38 +0100 |
commit | cc320c87372dfbcce5f1cee66397466d90a9ba0a (patch) | |
tree | 68236e75d2abd63d72f43d404104f1584e026b01 | |
parent | d0130b79680ffb873b56eafbb689aaaafa1ac2b3 (diff) |
removed minus one from calculation
-rw-r--r-- | src/crepe/system/CollisionSystem.cpp | 4 | ||||
-rw-r--r-- | src/example/game.cpp | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/crepe/system/CollisionSystem.cpp b/src/crepe/system/CollisionSystem.cpp index fe2d669..bde217f 100644 --- a/src/crepe/system/CollisionSystem.cpp +++ b/src/crepe/system/CollisionSystem.cpp @@ -512,7 +512,7 @@ bool CollisionSystem::get_box_circle_collision(const BoxCollider & box1, float distance_squared = distance_x * distance_x + distance_y * distance_y; // Compare distance squared with the square of the circle's radius - return distance_squared <= circle2.radius * circle2.radius-1; + return distance_squared <= circle2.radius * circle2.radius; } bool CollisionSystem::get_circle_circle_collision(const CircleCollider & circle1, @@ -533,7 +533,7 @@ bool CollisionSystem::get_circle_circle_collision(const CircleCollider & circle1 float radius_sum = circle1.radius + circle2.radius; // Check if the distance between the centers is less than or equal to the sum of the radii - return distance_squared <= radius_sum * radius_sum - 1; + return distance_squared <= radius_sum * radius_sum; } vec2 CollisionSystem::get_current_position(const vec2 & collider_offset, diff --git a/src/example/game.cpp b/src/example/game.cpp index af99097..be756bd 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -201,7 +201,7 @@ public: "Name", "Tag", vec2{screen_size_width / 2, screen_size_height / 2}, 0, 1); game_object1.add_component<Rigidbody>(Rigidbody::Data{ .mass = 1, - .gravity_scale = 0.05, + .gravity_scale = 0, .body_type = Rigidbody::BodyType::DYNAMIC, .linear_velocity = {0, 0}, .constraints = {0, 0, 0}, |