X-Git-Url: https://git.yukkurigames.com/?a=blobdiff_plain;f=bulletml%2F_collision.pyx;h=b05702213ca775d73079096d8b03a88005c53877;hb=66792ffbd26da7a4093707c58ca352dea52f643c;hp=2011e984a06e1208d3fbe37535d364e0fc51a795;hpb=7b73a60799150ec3df407a8a1620a613aad5f59c;p=python-bulletml.git diff --git a/bulletml/_collision.pyx b/bulletml/_collision.pyx index 2011e98..b057022 100644 --- a/bulletml/_collision.pyx +++ b/bulletml/_collision.pyx @@ -28,14 +28,10 @@ def overlaps(a, b): dx = ax - bx dy = ay - by - try: - radius = a.radius - except AttributeError: - radius = 0.5 - try: - radius += b.radius - except AttributeError: - radius += 0.5 + + radius_a = getattr3(a, 'radius', 0.5) + radius_b = getattr3(b, 'radius', 0.5) + radius = radius_a + radius_b return dx * dx + dy * dy <= radius * radius