A bit blockedI'm currently blocked, I know the algorithm I want to implement, but I can't seem to pull it out.
I have an arm with a plank at the end. This arm rotates around a central point. What I need now is to check for collisions with the "bullets". My algorithm is as follows:
I create a rect at (0,0)
for every bullet when it needs to check collision I do the following:
1 get the center (easy from the rect)
2 substract the position of the center of the plank (easy as well, as I have a distance and an angle)
3 apply a rotation matrix on the center point
4 create a rect from that point with size of the bullet
5 check collision between the (0,0) rect and the new one
I'm pretty sure I'm having problems rotating the point, but I have tried several approaches and all seem to fail. I'll get some rest and try again later.
If anyone wants to check the code. I've got it on Github
More direct code access in a gist .
The link for the gist is https://gist.github.com/2653909, I can't get it to work either T_T
Comments: (log in to comment)