def loadModelStateFromWaypoint(startingDir, excitePath, lastExciteValue):
    wpPath = startingDir + excitePath + str(lastExciteValue) + "_wp.txt"
    Main.getRootModel().getWayPoints().setAttachedFileName(wpPath)
    waypointFile = Main.getRootModel().getWayPoints().getAttachedFile()
    dis = DataInputStream(FileInputStream(waypointFile))
    dis.readInt()
    dis.readDouble()
    cs = Main.getRootModel().createState()
    cs.readBinary(dis)
    dis.readDouble()
    cs = Main.getRootModel().createState()
    cs.readBinary(dis)
    Main.getRootModel().setState(cs)
    Main.getRootModel().rerender()