Just though of another way to stop sideways motion. Check every frame if the view has moved in any direction other than forward or back.
Code:
#sudo code
#every frame
displacementVector = currentViewPosVector - lastViewPosVector
headingDisplacementVector = vizmat.LookToQuat(displacementVector))
viewDisplacementHeadingDiff = vizmat.QuatDiff(headingDisplacementVector, viz.MainView.getQuat())
if viewDisplacementHeadingDiff != 0 or viewDisplacementHeadingDiff != 180:
viz.MainView.setPosition(lastViewPos) #stop