Hi all,
I having an issue getting the (max) speed properly for a swipe / gesture along the Y axis in the down movement using the following implementation:
local flickStartTime = 0 local function touchListener(event) if event.phase == "began" then flickStartTime = system.getTimer() if timerStarted == false then timerStarted = true Runtime:addEventListener( "enterFrame", timerText ) end elseif event.phase == "moved" then local flickDuration = system.getTimer() - flickStartTime local speedY = (event.yStart - event.y) / flickDuration if secondsLeftt \> 0 then if speedY \< 0 then myObject.angularVelocity = (speedY \* 500 ) \* -1 end end end end
For the most part this works fine… HOWEVER the issue is when I try to get the max speed and store that value, the max speed jumps to 135 M/S even though I’m really averaging speed of 15 - 30 M/S see below how I am getting max speed below:
if speed \> maxSpeed then maxSpeed = speed end
Basically if the max Speed is greater then speed it sets that speed to the max and I’m just taking the speed from myObject.wheelAngularVelocity in the line before it.
It seems to be a real quick blip that it jumps to 135 speed and then continues on at the proper speed
Can someone spot my mistake here? Is there some limitation or a bug / glitch?
Has any one had experience accurately getting the speed of a swipe if doing this quickly over a certain time period?
Just need someone to point out what might be the issue here.
See example Gif below, I am swiping down at a fairly constant speed then it jumps to 135 for a moment.