How to make non-rectangular objects and track their intersection?

  • 0
    The task is to make something like a game: objects spawn, and the player dodges them.

    I coped with the main task, but due to the fact that all objects (including the player) are rectangular and the intersection is also searched for rectangles, it looks rather crooked.

    How to make objects complex shapes and trigger on object intersections?
    Maybe there are some libraries?
    JavaScript Greyson McIntyre, Oct 19, 2019

  • 3 Answers
  • 0
    Once upon a time wrote what you are looking for:



    use something else, not vanilla js, you will drive off figs on it
    Anonymous

  • 0
    A physics engine is needed, for example Matter.js .
    Anonymous

  • 0
    Intuitively, it seems that for the intersection of two polygons, either any vertex of one polygon must be inside the other, or the polygons have intersecting sides.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!