ABSTRACT This paper proposed a mechanical–electrical-hydraulic coupling dynamic modelling method for naval guns coupled with multiple nonlinear factors. The ship's rocking motion equation is derived based on the wave spectrum formula to introduce the influence of random wave excitation into the vibration analysis of naval guns. An efficient gear transmission model of the servo system is developed using a multibody contact-based model to control the computational cost and based on the tooth stiffness theory, the time-varying mesh stiffnesses are considered. The dynamic results show that the ship's rolling motion will have more influence on gun dynamic characteristics than the pitching motion. Though under the control of servo systems, the adverse influence of the ship's rocking motion on cradle motion is basically eliminated. The instantaneous residual disturbances of the cradle increase for the driving torque saturation and the residual disturbances of the cradle will increase gradually with the ship's rocking motion increasing.