getAxis() returns very different values for mouse vs touchscreen

Anyone got any idea why a project running on a 'nextwindow 2700' touchscreen yields wildly different values for the same code depending upon whether a mouse or the touchscreen is being used? Both mouse and touchscreen are attached via USB at the same time, so i'm not testing on different hardware, just different input mechanism to the same machine.

I'm using Input.GetAxis("Mouse X") and Input.GetAxis("Mouse Y") to control the camera orbiting around a subject. When using the mouse all is fine. Generally values are around -1 to 1, and maximum of +/- 5 units. However use the touchscreen and it leaps to something like +/- 140 units!

I've solved the issue by using a modifying factor to multiply the axis value by, thus returning it into a more reasonable range, however I'm left wondering why the touchscreen gives such different values, since its meant to be emulating a mouse and works fine for other projects developed with other programs and the OS.

I think it has something to do with touchscreen giving absolute values and mouse giving relative values...

Hi Noisecrime,

I have the same problem and i haven't solved this issue yet. Everything is perfect when using mouse but the object is constant when i try to touchscreen. I need your help. You can find the code below:

var target : Transform;

var distance = 5.0;

var xSpeed = 250.0;

var ySpeed = 120.0 ;

var yMinLimit = -20;

var yMaxLimit = 80;

var zoomRate = 20;

private var x = 0.0;

private var y = 0.0;

@script AddComponentMenu("Camera-Control/Mouse Orbit")

function Start () {

var angles = transform.eulerAngles;

x = angles.y + 20;

y = angles.x;

// Make the rigid body not change rotation

}

function Update () {

if (target) {

    if (Input.GetMouseButton(0)||Input.GetMouseButton(0))

    {

    x += Input.GetAxis("Mouse X") * xSpeed * 0.02;

    y -= Input.GetAxis("Mouse Y") * ySpeed * 0.02;

    var test = 0;

    test = y;

    }

    distance += -(Input.GetAxis("Mouse ScrollWheel") * Time.deltaTime) * zoomRate * Mathf.Abs(distance);

     if (distance < 2.5)

     {

         distance = 2.5;

     }

     if (distance > 20)

     {

         distance = 20;

     }

     y = ClampAngle(y, yMinLimit, yMaxLimit);

     //Debug.Log("y: "+y+" test: "+test);

     if( y == yMinLimit && test == yMinLimit)

     {

         // This is to allow the camera to slide across the bottom if the player is too low in the y

         distance += -(Input.GetAxis("Mouse Y") * Time.deltaTime) * 10 * Mathf.Abs(distance);

     }

    var rotation = Quaternion.Euler(y, x, 0);

    var position = rotation * Vector3(0.0, 1.0, -distance) + target.position;

    //Debug.Log("Distance: "+distance);

    transform.rotation = rotation;

    transform.position = position;

}

}

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);

}