From ff82253a66ee51fe2f0c088ca964402d53545845 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Thu, 24 Jun 2021 11:30:36 -0400 Subject: (mkosarek) Rigidbody with rotations --- 2d/_collisions/polygon_polygon.html | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to '2d/_collisions/polygon_polygon.html') diff --git a/2d/_collisions/polygon_polygon.html b/2d/_collisions/polygon_polygon.html index ce26f62..e8fe7ea 100644 --- a/2d/_collisions/polygon_polygon.html +++ b/2d/_collisions/polygon_polygon.html @@ -93,18 +93,35 @@

Given two polygons A and B:

    -
  1. For each edge on A, get the normal n of that edge.
  2. +
  3. For each edge on A, get the normal n of that edge.
  4. Project each vertex v of A onto n. Return the minimum and maximum projection of all vertices.
  5. Repeat Step 2 for polygon B.
  6. If the min and max projections found in Steps 2 and 3 do NOT overlap, the polygons are not intersecting. Return false.
  7. If the projections overlap for each edge of both shapes, the shapes are intersecting. Return true.
+ + And that is all there is to finding the intersection between two convex polygons. +

+ +
+

SAT Collision Resolution

+

+ Now that we know our objects have intersecting, we want to be able to send them tumbling away from each other to simulate a collision. To do this, we will need to find the following things: +

+ +

Collision Normal

+

+ +

-

- Live Example + Live Example of Intersection Detection

-- cgit v1.2.1