Think Pong. Can I use EZGui to drag the paddle up and down on the iPhone?
Someone in another thread suggested that might be possible/easier with EZGui than other ways.
Yes: I did go thru all 41 pages here before posting this, and got discouraged by page 18, but thought I’d simply ask before giving up.
Suggestions, hints, pointers greatly appreciated.
(Yes, my need really is as simple as just dragging a slider on one axis via the user’s touch/drag… maybe there is a better way?)
Well, much easier than I thought without EZGui. And so as to supply the technique and lower the bandwidth, here’s my solution.
hth
// scaler is an adjustment for matching finger to object movement. I've used 8.
function Update () {
for (var touch : iPhoneTouch in iPhoneInput.touches) {
if (touch.phase == iPhoneTouchPhase.Moved) {
if (previousX == 0) {previousX = touch.position.x;
}
else{
var delta = touch.position.x - previousX;
previousX = touch.position.x;
//Debug.Log(delta);
t.Translate(Vector3.right * Time.deltaTime * delta * scaler);
}
}
}
}