You are storing contacts that have begun in _contacts
. Instead you can have two vectors std::vector<MyContact>
. First for begun contacts (_begin
) and second for ended contacts (_end
). When your listener receives message that contact has ended - remove it from _begin
and
insert into _end
. In that case you will be able to iterate over both types of contacts. Just don't forget to clear
_end
contacts when you are done with them.
Also for detecting if floor ended is better to use ray cast. You can google for using ray cast in box2d