How can I improve performance in generate overlaps ? Could I merge several parts?


Profiler tells me I have a severe bottle neck in generate overlaps.

My entities in game (enemies and player character) are made of several sprite components which I tween with custom code. Each spritecomponent has its own geometry for collision (the defined by the sprite asset).

Using a basic geometry for each sprite does not help that much (helps but not eliminates the problem). I would like to know tricks or ways for improving my performance needs.

Ideas I have and do not know if they would be feasible:

  • have a wrapping sphere / box around the entire character. Then test if the sphere/box overlaps, if so, test with the inside sphere -like a “broadphase” detection-
  • merging the geometries of the sprites and do only 1 update overlap for the entire actor (I do not care what part of the actor did overlap, I only care about the entire actor overlapping or not)

Thanks for reading!