[LibGDX][Box2D] 2 Objects, rotating incorrectly

I am in a bit of a mess here and not sure how I can do this, I am pretty damn sure using cos/sin was the answer but it does not seem to be the solution.

Basically I have 2 objects, a Spaceship and a Cannon.

The Spaceship is a Box2D body, it accelerates using W and decelerates using S, turns with A and D.

I then have the Cannon that sits on a specific spot on the Spaceship, this position being 0.5625 units to the right of the Spaceship body origin which is at 0, 0 (bottom left). My game is designed using pixel art, so 16 pixels = 1 unit, my ship is 16x8 pixels.
The cannon is 8x8 pixels.

So the cannon’s rotation is completely independent of the ship angle, the idea behind it is that you can free fly the ship where ever you want and have the cannon shooting in a totally different direction.

I have the cannon rotating on the spot, constantly facing the mouse. However as soon as you turn the ship, the cannon rotates around the origin of the body, when really I need to stay exactly where it is.

This has something to do with the way I position the cannon, I call the place it goes a “weapon mount”, which is essentially for now just a Vector2:


	protected Vector2 weaponMount = new Vector2();


	public void update(float delta) {
		weaponMount.set(getBody().getPosition().x + 0.5625f, getBody()
				.getPosition().y);
	}

This is where the problem lies I think, this above would only work if the bodies never rotated. Because if I take X and add that onto it when the angle is at 90°, it is going to be way off.

I am not sure what I should be using here? I thought if I used cos/sin but that does not seem to be any good. Here are some other snippets that might be of use, although I think this code is ok…



	@Override
	public void draw(SpriteBatch batch) {
		Vector3 mouse = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
		GameScreen.game.b2dCam.unproject(mouse);
		angle = MathUtils.atan2(-(owner.getWeaponMount().y - mouse.y),
				-(owner.getWeaponMount().x - mouse.x));
		sprite.setOrigin(width / 2, height / 2);
		sprite.setPosition(owner.getWeaponMount().x, owner.getWeaponMount().y);
		sprite.setRotation(MathUtils.radiansToDegrees * angle);
		sprite.draw(batch);
	}


Here is a screen shot of a ship at 0 degrees and one at 90, you can see the problem:

http://s26.postimg.org/mk1gwuzbd/Cannon_Fail.png

The weapon mount has to rotate with the parent sprite:


final float wepMountDistFromParentOrigin = 0.5625f; // excessive name I know, but descriptive

public void update(float delta) {
      weaponMount.set(getBody().getPosition().x + wepMountDistFromParentOrigin * Math.cos(/* parent rotation */), getBody().getPosition().y + wepMountDistFromParentOrigin * Math.sin(/* parent rotation */));
}