Better MouseOrbit required for newbee

Forgive me if this has been asked and answered elsewhere but I cannot find a solution that works for me, I am new to unity and scripting knowledge is limited so I would appreciate so need a rather dumb ass type help on this!

I want to create a way to view an object so that the user can 360 pan/rotate around move up and down..... This is my first test using MouseOrbit:

But I would like the camera to rotate more like this flash example -

As you can see the car version works a little better as when you let go of mouse button and move it away the object freezes so the user can continue viewing it from that angle where my unity version continues moving even when your mouse pointer is not on the web browser screen.

Hope that makes send, really like Unity so far!

Thanks for your help,


You could define a rectangle and use Rect.Contains.

There is also a thread in the forums: Knowing when a web game loses focus


If you are using the “Camera-Control/Mouse Orbit” script you could modify it like this:

//put this inside the Start or an Update function
var rect = Rect (0, 0, Screen.width, Screen.height); 

function LateUpdate () {
  if (rect.Contains(Input.mousePosition)) {
    ... // put everything from the original LateUpdate function here

With this script you get a rectangle with the actual size of the player window and only if the mouse pointer is inside this rectangle the code inside the LateUpdate function (the camera movement) will be executed.