The invention discloses an automatic way-finding method in a scene based on a ThreeJS framework, and relates to the technical field of webpage 3D application programs, and the method comprises the following steps: obtaining the size of a floor object in the scene on a three-dimensional coordinate
system XOZ plane in advance, setting the unit length of a block grid unit to form a grid set, and setting the unit length of the block grid unit to form a three-dimensional coordinate
system XOZ; the starting coordinate of the upper left corner of the grid set in the three-dimensional coordinate
system, the coordinate of the center point of the first block grid unit and the column number and the row number of the grid set are calculated; according to the method, the optimal moving path between the two points is obtained in the scene based on the ThreeJS framework, the automatic path finding strategy in the 3D scene built by the ThreeJS is completed, the scene adaptability is high, the feasible path in the complex
terrain can be accurately calculated according to the geometrical shape and object distribution of the scene, the role can freely move in the diversified
terrain, and the effect of automatic path finding is achieved. According to the method, the path-finding accuracy and effectiveness are ensured, the method can be quickly integrated into a ThreeJS project, the automatic path-finding function is realized, and the development time and energy are saved.