Skip to main content

Posts

Showing posts with the label 3D

SAT Collision Part 2

In this collision tutorial, we will take more in detail with how exact we get the normals and how we get the intervals.  However, I will not be going in detail regarding vector math needed to understand this, although it is simple and I will eventually post blogs regarding them. Down to business.  Our shape is composed of vertices.  In the case of this rectangle, there is four vertices, in red, and four normals, in brown.  The vertices are self explanatory and the normals describe the orientation or the way a side of the triangle is facing.  Take note that the vertices are defined such that the center of the triangle, not indicated in the picture, is at position(0,0) and all vertices defining the vertex is relative to this location; just like in a normal coordinate system. Now, to get the normal for a side of the rectangle we take two vertices defining an edge of the rectangle and subtract them.  Further, we swap the x, and y components and negate the new y component.  Then we norma