diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2024-12-04 20:48:38 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2024-12-04 20:48:38 +0100 |
commit | 69634f05b00e0e01ab84ab14b6293c7a88c5fbe0 (patch) | |
tree | f7705d8afe8af2ccd744a09cafe4edebf47083a9 | |
parent | 24246e115c3b7829d2981a2f60ac77da657f2ed5 (diff) |
added collision layers to example and unit test
-rw-r--r-- | src/example/game.cpp | 14 | ||||
-rw-r--r-- | src/test/CollisionTest.cpp | 2 |
2 files changed, 10 insertions, 6 deletions
diff --git a/src/example/game.cpp b/src/example/game.cpp index 70c562e..a8d6d1b 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -44,12 +44,13 @@ public: //define playable world GameObject world = mgr.new_object( "Name", "Tag", vec2{screen_size_width / 2, screen_size_height / 2}, 0, 1); - world.add_component<Rigidbody>( - Rigidbody::Data{.mass = 0, - .gravity_scale = 0, - .body_type = Rigidbody::BodyType::STATIC, - .constraints = {0, 0, 0}, - .offset = {0, 0}}); + world.add_component<Rigidbody>(Rigidbody::Data{ + .mass = 0, + .gravity_scale = 0, + .body_type = Rigidbody::BodyType::STATIC, + .offset = {0, 0}, + .collision_layers = {0}, + }); world.add_component<BoxCollider>( vec2{0, 0 - (screen_size_height / 2 + world_collider / 2)}, vec2{world_collider, world_collider}); @@ -73,6 +74,7 @@ public: .constraints = {0, 0, 0}, .elastisity_coefficient = 1, .offset = {0, 0}, + .collision_layers = {0}, }); game_object1.add_component<BoxCollider>(vec2{0, 0}, vec2{20, 20}); game_object1.add_component<BehaviorScript>().set_script<MyScript>(); diff --git a/src/test/CollisionTest.cpp b/src/test/CollisionTest.cpp index 74edaf7..3da04b5 100644 --- a/src/test/CollisionTest.cpp +++ b/src/test/CollisionTest.cpp @@ -78,6 +78,7 @@ public: .constraints = {0, 0, 0}, .elastisity_coefficient = 1, .offset = {0, 0}, + .collision_layers = {0}, }); game_object1.add_component<BoxCollider>(vec2{0, 0}, vec2{10, 10}); BehaviorScript & script_object1 @@ -93,6 +94,7 @@ public: .constraints = {0, 0, 0}, .elastisity_coefficient = 1, .offset = {0, 0}, + .collision_layers = {0}, }); game_object2.add_component<BoxCollider>(vec2{0, 0}, vec2{10, 10}); BehaviorScript & script_object2 |