How to make the character move only left and right when it enters trigger box


This is what I did so far. the only thing thats missing is limited the controls and making the camera follow the character in the 2D view angle.