x


if I lock iPhone fps to 24fps, can I get more accurate touch timings than that?

at 24fps it's 41.66 milliseconds between frames. Can I get more accurate information about the timings of the players tap/touches of the screen than that, or the reports on touch time locked to the fps?

I want to know the EXACT moment in time between touches. Or as exact as the iPhone clock enables whilst running a game.

Consider 24fps an arbitrary frame rate. It could be 30fps, 60fps or any other rate the iPhone funs at. The point of interest is exact measurement of tap times independent of frame rate. Possible how?

more ▼

asked Mar 12, 2011 at 09:26 AM

dissidently gravatar image

dissidently
475 133 108 116

(comments are locked)
10|3000 characters needed characters left

3 answers: sort oldest

The iPhone screen doesn't do 24 fps, it's vsynced always, so you get 60 fps or 30 fps (or 15 I suppose). In any case, as the docs say, "You can retrieve the status of each finger touching the screen during the last frame by accessing the Input.touches property array."

more ▼

answered Mar 12, 2011 at 09:57 AM

Eric5h5 gravatar image

Eric5h5
111k 55 189 672

I believe deltaTime measures in seconds as the rest of the framework does so. So a value of 0.1 delta time means 0.1 seconds since last change.

Mar 16, 2011 at 02:30 PM Statement

You forgot 20 fps. Also, the profiler tells me I can get ~40ms frame times, too, suggesting 25 is possible. ???

Mar 12, 2011 at 03:45 PM Jessy
(comments are locked)
10|3000 characters needed characters left

This might be a slight far shot since I have absolutely zero experience with iPhone and developing for it.

I just thought I'd mention that if (and only if) there is a thread safe way of polling the touch data, either via Unity3D or via some other library (if that is supported on iPhone), and if (and only if) you can create threads on iPhone, then;

Create a new thread that samples the data at your fixed intervals and produce a message queue with the samples that you can use in Update via a synchronized Queue. This will in theory allow you to sample input at a higher frequency than your game is updating. You'd typically have to dequeue all of the results to get to the data you're after (maybe you want to smooth it over time or maybe you just want to check for rapid, fine granular movements).

See Queue.Synchronized, Threading, and Threading Tutorial.

This will only work if you can create threads and access input directly. Otherwise this answer is moot and offer no value.

more ▼

answered Mar 16, 2011 at 02:12 PM

Statement gravatar image

Statement
26.2k 76 114 252

so the answer is, "for exact measurements of tap timings use Objective-C?

Mar 16, 2011 at 04:30 PM dissidently

No, not really. The answer is "if unity iPhone support libs and threads, then you can make a new thread and call the lib that can provide such polling". I don't know enough iPhone development to know fully what is supported or not, but in an ideal world you wouldn't have to touch Objective-C for this task. The threading and synchronized queue are all in .net/mono. How to actually sample the values I don't know. If you can get a library that does this, then use that in the thread.

Mar 16, 2011 at 05:43 PM Statement

Reading the licenses it seems you can be able to do this. http://unity3d.com/unity/licenses.html See plugins. http://unity3d.com/support/documentation/Manual/Plugins.html

Mar 16, 2011 at 05:47 PM Statement
(comments are locked)
10|3000 characters needed characters left

I want to know the EXACT moment in time between touches.

The point of interest is exact measurement of tap times independent of frame rate. Possible how?

From the input docs:

The iPhone/iPad screen is able to distinguish quick finger taps by the user. This counter will let you know how many times the user has tapped the screen without moving a finger to the sides.

Android devices do not count number of taps, this field is always 1

See Touch.tapCount. You can get Touches from Input.touches.

I don't know if this solves your problem or not, it apparently it will count the taps for you. If this is frame rate independent or not, I can't tell. If it is frame rate independent it probably won't offer you information about how long it took between each tap as it is only a value describing the number of taps. There exist also a deltaTime variable, but I don't know if you get a touch sample for every little tap. If you do, you can measure the distance in time between taps with this.

more ▼

answered Mar 16, 2011 at 02:28 PM

Statement gravatar image

Statement
26.2k 76 114 252

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x2887
x1637
x1189
x44
x2

asked: Mar 12, 2011 at 09:26 AM

Seen: 3857 times

Last Updated: Mar 16, 2011 at 02:51 AM