Quick Links: Download Gideros Studio | Gideros Documentation | Gideros Development Center | Gideros community chat | DONATE
Gideros rounding touch coordinates — Gideros Forum

Gideros rounding touch coordinates

kussakovkussakov Member
edited December 2012 in Bugs and issues
Hi,

I just noticed something troubling. I noticed some jumpiness of the image movements, kinetic tests, etc. that are happening as a result of touches, so I did some digging and found this:

When I print touch event coordinates - they are all rounded (no decimal part).
Gideros application content size can be a lot smaller than the screen size - depending of the current device resolution.
Gideros is nicely built so that it converts all coordinates from the global coordinate system of the device to the application coordinate system (and v.v.).
This does not seem to be the case for touch coordinates - the touch coordinates are indeed converted to the local coordinate system, BUT are rounded up resulting incorrect and jumpy responses.

I am pretty sure I tested this before with older version of Gideros and this was not the case, but may be I am wrong.
I haven't noticed this jumpiness and incorrect (kinetic and move) behavior in older tests, so I thought I world ask.

Am I doing something wrong when getting the coordinates from the event? If so could you please tell me how to get the real non-rounded touch coordinates?
Or is Gideros indeed rounding them up. If so I would like know why and if this can possibly change?

If it is impossible to get real touch coordinates, could you tell me when did this change so that I can downgrade to older version of Gideros (provided that I am not wrong of course and this was working fine before)?

Thanks a lot for your help.

Vlad

Comments

  • Just wanted to give two examples. Say the project (landscape) is set to width 512 and ran on the new iPad (width 2048):
    1. If I have an object following my finger it jumps every 4 pixels.
    2. If I do a kinetic scrolling (which is very easy to do with Gideros by just remembering the final "speed" of the finger based on touch event coordinates and then feed it to the frame callback with some coefficient). This is no longer working correctly since the speed is not precise.
  • 1. well this makes sense, since logical dimensions are used instead of device resolution
    2. don't really understand what is a kinetic scroll, can you provide an example?
  • Yes. Exactly my point and my problem:
    When Gideros converts coordinates from the physical to logical dimension it uses FLOATING POINT numbers with a lot of precision.
    BUT when it converts touch coordinates it uses INTEGER number loosing a lot of precision (I know lua uses floating point internally, but these are rounded to integer)
    This was not the case before.
    There were several optimizations of the touches in Gideros in the last several releases. I think it is one of them that rounded the touch coordinates, but I can't be sure without downloading old releases, installing them and printing the touch coordinates.

    As for the kinetic scroll: This is simply when you swipe your finger over your zoomed scene (or scrollable list) it moves on its own for awhile until it slowly stops. This simple thing is not workig well when there is no precision in the touch coordinates.
  • atilimatilim Maintainer
    edited December 2012 Accepted Answer
    As far as I remember, I was always using integers at the last step of calculating mouse/touch coordinates.

    I can add two extra fields to mouse/touch events to provide unrounded coordinates like event.rx and event.ry (I cannot decide the name and I'm open to suggestions)
  • Thanks Atilim! So I was mistaken thinking that those we not rounded in prior releases.

    If you could do that - this will make the touch game play much smoother for bigger devices.
    I was actually printing all event table elements trying to find something like rx and ry and use it.
    "rx" and "ry" sound good to me. That is what I would use...
  • atilimatilim Maintainer
    Accepted Answer
    I've implemented it and it will be available with the next version.

    Likes: plamen

    +1 -1 (+1 / -0 )Share on Facebook
  • Thanks A LOT Atilim!!!
    You are the best!
  • Could this kind of integer calculation be responsible for the stuttering of scrolling in the iOS app store since iOS 6?

    Try the vertical columns of apps, with finger still touching, and scroll... it's not smooth like it used to be in all pervious scrolling of the app store. This is not a performance issue, as the moment you lift your finger the momentum scrolling is flawlessly smooth, it's something to do with the reading of or crunching of the touch data, I think.

    What you're describing, @kussakov - a rounding of a screen space significantly less than the resolution on iPad Retina, might be what's going on. It annoys me, no end, as I spend an inordinate amount of time browsing apps.
  • I suspect that what you are describing @dissisdiss is related so some slowness of Apple iTunes servers rather than touch data iOS 6 changes. Other scroll lists seem unaffected. Or may be Apple "optimized" their AppStore App to read more images/data in the background at once making scrolling jumpy... Or may me indeed they "optimized" the iPad touches :-)
  • I've noticed it in a couple of other parts of iOS since. I don't think it's got anything to do with the loading, it doesn't matter how loaded or unloaded it is, upon release the inertia scrolling is smooth as silk.

    Try the settings menu on your iPad, or the Notifications menu (mines LONG) and you'll see it stutter when your finger is on the screen, but goes back to how smooth it was prior to iOS 6 the moment you release your finger and the inertia part takes over.

    It's as though they're either sampling the touch's slide at a really low frame rate, or the touch position is being rounded as you're describing and that's causing a "stutter".
  • Atilim, tank you again for adding not rounded touch coordinates. Everyting related to touches became smooth and nice. A lot better than expected actually - especially on iPad retina.
Sign In or Register to comment.