Game Development Reference
In-Depth Information
14. The line the player just drew between _rocket and pivot point, which we get by
subtracting ( Point.subtract ) those two points, has two perpendicular vec-
tors: one to the right (clockwise) that you get through Point.getRPerp and
one to the left (counterclockwise) that you get through Point.getPerp . We
use the angle of one of these vectors as the _rocket target rotation so the rocket
will rotate to be at 90 degrees with the line drawn in LineContainer . And we
find the correct perpendicular through the dot product of the _rocket current
vector and one of the perpendiculars ( Point.dot ).
Search WWH ::




Custom Search