Game Development Reference
In-Depth Information
return false
end
loop
// Have to test the last side, which is from
last vertex to first
side = verts [0] - verts [ numSides - 1]
to = point - verts [ numSides - 1]
cross = CrossProduct( side , to )
cross .Normalize()
if DotProduct( cross , normal ) < 0
return false
end
// We're inside all sides
return true
end
Sphere versus Plane Intersection
In a game where a ball can collide with a wall, in order to accurately model the
collision it might be desirable to use sphere-plane intersection. Given that we only
store and d for a plane, the easiest way to perform this collision check is to cal-
culate d for a hypothetical second plane with the same that contains the center of
the sphere. If the absolute value of the difference between this new plane's d and
the actual plane's d is less than the sphere's radius, it means they must intersect.
This process is illustrated in Figure 7.9 .
Search WWH ::




Custom Search