Game Development Reference
In-Depth Information
The dot product is very easy to calculate. We don't even need to bother with the formula
(though it's a simple one), because we can use the d ot(vector1, vector2) meth-
od.
So we have the vector for the rocket already. How do we get the vector for the normals?
First, we get the vector for the AB line. We use another method for this - point1 -
point2 . This will subtract points A and B and return a vector representing that line.
Next, we can get the left and right perpendiculars of that line vector with the
getPerp() and getRPerp() methods respectively. However, we only need to check
one of these. Then we get the dot product with dot(rocketVector,
lineNormal) .
Search WWH ::




Custom Search