Hello,
I’ve been searching the forum for an answer to my multitouch issue, but unfortuantely haven’t been very lucky so far.
I guess it’s either a basic thinggy or I’m completely off road ![]()
Alright, my scene basically contains 3 objects. Let’s call them BoxA, BoxB and BoxC. Now, each object has its own script, handeling touch input data. In order to keep things simple, lets say, I want to rotate these boxes, when touching them.
So, what happens now is this. I can perfectly touch and rotate each Box individually, but as soon as I try to rotate BoxA and BoxB at the same time, things stop to work. I do understand, that this requires multitouch to be enabled and that’s what I did. On top of each script, I put:
static var multiTouchEnabled = true;
I already have a feeling, that this is not enough and I kinda sense, that I might have to handle all multitouch input from within a single script. Is that right?
Let me share the script with you, that is in BoxA, B and C:
function Update () {
for (var touch : iPhoneTouch in iPhoneInput.touches) {
if (touch.phase == iPhoneTouchPhase.Moved) {
if (collider.Raycast (ray, hit, 100)) {
var touchDeltaPosition:Vector2 = iPhoneInput.GetTouch(0).deltaPosition;
transform.Rotate (0,touchDeltaPosition.x,0);
}
}
}
}
I guess my mistake was to believe, that the device would process all the touchinput data for every script individually. In other words: If I have 2 scripts and both contain touch methods, it would automatically execute them when needed. Even if that meant, running 2 scripts simultaenously.
Any help appreciated. Thanks in advance