Rotate around Y axis with limits.

I spent the last hour doing something I thought would be simple. I just need to rotate something back and fourth via mouse input, and have it stop rotating when it gets greater than 90 degree or -90 from where it started.

From what I have tried, it either goes to far if you where moving fast or bounces when it gets to the edges.

How should I do this.

Look at the MouseLook script in Standard Assets, which does just that.

–Eric