diff options
Diffstat (limited to '2d/_collisions/polygon_polygon.html.content')
-rw-r--r-- | 2d/_collisions/polygon_polygon.html.content | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/2d/_collisions/polygon_polygon.html.content b/2d/_collisions/polygon_polygon.html.content index 2d6f6b7..ffa9b15 100644 --- a/2d/_collisions/polygon_polygon.html.content +++ b/2d/_collisions/polygon_polygon.html.content @@ -41,18 +41,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> |