Getting "mouse" input from Unity Remote (on iPad)

Hi there,

I have a simple first-person camera setup - i.e., you use the mouse to look around.

Now I’m trying Unity Remote with my iPad, and I thought that “swipe” gestures (touch and drag) would come in as emulated mouse input. I’m getting mouse click events when I tap the iPad screen, but I’m not getting mouse axis input.

So this works (.js code):

if(Input.GetButton("Fire1") || Input.GetKeyDown ("z")) {
    //Fire1 works
}

But this doesn’t (.cs code):

inputX += Input.GetAxis("Horizontal") * sensitivityX;
inputY += Input.GetAxis("Vertical") * sensitivityY;
//inputX and inputY don't change when I swipe the iPad screen

I have set up Horizontal and Vertical as type “Mouse Movement” in the Input Manager, and it works fine with an actual mouse.

What do I need to do to get “mouse-like” input from the iPad? Am I simply doing it wrong?

I will keep experimenting, but any help appreciated!

Thanks.

I think you are doing it wrong.
You have to go the route of input.touches and looping thru them.

One little tip here is to make sure you do your input polling in a fixedupdate, seems to work more reliably.

http://unity3d.com/support/documentation/ScriptReference/Input.GetTouch.html

is this what your looking for?

Youll notice how the camera acts weird when rotating on both axises at the same time, so youll have to kinda hybrid it with the MouseOrbit script so its smooth.

Thanks for the responses.

I collated my (successful) experiments into a mini-tutorial here:

http://www.unifycommunity.com/wiki/index.php?title=Basic_iOs_Input_Tutorial