Another attempt at optimization

main
Yan Wittmann 2023-03-28 17:17:51 +02:00
parent 0853c04844
commit 447ebdd5a8
1 changed files with 1 additions and 2 deletions

View File

@ -167,8 +167,7 @@ class PhysicsElementsHandler:
for collider in colliders: for collider in colliders:
if sprite is not collider: if sprite is not collider:
distance = self.calculate_basic_distance(sprite, collider) distance = self.calculate_basic_distance(sprite, collider)
if distance > max(self.get_sprite_size_for_distance(sprite, screen_transform), if distance > 50:
self.get_sprite_size_for_distance(collider, screen_transform)):
continue continue
if sprite.collides_with(collider, TOLERANCE): if sprite.collides_with(collider, TOLERANCE):
collides_with.append(collider) collides_with.append(collider)