diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-11-17 19:04:33 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-11-17 19:04:33 +0100 |
commit | ed04aa321fd390c45eff1fee03e73e6513c6b978 (patch) | |
tree | 767f1db1eda5a4dddecac21d704d214a3e26cf8d /src/example | |
parent | b1c82f914f18457f9a30791b01896ea40832c2d3 (diff) |
improved bounce
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/collision.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/example/collision.cpp b/src/example/collision.cpp index b141d3d..2c476ca 100644 --- a/src/example/collision.cpp +++ b/src/example/collision.cpp @@ -63,10 +63,10 @@ int main(int argc, char * argv[]) { .bounce = false, .offset = {0,0} }); - // World.add_component<BoxCollider>(Vector2{0, -740}, 1000, 1000); // Top + World.add_component<BoxCollider>(Vector2{0, 0-(screen_size_height/2+world_collider/2)}, world_collider, world_collider);; // Top World.add_component<BoxCollider>(Vector2{0, screen_size_height/2+world_collider/2}, world_collider, world_collider); // Bottom - // World.add_component<BoxCollider>(Vector2{-820, 0}, 1000, 1000); // Left - // World.add_component<BoxCollider>(Vector2{820, 0}, 1000, 1000); // right + World.add_component<BoxCollider>(Vector2{0-(screen_size_width/2+world_collider/2), 0}, world_collider, world_collider); // Left + World.add_component<BoxCollider>(Vector2{screen_size_width/2+world_collider/2, 0}, world_collider, world_collider); // right GameObject game_object1(1, "Name", "Tag", Vector2{screen_size_width/2, screen_size_height/2}, 0, 1); @@ -74,7 +74,7 @@ int main(int argc, char * argv[]) { .mass = 1, .gravity_scale = 0.01, .body_type = Rigidbody::BodyType::DYNAMIC, - .linear_velocity = {0,0}, + .linear_velocity = {1,0}, .constraints = {0, 0, 0}, .use_gravity = true, .bounce = true, |