How to make non-rectangular objects and track their intersection?
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?
Once upon a time wrote what you are looking for:
use something else, not vanilla js, you will drive off figs on itAnonymous
A physics engine is needed, for example Matter.js .Anonymous
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
To place the code, please use CodePen or similar tool. Thanks you!