Game Development Reference
In-Depth Information
Now we want the rocket to rotate around point B . So how can we change the rocket's vec-
tor to accomplish that? With Cocos2d-x, we can use the helper point method ro-
tateByAngle to rotate a point around any other point. In this case, we rotate the rock-
et's position point around point B by a certain angle.
But here's a question - in which direction should the rocket rotate?
By looking at this figure, you know that the rocket should rotate clockwise, since it's mov-
ing towards the right. But programmatically, how could we determine that, and in the easi-
est way possible? We can determine this by using vectors and another property derived
from them: the dot product.
Search WWH ::




Custom Search