Game Development Reference
In-Depth Information
(b) (1) v
ab
= [−3, 0, 2 ]. v
bc
= [−3, 0, −4 ]. x
bc
z
ab
− x
ab
z
bc
= (−3)(2) − (−3)(−4) =
−18 < 0. Thus, the NPC is turning counterclockwise.
(2) v
ab
= [ 7, 0, 5 ]. v
bc
= [−1, 0, 3 ]. x
bc
z
ab
−x
ab
z
bc
= (−1)(5)−(7)(3) = −26 < 0.
Thus, the NPC is turning counterclockwise.
(3) v
ab
= [ 6, 0, −5 ]. v
bc
= [−12, 0, −5 ]. x
bc
z
ab
−x
ab
z
bc
= (−12)(−5)−(6)(−5) =
90 > 0. Thus, the NPC is turning clockwise.
(4) v
ab
= [ 3, 0, 1 ]. v
bc
= [ 3, 0, 2 ]. x
bc
z
ab
− x
ab
z
bc
= (3)(1) − (3)(2) = −3 < 0.
Thus, the NPC is turning counterclockwise.
23. p
′
= p + (k −1) (pn) n
2
4
3
5
0
@
2
4
3
5
2
4
3
5
1
A
2
4
3
5
1
0
0
1
0
0
n
x
n
y
n
z
n
x
n
y
n
z
=
+ (k −1)
2
4
3
5
2
4
3
5
1
0
0
n
x
n
y
n
z
=
+ (k −1) (n
x
)
2
3
2
3
(k −1) n
x
2
(k −1) n
x
n
y
(k −1) n
x
n
z
1
0
0
4
5
4
5
=
+
2
4
3
5
1 + (k −1) n
x
2
(k −1) n
x
n
y
(k −1) n
x
n
z
=
24. p
′
= cos θ (p−(pn) n) + sin θ (n×p) + (pn) n
0
@
2
4
3
5
0
@
2
4
3
5
2
4
3
5
1
A
2
4
3
5
1
A
0
@
2
4
3
5
2
4
3
5
1
A
0
@
2
4
3
5
2
4
3
5
1
A
2
4
3
5
1
0
0
1
0
0
n
x
n
y
n
z
n
x
n
y
n
z
n
x
n
y
n
z
1
0
0
1
0
0
n
x
n
y
n
z
n
x
n
y
n
z
= cos θ
−
+sin θ
×
+
0
@
2
4
3
5
2
4
3
5
1
A
2
4
3
5
2
4
3
5
1
0
0
n
x
n
y
n
z
0
n
z
−n
y
n
x
n
y
n
z
= cos θ
−n
x
+ sin θ
+ n
x
2
3
2
3
2
3
1−n
x
2
−n
x
n
y
−n
x
n
z
n
x
2
n
x
n
y
n
x
n
z
0
n
z
−n
y
4
5
4
5
4
5
= cos θ
+ sin θ
+
2
4
3
5
2
4
3
5
2
4
3
5
cos θ −n
x
2
cos θ
−n
x
n
y
cos θ
−n
x
n
z
cos θ
n
x
2
n
x
n
y
n
x
n
z
0
n
z
sin θ
−n
y
sin θ
=
+
+
2
4
3
5
cos θ −n
x
2
cos θ + n
x
2
−n
x
n
y
cos θ + n
z
sin θ + n
x
n
y
−n
x
n
z
cos θ −n
y
sin θ + n
x
n
z
=
2
4
3
5
n
x
2
(1−cos θ) + cos θ
n
x
n
y
(1−cos θ) + n
z
sin θ
n
x
n
z
(1−cos θ)−n
y
sin θ
=
Search WWH ::
Custom Search