Does someone has a function to detect if the iPhone has been shaked?
Thank you.
That's something I have wondered about lately also (for a magic eight ball style app).
When shaken (not "shaked" or stirred) I'd imagine just toggling the extremes although haven't tried any yet. Wouldn't it be just a case of measuring the sensor change amounts? What a x,y,z graph look like?
I'd test for X > 1.5
I'm not sure if this can help you in GLB, but: http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone (http://stackoverflow.com/questions/150446/how-do-i-detect-when-someone-shakes-an-iphone)
Something like this works for me:
// shakey shakey
FUNCTION shake_input:
IF oMouse[0].xjoy<-0.25 AND shake_toggle<>-1
shake_toggle=-1
ENDIF
IF oMouse[0].xjoy>0.25 AND shake_toggle<>1 OR KEY(KEY_SPACE)
shake_toggle=1
INC shake_count,2
IF shake_count>10
shake_count=0
// shaken
ENDIF
ENDIF
IF shake_count>0
LOCAL temp_sin=SIN(GETTIMERALL())
IF temp_sin>0.99
DEC shake_count
ENDIF
ENDIF
ENDFUNCTION
Also:
ALPHAMODE shake_count/10.0 /// in loop for fade-out