This study used Unity3D to develop a simulation system for obstacle avoidance and path planning in mobile robots, based on an improved RRT algorithm, combined with the artificial potential field method. Modeling the environment through Maya, Blender, Unity TerrainTools, and other tools, including obstacles, starts, and ends. The improved RRT algorithm introduces the artificial potential field to make the robot have the autonomous obstacle avoidance ability, and improves the path planning speed, efficiency and path smoothness. Compared with the traditional RRT algorithm shows that the improved algorithm is superior in path planning. The research innovation lies in the improvement of the RRT algorithm, combined with the artificial potential field method to make up for the shortcomings of the traditional method, and has a wide application potential of autonomous obstacle avoidance and path planning.