Hull deformations are caused by factors such as loading status, wave load, diving depth of underwater vehicles, etc. This causes a change in the shafting alignment state of the ship's propulsion shafting.This affects the alignment state of the ship propulsion shafting. It is very important for engineering significance to research an online monitoring method of propulsion shafting alignment that adapts to the influence of hull deformation. Based on Euler's rigid body attitude theory, this paper constructs a spatial attitude relationship model of the main and driven shafts of the ship's propulsion shafting. By converting to a fixed earth coordinate system, their absolute position-posture can be obtained. Using laser displacement sensor measurement technology, an online monitoring method of propulsion shafting alignment that adapts to the influence of hull deformation is established, which was verified by experiments. This method is suitable for situations where both the main shaft and the driven shaft may have rigid body posture changes. It can provide shafting alignment control compensation for the influence of hull deformation under different working conditions. This will greatly reduce the operating noise of the shaft system and the mechanical operation failure caused by the misalignment of the ship's propulsion shafting.