diff options
author | Matthew Kosarek <mattkae@protonmail.com> | 2021-06-24 11:30:36 -0400 |
---|---|---|
committer | Matthew Kosarek <mattkae@protonmail.com> | 2021-06-24 11:30:36 -0400 |
commit | ff82253a66ee51fe2f0c088ca964402d53545845 (patch) | |
tree | 69cd50843b0865dd521bff129a73400729254137 /2d/_collisions/polygon_polygon.html | |
parent | 322df8c2a1aa32210102b2924b44be6e20cdf8ae (diff) |
(mkosarek) Rigidbody with rotations
Diffstat (limited to '2d/_collisions/polygon_polygon.html')
-rw-r--r-- | 2d/_collisions/polygon_polygon.html | 23 |
1 files changed, 20 insertions, 3 deletions
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 @@ <p> Given two polygons <b>A</b> and <b>B</b>: <ol> - <li>For each edge on A, get the normal <i>n</i> of that edge.</li> + <li>For each edge on <b>A</b>, get the normal <i>n</i> of that edge.</li> <li>Project each vertex <i>v</i> of <b>A</b> onto <i>n</i>. Return the minimum and maximum projection of all vertices.</li> <li>Repeat Step 2 for polygon <b>B</b>.</li> <li>If the min and max projections found in Steps 2 and 3 do <b>NOT</b> overlap, the polygons are not intersecting. Return false.</li> <li>If the projections overlap for each edge of both shapes, the shapes are intersecting. Return true.</li> </ol> + + And that is all there is to <i>finding</i> the intersection between two convex polygons. + </p> + </section> + <section> + <h2>SAT Collision Resolution</h2> + <p> + 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: + <ul> + <li><b>Collision Normal</b>: in what direction, point towards object <b>A</b>, did the polygons intersect</li> + <li><b>Point of Application</b>: at what point on each object did the objects first intersect</li> + <li><b>Relative Velocity</b>: easily found by taking the difference between the two velocities. + </ul> + + <h3>Collision Normal</h3> + <p> + + </p> </p> - </section> <section> <h2> - Live Example + Live Example of Intersection Detection </h2> <div class="opengl_canvas_container"> <canvas id="gl_canvas" width="800" height="600"></canvas> |