Heres my project…
I bascially want whats going on here, but cant figure out how to go about doing it.
- I need to test the x,y distance from the center of the screen and the cursor (represented by a sphere) so that i can rotate an object (like the camera) and have it all stay with the camera.
(you shouldnt see the mouse cursor, and the small sphere should move as fast as the mouse cursor would move if it were directly attached to it)
The outer black circle needs to stop the cursor (if there was one). (the only way i could get this to work was making an inside out big sphere in which to move the small sphere inside and collide, you cant see it because its invisible. I think this would be adequate, but the small sphere is very easy to break out of the jail its in, and its VERY unstable looking, AND it hangs on the outer sphere. Nothing smooth about whats going on in there.
Id preferrably like to do all this in 2d if possible.
This mockup should give you an idea of what im trying to achieve.in 2d.
I dont directly need you to write code for me, but maybe pointing me in the right directions would really help.
I think this could all work in 3d the way I have it if i knew how to make that inner sphere be directly attached to the mouse and also stop, and replace the default mouse with a crosshair.
468736–16436–$Notgood.rar (441 KB)
468736–16437–$WebplayerVersion.rar (68.8 KB)
If you just check the cursor’s distance from the center of a sphere/circle, you can use a radius check -
var cursorRadius : float; // how fat the cursor is
var limitRadius : float; // how large (in pixels)
var limitCenter : Vector3; // the center of the limiting sphere/circle
var cursor: Transform; // visual representation of cursor
function Start() {
limitRadius -= cursorRadius; // this makes the object only able to get (cursorRadius) close to the limit
}
function Update() {
// get cursor's 3D position somehow, either by mouse position or mouse delta, doesn't matter - store that in "tempPosition : Vector3"
tempPosition -= limitCenter;
if ( tempPosition.magnitude > limitRadius ) tempPosition = tempPosition.normalized * limitRadius;
cursor.position = tempPosition + limitCenter;
}
If you want ellipses/ellipsoids, you’ll have to use sine and cosine which I am terrible at to find the radius at a certain angle, but you can still use “vector3.normalized * radiusAtAngle( angle )”
I can’t run Unity on this laptop, so that’s untested, but hopefully it’s close enough to help solve your issue. 
Edit: Oh, just saw the second question there
To replace the mouse cursor, use Screen.lockCursor = true (you’ll want to put that in Start and in your mouse-click input code, I believe, as whenever the application loses focus it is set back to true). Once that’s done you can store the mouse position as an x,y value and modify that with the mouse delta movement (since lockCursor locks the mouse to centerscreen).
var mousepos : Vector2 = Vector2(Screen.width/2, Screen.height/2);
function Update() {
var screenCenter : Vector2 = Vector2(Screen.width/2, Screen.height/2);
mousepos += Input.mousePosition - screenCenter; // add the mouse's movement to our simulated mouse position
if ( Input.GetKeyDown( KeyCode.Mouse0 ) ) Screen.lockCursor; // lock cursor whenever we get clicked
}
Something like that, I hope.
looks like a bunch of really useful stuff. ill check it out in a little bit. funny that i have a lot of the same code that you wrote, written down in different ways. like the whole screen center thing i almost have letter for letter. but the simple addition of one line changes the whole thing to operate differently.
i love coding 
No, I think a simple sphere will be fine. Lol. But thanks for that anyway.
And edit: again
So what you described there will basically make the cursor “feel” as if its where the mouse would be and not like the cursor is “following” where the mouse is?
Ill be testing it shortly and prolly edit this post a 3rd time lol. Im too lazy to actually open unity right now. After last night, im sortof disgruntled.
ok this script here seems to work somewhat.
the sphere that i attached it to revolves around the outer edge of a circle and doesnt move inside or outside of that path. thats almost right but i want that sphere to be able to move within the boundaries of that circle too.
heres your code modified to actually work or rather do something. (copy pasting made some funny effects)
(p.s. please note too that we’re trying to get this done in 2d in the other topic… lol.)
(and a bug: when the mouse is clicked, the sphere doesnt move with this script.)
var cursorRadius : float; // how fat the cursor is
var limitRadius : float; // how large (in pixels)
var limitCenter : Vector3; // the center of the limiting sphere/circle
var cursor: Transform; // visual representation of cursor
var mousepos : Vector2 = Vector2(Screen.width/2, Screen.height/2);
function Start() {
limitRadius -= cursorRadius; // this makes the object only able to get (cursorRadius) close to the limit
}
function Update() {
var screenCenter : Vector2 = Vector2(Screen.width/2, Screen.height/2);
mousepos += Input.mousePosition - screenCenter; // add the mouse's movement to our simulated mouse position
if ( Input.GetKeyDown( KeyCode.Mouse0 ) ){
Screen.lockCursor = true; // lock cursor whenever we get clicked
mousepos -= limitCenter;
}
if ( mousepos.magnitude > limitRadius ){
mousepos = mousepos.normalized * limitRadius;
cursor.position = mousepos + limitCenter;
}
}