smooth bobbing movement in c++ tutorial