Full Freely Rotation Look Script

Hi,

I’d like to create a mouse controller script and attach it to a camera. I’d like the controller to be able to do full 3D rotation.

I’ve tried a modified version of the FPS MouseLook script, but it’s a bit problematic.

Could somebody please point me to some resources that will explain how to do it.

Sorry for being a noob :S

I think what you’re experiencing is a “flipping” effect. I had a similar problem when I tried that. I just set y to -359, 359.

Hi Maker,

That’s the exact problem I had. Thanks for your solution.

Maj.

Spoke too soon.

I set 359 in Y and left 360 in x.

Still have the problem :frowning:

Also, I point directly up or down, I just get rotation around that direction rather than left/right rotation.

Don’t suppose you could shoot your script over :smile:

is it something like this you need?!

static function ClampAngle (angle : float, min : float, max : float) 
{
   if (angle < -360)
      angle += 360;
   if (angle > 360)
      angle -= 360;
   return Mathf.Clamp (angle, min, max);