Fluid mechanics is a branch of physics that focuses on the study of the behavior and laws of motion of fluids, including gases, liquids, and plasmas. The Yu–Toda–Sasa–Fukuyama equation, a class of Kadomtsev–Petviashvili type equations, is a significant integrable model with applications in fluids and other fields. In this paper, we study breather and soliton solutions of a generalized (3 + 1)-dimensional YTSF equation. By utilizing the Hirota bilinear method and Painlevé analysis, we construct solutions in the form of trigonometric and hyperbolic functions and analyze the interaction between waves graphically. We consider the characteristics of wave distribution along characteristic lines to obtain the distance between each wave and the angle generated, which is beneficial for understanding the ocean wave superposition effect. Additionally, we examine the dynamic characteristics of the wave, such as amplitude, velocity, period, shape, position, width, and phase. Furthermore, we investigate the effects of the system parameters on solitons and breathers.