Game Development Reference
In-Depth Information
20. A nonplayer character (NPC) is standing at location p with a forward
direction of v.
(a) How can the dot product be used to determine whether the point x
is in front of or behind the NPC?
−3
4
5 −2
(b) Let p =
. For each of the following points
x determine whether x is in front of or behind the NPC:
and v =
(1) x =
0
0
(2) x =
1
6
(3) x =
−6
0
(4) x =
−4
7
(5) x =
5
5
−3
0
(6) x =
(7) x =
−6 −3.5
21. Extending the concept from Exercise 20, consider the case where the NPC
has a limited field of view (FOV). If the total FOV angle is φ, then the
NPC can see to the left or right of its forward direction by a maximum
angle of φ/2.
(a) How can the dot product be used to determine whether the point x
is visible to the NPC?
(b) For each of the points x in Exercise 20 determine whether x is visible
to the NPC if its FOV is 90 .
(c) Suppose that the NPC's viewing distance is also limited to a maximum
distance of 7 units. Which points are visible to the NPC then?
22. Consider three points labeled a, b, and c in the xz plane of our left-handed
coordinate system, which represent waypoints on an NPC's path.
(a) How can the cross product be used to determine whether, when mov-
ing from a to b to c, the NPC makes a clockwise or counterclockwise
turn at b, when viewing the path from above?
(b) For each of the following sets of three points, determine whether the
NPC is turning clockwise or counterclockwise when moving from a to
b to c:
−1
(1) a =
2
0
3
, b =
0
5
, c =
−4
0
1
, c =
(2) a =
−3
0 −5
, b =
4
0
0
3
0
3
7
(3) a =
1
0
4
, b =
0 −1
, c =
−5
0 −6
(4) a =
−2
0
1
, b =
1
0
2
, c =
4
0
4
Search WWH ::




Custom Search