Game Development Reference
Figure 11.2. Tetrahedron (triangle) intersecting the world geometry.
Figure 11.3. Stick intersecting the world geometry in two different ways.
In an analogous way, collisions that take place on a face of the tetrahedrons
or even inside the tetrahedron will require moving three or all four particles to fix
the penetration. Let p be the penetration point on the tetrahedron and q be the one
on the obstacle. To handle any type of collision, follow the procedure described
First, express p as a linear combination of the four particles that make up the
tetrahedron: p = c 1 x 1 + c 2 x 2 + c 3 x 3 + c 4 x 4 such that the weights sum to one:
c 1 + c 2 + c 3 + c 4 =1(this calls for solving a small system of linear equations).
After finding d = q
p , compute the value
c 1 + c 2 + c 3 + c 4
( λ is a so-called Lagrange multiplier). The new particle positions are then given