- Home /
What exactly is in Touch.deltaTime?
(I came across this issue while looking at possible solutions to my other question: http://answers.unity3d.com/questions/26037/how-do-i-prevent-deal-with-input-lag-on-a-touch-interface).
Does anyone have any information on what the value in Touch.deltaTime is supposed to be? The documentation only says:
Amount of time passed since last change
But I can't figure out how this relates to Time.deltaTime. In my app, I often (but not always) get the touch deltaTimes to be zero while swiping, but non-zero Time.deltaTime. It almost looks like the touches are updated more often than Update is called...if this is the case, is there any way to get touch data in between?
Edit: I get similar results in FixedUpdate - touch.time is usually 0 or 0.012 (fixedDeltaTime = 0.02). Looking at deltaPosition, it looks like the touch data is the same for 4 fixedUpdate frames (I only looked at a sample, so I cannot tell whether it is exactly always 4 frames), which does not really make sense to me.
Another strange thing, while swiping at a moderate speed, deltaPosition.magnitude gets quite big (190). If this is the pixels travelled in 0.08s, then the finger moves at ~2400 pixels per second (which is much faster than I would expect).
Is it not possible that the touch update(change) was called right before Update and therefore the Touch.deltaTime is always 0 in Update? Is it always 0 in FixedUpdate as well? If change is what I interpret the word to mean, then capturing the Touch data more frequently will not really answer your first question though ($$anonymous$$ore on this in your first question).
@skovacs1 It could be, I'll do some more tests. I thought I could use the information for more accurate prediction, something like predictedPos = realPos + touch.deltaPosition / touch.deltaTime * Time.deltaTime or some version thereof.
Answer by Veehmot · Jul 10, 2013 at 05:50 AM
In fact it is updated more than the update call, jus like a mouse update. From the documentation:
Note that the accelerometer hardware can be polled more than once per frame. To access all accelerometer samples since the last frame, you can read the Input.accelerationEvents property array. This can be useful when reconstructing player motions, feeding acceleration data into a predictor, or implementing other precise motion analysis.
Your answer
Follow this Question
Related Questions
Touch.deltaTime returning a negative number on Android 0 Answers
Changing the speed variable does not change the speed of the motion of my touch based object. 2 Answers
adjust Sensitifity of joystick.js (mobile) 0 Answers
Make an object move in the direction of touch 0 Answers
Touch returns twice on Android 1 Answer