#pragma once class activation_area : public gameobject { public: std::vector callbacks; activation_area() { collision_check = false; } void add_area(glm::vec3 location, void (*callback_function)()){ locations.push_back(location); callbacks.push_back(callback_function); } ssize_t collision_index(glm::vec3 position, float distance = 0){ for(size_t i = 0; i < locations.size(); i++){ glm::vec3 l = locations[i]; // This'll get optimized out if( size.x/2.0f + distance > abs(l.x-position.x) && size.y/2.0f + distance > abs(l.y-position.y) && size.z/2.0f + distance > abs(l.z-position.z)){ callbacks[i](); return i; } } return -1; } };