Vector3.ClampMagnitude uses pixels not relative distance for maxLength?

I’m using the Standard Assets joystick, and the movement range seems to be determined by pixels. On a retina device like my iPad, the joystick moves a very small distance, whereas on my lower PPI iMac, the distance is a lot greater. I assume it is because it’s using pixels not distance, but I could be wrong. I need it to move a constant distance (relative to screen size) no matter what the device.

		transform.position = Vector3.ClampMagnitude (new Vector3 (newPos.x, newPos.y, newPos.z), MovementRange) + m_StartPos;

The Vector3 struct does not know what a pixel is, it has no concept of it, it does not work in pixels, Vector3 works in numbers, what result you get out of that depends entirely on what “space” the numbers that you give it are in.

This means that your viewport space vs screen space issue is coming from where you are sourcing the values (in this case likely form input touch data (which will specify positions in screen space using pixels). But without seeing your code for that I’m purely making an assumption.

I tend to go down the route of converting input positions from touch into viewport space ( 0 to 1) and that way you can then apply it any arbitrary scale to put it back into screen space/world space. The way you handle this will also depend on what sort of UI you are using, as typically different UI solutions may model their “space” slightly differently.