Game Development Reference
In-Depth Information
Figure 7.11 Swept sphere intersection.
You might notice that a swept sphere looks a lot like a capsule. That's because a
swept sphere is a capsule. A swept sphere has a start point, end point, and a radius,
which is exactly like a capsule. So the algorithm discussed here can also be used
for “capsule versus capsule” intersection.
As with “line segment versus plane” intersection, it's useful to solve the equation
first. It also turns out that solving the swept sphere equation is an extremely pop-
ular question during game programming interviews, because it requires a good
grasp of many of the core linear algebra concepts that are expected from a game
programmer.
Given a position of the sphere's last frame and current frame, it's possible to con-
vert the position of the sphere into a parametric function. The process of convert-
ing it to a function equation ends up being identical to the process used for a ray
cast. So given sphere P and sphere Q, we can express the position of both as sep-
arate parametric functions:
Search WWH ::




Custom Search