Game Development Reference
In-Depth Information
V
P
1
P
2
V
Q
P
2
Q
1
Figure 12.7. Detecting a collision between two moving spheres.
()
()
PPV
Q
t
=+
=+
t
1
P
t
QV .
t
(12.29)
1
Q
Let r and r be the radii of the two spheres. We wish to determine whether
the distance d between the centers
()
()
P
t
and
t
is ever equal to P
rr
+
at some
Q
Q
)
time
. If so, then the spheres are tangent to each other at time t , and a col-
lision has taken place. We examine the squared distance between
0,1
t
[
()
()
P
t
and
t
Q
given by
2
PQ .
()
()
2
(12.30)
d
=
t
t
()
()
Substituting the values given by Equation (12.29) for
P
t
and
t
, we have
Q
2
d
=+ −−
PVQ V .
t
t
2
(12.31)
1
P
1
Q
For convenience, we define
AP Q
BV V
=−
=−
1
1
(12.32)
P
Q
so that Equation (12.31) can be written as
Search Nedrilad ::




Custom Search