First of all, sorry! This will probably be a solution with a terrible amount of math in it.
At least you get an image
I want the projectiles to spawn at the end of the gun-barrel. Each gun has an offset calculated from its attachments (silencer etc.) and the basic gun-length
How would I go about figuring out the spawnpoint for the projectiles when I rotate the arms?
Note: good time to check out image before continuing
I was thinking I could save a variable with a fixed point in the gun-class (the calculation in bold above) for when it's pointing directly right, so I know how long the gun is at all times. But with a rotation around an anchor, I can't just use circle-calculations.
I might also just rotate around the top-left, and somehow calculate the offset between the shoulder-point and the junction-point on the rotated image, but how?
Have any of you guys done this before? Any suggestions? Maybe there's some other way of doing the rotation of the arms and gun that would work, and still make sure they're in the right place at his shoulders.
Note: This is using nothing but Java2D. I know. Next project I'll use LWJGL