Improvement to 3D Rotation Lag

2 replies [Last post]
Sk8St4r
User offline. Last seen 11 years 10 weeks ago. Offline
Joined: 06/17/2009
Posts:

I do not know if anyone has already realized that behaviour...if you perform a manual rotation via swipe gesture there is sometimes a little lag.
This is the result of the rotation design and the iOS having to decide if a double/single tap occured. Consequently, the very first call of touchesMoved takes longer than subsequent calls. Therefore it would be better to store the very first touch location in touchesMoved and not in touchesBegan.

like

touchesBegan:
if (swipe) flag=YES; // ...swipe => [totalTouches count] ==1

touchesMoved:
if (swipe && flag) { //very first call of touchesMoved with a swipe gesture
previousLocation=[[touches anyObject] locationInView:modelView];
flag=NO;
}
else {
...execute standard code
}

If you set the previousLocation already in touchesBegan the gap between the first two coordinates is too big and rotation will result in a "jump" from one scene to another
(Actually translation and scaling shows the same behaviour...so you could apply the same technique to them as well)

I know that this is not the most elegant way to compensate the lag but well... it works! ;)

Brad Larson
Brad Larson's picture
User offline. Last seen 4 years 50 weeks ago. Offline
Joined: 05/14/2008
Posts:

Interesting. I guess I hadn't noticed that, but I can easily try out the fix you've suggested. Thanks for pointing it out, along with the code.

Will
User offline. Last seen 11 years 8 weeks ago. Offline
Joined: 10/13/2010
Posts:

This is talked about in sessions 121, advanced gesture recognition. Fail early, fail often. I think the lag is caused by both the gestures being possible and delaying initial touches.

By the way, I love your captcha, Brad.

Syndicate content