Game Development Reference

In-Depth Information

Figure 13.10 Finding a separating plane using object faces.

the face unit normal and a vector from a vertex on the face to each vertex

on the colliding mesh. If this test is positive for every vertex then the face

is a separating plane. If no face conforms to this test then a collision is

unlikely but can still have occurred if, instead of a vertex from the colliding

mesh being inside the collision object, an edge is.

To check this, we create a plane out of every edge in the collision target

and every vertex in the colliding mesh. Having created this plane, we then

check every other vertex in the colliding mesh with a normal of this test

plane; if the dot product is consistently positive then no collision has

occurred.

Unfortunately, the number of tests to confirm face level accuracy is

huge and involves a large number of normalized vectors, using the

computationally expensive square root operation. Also, the techniques

only work on convex meshes. A way to reduce the calculations is to flag

Figure 13.11 Finding a separating plane using object edges.

Search Nedrilad ::

Custom Search