Magnetic compass adjustment is an indispensable work during ship operation, and its procedure can not be simulated in a real ship by traditional teaching methods, which has become a bottleneck to magnetic compass learners. The procedure of magnetic compass adjustment is simulated by virtual reality modeling language(VRML). Three-dimensional interactive demonstrations of magnetic compass’ structure and adjustment procedure are implemented. So learners will have a direct cognition to the adjustment procedure of heeling deviation, semicircular deviation and quadrantal deviation. The realization process of simulation in the virtual reality environment is described in detail and the relevant source codes are given.