struct CollisionPackage {
bool collision;
float t;
float distance_from_collision;
float sqr_distance_from_collision;
Vector collision_point;
Vector collision_normal;
}
Now when dealing with multiple collision points, Im wondering what would be more efficient performance wise:
A) Create a std::vector<CollisionPackage>; one for every detected collision point. Once every triangle has been checked, sort through these and return the closest point (may be mutliple if more than one occurance of closest distance).
B) Once a single collision point is detected, check through the current std:::vector<CollisionPackage>, if its sqr_distance_from_collision or t value is lower than all current values, clear the std::vector and add this point. If it is equal sqr_distance_from_collision or t, add it to the vector. If less than, ignore it.
In terms of operations it would seem that B) would be more efficient as it contains less .push_back() calls. Is there any case where i would want to hold onto non-closest collisions?



















