Game Development Reference
In-Depth Information
LQ
1
LV ,
(12.14)
t
=−
r
where
L is the plane parallel to L that has been offset by a distance eff
:
′ =
N
, D
r
.
(12.15)
L
eff
Again, we assume that the box is not initially intersecting the plane and that its
center lies on the positive side of
′ ⋅
Q
0
L at time
=
(i.e.,
L
). Therefore, if
t
0
1
L Q is also satisfied, then the box remains on the positive
side of the plane L , and no collision occurs.
Once we have determined that a collision between the box and the plane has
occurred (because the value of t given by Equation (12.14) satisfies 0
′ ⋅
the condition
0
2
), we
must determine the point or set of points at which contact has been made. If all
three of the quantities
≤<
t
1
TN are nonzero, then no edge of the
box is parallel to the plane L . In this case, the collision must occur at one of the
box's vertices. We can find a general formula for the position of the vertex that
makes contact with the plane by examining expressions for all eight of the box's
vertices. The position Z of each vertex of the box is given by
RN ,
SN , and
()
=
QRS
t
±
±
±
T .
(12.16)
Z
1
1
1
2
2
2
To find the vertex closest to the plane, we choose signs such that the dot product
LZ is minimized. This occurs when the quantities
TN are
all negative; so if any one is positive, we choose the corresponding negative sign
in Equation (12.16). The point of contact C is then given by
RN ,
SN , and
±
±
±
()
(
)
(
)
(
)
]
=
Q
t
sgn
R N R
+
sgn
S N S
+
sgn
T N T .
(12.17)
C
1
2
[
TN is zero,
the corresponding axis of the box is parallel to the plane, and any collision must
occur at an edge. The endpoints C and C of the edge are given by modifying
Equation (12.17) so that both signs are chosen for the term containing the zero
dot product. For instance, if
In the case that exactly one of the quantities
RN ,
SN , and
TN
=
0
, then we have
()
(
)
(
)
]
=
Q
t
1
sgn
R N R
+
sgn
S N S
±
T .
(12.18)
C
[
1, 2
2
This modification is taken one step further when two of the quantities
RN ,
TN are zero. In this case, the collision occurs at a face of the box
whose vertices are given by modifying Equation (12.17) so that both signs are
SN , and
Search Nedrilad ::




Custom Search