The easiest way is to look at the direction the gun is pointing when you define the body, and use GetWorldVector to see how it has changed. For example if the gun is pointing directly upwards when you create the body, this would be the direction (0,1). Then you can use GetWorldVector at any time to get the current direction of that vector in world coordinates:
body->GetWorldVector( b2Vec2(0,1) );
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…