Reader small image

You're reading from  Game Physics Cookbook

Product typeBook
Published inMar 2017
Reading LevelIntermediate
PublisherPackt
ISBN-139781787123663
Edition1st Edition
Languages
Tools
Concepts
Right arrow
Author (1)
Gabor Szauer
Gabor Szauer
author image
Gabor Szauer

Gabor Szauer has been making games since 2010. He graduated from Full Sail University in 2010 with a bachelor's degree in game development. Gabor maintains an active Twitter presence, and maintains a programming-oriented game development blog. Gabor's previously published books are Game Physics Programming Cookbook and Lua Quick Start Guide, both published by Packt.
Read more about Gabor Szauer

Right arrow

Separating Axis Theorem


The Separating Axis Theorem (SAT) can be used to determine if two arbitrary shapes intersect. Both shapes being tested must be convex. The SAT works by looking for at least one axis of separation between two objects. If no axis of separation exists, the objects are colliding. An axis of separation can be represented by any arbitrary plane:

The first step in the SAT is to find an axis that we want to test for separation. In the example image above, the two oriented bounding boxes can havewo possible axes of separation. The X axis (1, 0) or the Y axis (0, 1) can separate these boxes.

Once we have figured out the axis of potential separation, we project both shapes onto the axis being tested. This projection results in a set of points. The minimum and maximum points of this projection create an Interval. An interval is like a line; in the above image you can see four intervals, one on the X axis for both objects and one on the Y axis for both objects:

Once we know the interval...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Game Physics Cookbook
Published in: Mar 2017Publisher: PacktISBN-13: 9781787123663

Author (1)

author image
Gabor Szauer

Gabor Szauer has been making games since 2010. He graduated from Full Sail University in 2010 with a bachelor's degree in game development. Gabor maintains an active Twitter presence, and maintains a programming-oriented game development blog. Gabor's previously published books are Game Physics Programming Cookbook and Lua Quick Start Guide, both published by Packt.
Read more about Gabor Szauer