4 Replies Latest reply on Jan 11, 2008 11:59 AM by Rothrock

    optimizing collision detection

    Level 7
      Hi,

      in a simulation I have to check for many collisions between multiple
      objects. So what I am doing is put a detection on each relevant
      movieclip that checks a list of objects (cars). When the number of
      objects is growing the number of loops is growing the same amount but
      the loops that checks for collision are growing too. So I am running
      into a preformace problem.

      I was thinking about how to optimize this performance problem.

      * first idea was to check only clips that are in a specific area. But
      this also creates an overhead on checking what area the clips are. I
      could create overlapping clips that are used to represent this areas and
      check if the clips are inside these areas.
      I am not quite sure if this is a real performance optimization or
      creates too much overhead.

      or
      * As I am also check for distance when colliding I could create a
      timeout for two clips that are too far away from each other and skip
      checking on next frame. But I am not sure how to create the conditions
      without creating a new big overhead.


      What I am using now is to exclude clips from any collision detection
      when they are moving out the scene and won't collide anyway.


      Anyone seen nice concepts and theories on optimizing complex collision
      detection?

      thanks for any help - if anyone understands what I was trying to tell ;)