{"action":"created","issue":{"url":"https://api.github.com/repos/pybox2d/pybox2d/issues/52","labels_url":"https://api.github.com/repos/pybox2d/pybox2d/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/pybox2d/pybox2d/issues/52/comments","events_url":"https://api.github.com/repos/pybox2d/pybox2d/issues/52/events","html_url":"https://github.com/pybox2d/pybox2d/issues/52","id":55354820,"number":52,"title":"[pure python] Error in contact generation","user":{"login":"kne","id":76203,"avatar_url":"https://avatars.githubusercontent.com/u/76203?v=3","gravatar_id":"","url":"https://api.github.com/users/kne","html_url":"https://github.com/kne","followers_url":"https://api.github.com/users/kne/followers","following_url":"https://api.github.com/users/kne/following{/other_user}","gists_url":"https://api.github.com/users/kne/gists{/gist_id}","starred_url":"https://api.github.com/users/kne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kne/subscriptions","organizations_url":"https://api.github.com/users/kne/orgs","repos_url":"https://api.github.com/users/kne/repos","events_url":"https://api.github.com/users/kne/events{/privacy}","received_events_url":"https://api.github.com/users/kne/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/pybox2d/pybox2d/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/pybox2d/pybox2d/labels/imported","name":"imported","color":"FFFFFF"},{"url":"https://api.github.com/repos/pybox2d/pybox2d/labels/Priority-Low","name":"Priority-Low","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-24T02:00:16Z","updated_at":"2015-01-24T02:00:17Z","closed_at":null,"body":"_From [ruck.tobias](https://code.google.com/u/118112818256690769350/) on September 29, 2013 13:23:26_\n\nWhat steps will reproduce the problem? 1. It's an obvious programming error: contacts will generate despite being existent already\r\n2. The nested for loops are not handled properly. When an existing contact is detected, it just searches for more existing contacts (and does nothing). However, it should skip generating a new contact.\r\n\r\n*** mark the error lines\r\n\r\ndef find_new_contacts(self):\r\n        for proxy_a, proxy_b in self.broadphase.update_pairs():\r\n            assert(proxy_a and proxy_b)\r\n\r\n            fixture_a = proxy_a.fixture\r\n            fixture_b = proxy_b.fixture\r\n\r\n            body_a = fixture_a._body\r\n            body_b = fixture_b._body\r\n\r\n            \\# If the fixtures are on the same body, ignore it\r\n            if body_a == body_b:\r\n                continue\r\n\r\n            index_a = proxy_a.child_index\r\n            index_b = proxy_b.child_index\r\n                \r\n            \\# Does a contact already exist?\r\n            for contact in body_b._contacts:\r\n                if contact.other_body(body_b) == body_a:\r\n                    continue\r\n                    fa, fb = contact._fixture_a, contact._fixture_b\r\n                    ia, ib = contact._index_a, contact._index_b\r\n\r\n                    if fa==fixture_a and fb==fixture_b and ia==index_a and ib == index_b:\r\n                        \\# A contact already exists\r\n                        continue *** does effectively nothing\r\n\r\n                    if fa==fixture_b and fb==fixture_a and ia==index_b and ib == index_a:\r\n                        \\# A contact already exists\r\n                        continue *** same as above, does nothing\r\n\r\n            \\# Does a joint override collision? Is at least one body dynamic?\r\n            if not body_b._should_collide(body_a):\r\n                continue\r\n            \r\n            \\# Check user filtering.\r\n            if self.contact_filter is not None and not self.contact_filter(fixture_a, fixture_b):\r\n                continue\r\n            \r\n            \\# Create a contact through the factory.\r\n            c = Contact._create(fixture_a, index_a, fixture_b, index_b)\n\n_Original issue: http://code.google.com/p/pybox2d/issues/detail?id=52_"},"comment":{"url":"https://api.github.com/repos/pybox2d/pybox2d/issues/comments/71295308","html_url":"https://github.com/pybox2d/pybox2d/issues/52#issuecomment-71295308","issue_url":"https://api.github.com/repos/pybox2d/pybox2d/issues/52","id":71295308,"user":{"login":"kne","id":76203,"avatar_url":"https://avatars.githubusercontent.com/u/76203?v=3","gravatar_id":"","url":"https://api.github.com/users/kne","html_url":"https://github.com/kne","followers_url":"https://api.github.com/users/kne/followers","following_url":"https://api.github.com/users/kne/following{/other_user}","gists_url":"https://api.github.com/users/kne/gists{/gist_id}","starred_url":"https://api.github.com/users/kne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kne/subscriptions","organizations_url":"https://api.github.com/users/kne/orgs","repos_url":"https://api.github.com/users/kne/repos","events_url":"https://api.github.com/users/kne/events{/privacy}","received_events_url":"https://api.github.com/users/kne/received_events","type":"User","site_admin":false},"created_at":"2015-01-24T02:00:17Z","updated_at":"2015-01-24T02:00:17Z","body":"_From [sirkne](https://code.google.com/u/112841506218621786238/) on September 29, 2013 10:53:12_\n\nGreat find! I appreciate that someone is at least mucking around with the Pure Python port, however unpractical it may be. \r\n\r\nFix should be here: https://code.google.com/p/pybox2d/source/diff?spec=svn375&r=375&format=side&path=/branches/pure_python/pypybox2d/contact_manager.py Please do let me know if you run into anything further.\n\n**Summary:** [pure python] Error in contact generation  \\<span class=\"oldvalue\"> (was: Error in contact generation) \\</span>  \n  **Status:** Started  \n"}}