As people spend more time indoors, the demand for indoor positioning is increasing. Two-dimensional indoor positioning technology makes it difficult to meet people's needs. Therefore, 3-D indoor positioning technology has become a current research hotspot. In this article, a 3-D pedestrian dead reckoning (PDR) positioning algorithm is designed to improve step detection, motion pattern recognition, step length estimation, and vertical motion distance calculation. A step detection algorithm is proposed to enhance the continuity and accuracy of indoor positioning, enabling it to accurately capture the start and end times of each step. In motion pattern recognition, a feature selection method is proposed, which utilizes the light gradient booster (LightGBM) algorithm to assess and select important features for motion pattern recognition, thereby improving recognition accuracy. To address the issue that the nonlinear step length (NSL) model cannot adapt to 3-D scenarios, an adaptive step length estimation model is designed, which can select the appropriate step length estimation model based on different motion patterns. In addition, to overcome the limitation of the traditional 2-D PDR algorithm in the vertical direction, a vertical motion distance calculation model is introduced, which utilizes the feedback control integral method to calculate the motion distance in the vertical direction. Experiments conducted in 3-D indoor environments indicate that the probability of the mean positioning error within 2.00 m exceeds 90.00%, with the mean error reduced to 1.09 m. Compared to the traditional 2-D PDR positioning algorithm, the algorithm designed in this article has improved the positioning accuracy by 58.08%, demonstrating the effectiveness of the 3-D PDR positioning algorithm designed in this article.