Game Development Reference
In-Depth Information
Figure 7.4 Humanoid surrounded by a capsule (a), and a chair surrounded by a
convex polygon (b).
Another way to think of a capsule is as a line segment that has a radius, which ac-
tually corresponds to the representation of it in a game engine:
struct Capsule2D
Vector2 startPoint
Vector2 endPoint
float radius
end
Convex Polygons
Another option is to use an arbitrary convex polygon (or in 3D, a convex hull )
to represent the collision geometry. As you might expect, using an arbitrary con-
vex polygon will be less efficient than the other options, but it also can be more
accurate. Figure 7.4(b) shows a chair represented by a convex polygon. Although
there still will be many false positives, the number of false positives is less than in
alternative representations.
Search WWH ::




Custom Search