From a69ae733dae7996be41f54d8f8d9c1c5e5879b92 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Sun, 1 Dec 2024 22:49:15 +0100 Subject: moved function --- src/crepe/system/CollisionSystem.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/crepe/system/CollisionSystem.h') diff --git a/src/crepe/system/CollisionSystem.h b/src/crepe/system/CollisionSystem.h index 056a7f1..39ee83d 100644 --- a/src/crepe/system/CollisionSystem.h +++ b/src/crepe/system/CollisionSystem.h @@ -2,6 +2,7 @@ #include #include +#include #include "api/Rigidbody.h" #include "api/Transform.h" @@ -12,6 +13,7 @@ #include "Collider.h" #include "System.h" + namespace crepe { @@ -184,6 +186,23 @@ private: */ bool check_collision(const collider_variant& collider1,std::pair, std::reference_wrapper> components1,const collider_variant& collider2,std::pair, std::reference_wrapper> components2,CollisionSystem::CollisionInternalType type); + /** + * \brief Retrieves the active Transform and Rigidbody components for a given game object. + * + * This function looks up the Transform and Rigidbody components associated with the specified + * game object ID. It checks if both components are present and active. If both are found + * to be active, they are returned wrapped in reference wrappers; otherwise, an empty + * optional is returned. + * + * \param game_object_id The ID of the game object for which to retrieve the components. + * + * \return A std::optional containing a pair of reference wrappers to the active Transform + * and Rigidbody components, or std::nullopt if either component is not found + * or not active. + */ + std::optional, std::reference_wrapper>> get_active_transform_and_rigidbody(game_object_id_t game_object_id); + + /** * \brief Detects collisions between two BoxColliders. * -- cgit v1.2.3