diff options
author | Max-001 <80035972+Max-001@users.noreply.github.com> | 2024-12-19 21:38:04 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-19 21:38:04 +0100 |
commit | 1bb9c2ccf96b7d2e24929c693192b25885614df9 (patch) | |
tree | 44184b5472cad44c9b335162177de85802692560 /src/crepe/api/Rigidbody.h | |
parent | 9c11853f7331fd740c763f5cc8f34903526a85d4 (diff) | |
parent | 3894948275e10b6a0e3614ba0da90b9ea8d6cd4e (diff) |
Merge pull request #85 from lonkaars/jaro/collision-system-handeling
Jaro/collision system handeling
Diffstat (limited to 'src/crepe/api/Rigidbody.h')
-rw-r--r-- | src/crepe/api/Rigidbody.h | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/src/crepe/api/Rigidbody.h b/src/crepe/api/Rigidbody.h index 6900295..b63d941 100644 --- a/src/crepe/api/Rigidbody.h +++ b/src/crepe/api/Rigidbody.h @@ -2,6 +2,7 @@ #include <cmath> #include <set> +#include <string> #include "../Component.h" @@ -120,26 +121,49 @@ public: * above 0.0. * */ - float elastisity_coefficient = 0.0; + float elasticity_coefficient = 0.0; /** - * \brief Offset of all colliders relative to the object's transform position. + * \brief Enables collision handling for objects colliding with kinematic objects. + * + * Enables collision handling for objects colliding with kinematic objects in the collision system. + * If `kinematic_collision` is true, dynamic objects cannot pass through this kinematic object. + * This ensures that kinematic objects delegate collision handling to the collision system. + */ + bool kinematic_collision = true; + + /** + * \brief Defines the collision layers a GameObject interacts with. * - * The `offset` defines a positional shift applied to all colliders associated with the object, relative to the object's - * transform position. This allows for the colliders to be placed at a different position than the object's actual - * position, without modifying the object's transform itself. + * The `collision_layers` represent the set of layers the GameObject can detect collisions with. + * Each element in this set corresponds to a layer ID. The GameObject will only collide with other + * GameObjects that belong to one these layers. + */ + std::set<int> collision_layers = {0}; + + /** + * \brief Specifies the collision layer of the GameObject. * + * The `collision_layer` indicates the single layer that this GameObject belongs to. + * This determines which layers other objects must match to detect collisions with this object. */ - vec2 offset; + int collision_layer = 0; /** * \brief Defines the collision layers of a GameObject. * - * The `collision_layers` specifies the layers that the GameObject will collide with. - * Each element represents a layer ID, and the GameObject will only detect - * collisions with other GameObjects that belong to these layers. + * The `collision_names` specifies where the GameObject will collide with. + * Each element represents a name from the Metadata of the gameobject. */ - std::set<int> collision_layers = {0}; + std::set<std::string> collision_names; + + /** + * \brief Defines the collision layers of a GameObject. + * + * The `collision_tags` specifies where the GameObject will collide with. + * Each element represents a tag from the Metadata of the gameobject. + */ + std::set<std::string> collision_tags; }; public: |