Aiming at the shortage of the actual experimental equipment, virtual reality technology was adopted for setting up an experiment system. The framework is the strange IoC and the engine is Unity3D for the system. A step operation of the experiment is divided into five parts, interaction behavior, interaction part, response part, active change and passive change. To meet IoC, interaction behavior is set as finite state machine (FSM) and change is set as model. Then the flow chart of the IoC system is given to implement the virtual experiment. The key technology is model and FSM.Then modeling methods are given for response behavior model and result model. Moreover the flow of implementing FSM is given. Finally an experiment instance shows the system is useful and valuable.