From a56ccb7392f9f7d0178c17fcef0bf60a1e7de705 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Tue, 6 Jul 2021 20:24:05 -0400 Subject: (mkosarek) Done enough with SAT collisions for now --- 2d/_collisions/polygon_polygon.html | 5 +++++ 2d/_collisions/polygon_polygon.html.content | 3 +++ 2d/_collisions/polygon_polygon/dist/output.wasm | Bin 57746 -> 58079 bytes 2d/_collisions/polygon_polygon/main.cpp | 23 ++++++++++++++++++++++- 2d/_collisions/polygon_polygon/snippet2.cpp | 2 ++ 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/2d/_collisions/polygon_polygon.html b/2d/_collisions/polygon_polygon.html index 9826ba4..ace2c17 100644 --- a/2d/_collisions/polygon_polygon.html +++ b/2d/_collisions/polygon_polygon.html @@ -312,6 +312,8 @@ // the collision later. ProjectionResult getProjection(Vector2* vertices, int numVertices, Vector2 axis) { ProjectionResult pr; + pr.minVertex = vertices[0]; + pr.maxVertex = vertices[0]; float32 min = axis.dot(vertices[0]); float32 max = min; @@ -404,6 +406,9 @@ IntersectionResult getIntersection(ConvexPolygon* first, ConvexPolygon* second)

Live Example of Intersection Detection

+

+ A live example of Separating Axis Theorem running with full collision detection. Click to reverse gravity on the simualtion. +

to reverse gravity on the simualtion. +