how to get real world coordinates of mouse position

Hi!

Does anyone know the conversion factor for Input.GetAxis (“Mouse X/Y”) to get the real world coordinates of the mouse? i.e. how much the optical mouse actually moved in the real world. Any input would be greatly appreciated :slight_smile:

Try camera.ScreenToWorldPoint() ? api reference

Input.GetAxis will return direct mouse delta values. It’s almost impossible to convert those deltas to pixel-deltas in your OS. The speed of the cursor depends on the OS mouse-sensitivity setting. If you need pixel deltas, just store the old position and calculate the pixel-delta yourself.

//C#
Vector3 oldPos;

void Update()
{
    Vector3 mPos = Input.mousePosition;
    Vector3 mDelta = mPos - oldPos;
    oldPos = mPos;
    //...

}

edit

If you really ment “real” world movement (in mm / cm / m) this is even more impossible since it totally depends on the DPI and sample rate of the optical sensor. You can’t even rely on the fact that everyone has an optical mouse.

A mouse has always been a relative movement device.